Unix Technical Forum

restore from different server - user (sid) does not match restored db - fix with sp_changeobjectowner

This is a discussion on restore from different server - user (sid) does not match restored db - fix with sp_changeobjectowner within the SQL Server forums, part of the Microsoft SQL Server category; --> This is more of a fyi than a question. After restoring a live db backup to our development server ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 04:14 AM
Jol
 
Posts: n/a
Default restore from different server - user (sid) does not match restored db - fix with sp_changeobjectowner

This is more of a fyi than a question.

After restoring a live db backup to our development server there was
an identically named login Melb02 on both the db server and in the
restored db backup.
However if you log in as Melb02 on the server you cannot access any
objects owned by Melb02 on the restored db, without putting
Melb02.<object_name> in front. This would break our app so we needed
a workarround.
The mssql docs say that first check if the login is the owner, then
dbo then deny access - something to that effect. So this was
confusing.

workarround
I think what happened was that the db restored from the live remote
server had a different security id (sid) to the development server
although both users had the same name: Melb02. Thus if you log in as
Melb02 you can't get access to Melb02 objects on the restored db
because of the different sid.

we wrote a cursor that went though everything in sysobjects belonging
to Melb02 and did a : sp_changeobjectowner to a new user login that
our app now happily uses.
Jol.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 04:14 AM
John Bell
 
Posts: n/a
Default Re: restore from different server - user (sid) does not match restored db - fix with sp_changeobjectowner

Hi

Read http://support.microsoft.com/default...;en-us;Q314546
regarding moving databases. If you are not moving the login then you will
need to resolve the orphaned users.

John

"Jol" <jol.blazey@spcm.com.au> wrote in message
news:b29750c6.0406142157.52365d4@posting.google.co m...
> This is more of a fyi than a question.
>
> After restoring a live db backup to our development server there was
> an identically named login Melb02 on both the db server and in the
> restored db backup.
> However if you log in as Melb02 on the server you cannot access any
> objects owned by Melb02 on the restored db, without putting
> Melb02.<object_name> in front. This would break our app so we needed
> a workarround.
> The mssql docs say that first check if the login is the owner, then
> dbo then deny access - something to that effect. So this was
> confusing.
>
> workarround
> I think what happened was that the db restored from the live remote
> server had a different security id (sid) to the development server
> although both users had the same name: Melb02. Thus if you log in as
> Melb02 you can't get access to Melb02 objects on the restored db
> because of the different sid.
>
> we wrote a cursor that went though everything in sysobjects belonging
> to Melb02 and did a : sp_changeobjectowner to a new user login that
> our app now happily uses.
> Jol.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:23 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com