« Home | Windows Media Services Logs » | Creating Hosts under Mac OS X » | Enable Windows PHP Logging to a File » | Change the Site Identifier in IIS » | When Terminal Services Sessions Are Full » | Capture a printer port in Windows XP » | Manage Outlook's Address Book » | Proliant ML330 Hard Drive Performance Boost » | Windows Environment Variables » | Fixing Outlook's Reminders » 

Thursday, November 02, 2006

Restore MS SQL database on separate server

So in the midst of doing server migration, I was having a problem with a restored database giving me "permission denied" errors on the new SQL 2005 server I set up. It turns out the problem was due to orphaned users, where the users' old unique identifier (called a security identifier or SID) would not match the new server's even though the user names are equivalent.

To fix that in MSSQL 2000 and above, you first should determine the orphaned users by issuing the following query:
exec sp_change_users_login 'report'

Once you have the usernames, use the following query to reconcile the SIDs:
exec sp_change_users_login 'auto_fix', 'username'

Note that this will only work if you have the same named users on the destination server.

E-mail this post



Remember me (?)



All personal information that you provide here will be governed by the Privacy Policy of Blogger.com. More...

Add a comment