Register   |   Login   |   February 07, 2012    |   Knowledge Base  >  Knowledge Base Systems  >  MSSQL  >  Repair a sql login ( orphan sql users)
search:     

Phone: 480-722-1227
Toll Free: 888-722-1227

Repair a sql login ( orphan sql users)
Last Post 08 Sep 2008 06:02 AM by Vigilant CIO. 4 Replies.
Printer Friendly
Sort:
PrevPrev
You are not authorized to post a reply.
Author Messages
Vigilant CIOUser is Offline
Basic Member
Basic Member
Posts:360

--
21 Feb 2007 08:30 PM  

MSSQL login
Ref MSFT articles; KBA-01010 , http://support.microsoft.com/kb/274188/, How to move sql databases
Problem
MSSQL login broken when database restored from another server
Solution
Find the names of the orphaned users
In enterprise manager, open restored database
select users folder
look for users with no login name
Run this script for the orphanned user (you may have to create the user in enterprise manager>security 1st)
EXEC sp_change_users_login 'Auto_Fix', 'pubuser'

output when successful;

The row for user 'privuser' will be fixed by updating its login link to a login already in existence.
The number of orphaned users fixed by updating users was 1.
The number of orphaned users fixed by adding new logins and then updating users was 0.

Reset passwords if necessary

Additional Comments
Solution found in experts exchange;

http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21497213.html?query=database+login&clearTAFilter=true

Chris MuenchUser is Offline
New Member
New Member
Posts:57

--
22 Feb 2007 04:28 AM  
Also the following works to change the owner of a table or anything else

sp_changeobjectowner '[dnnadmin].[aspsearch]' , 'dbo'
SuperUser AccountUser is Offline
Basic Member
Basic Member
Posts:105

--
25 Mar 2007 11:24 PM  
ran into a sql login problem; web app could not load, but the user showed up in sql activity monitor. turned out, user did not have proper access level. changed to dbo and it work. need to determine lowest operable security role to run app
Vigilant CIOUser is Offline
Basic Member
Basic Member
Posts:360

--
05 Jan 2008 11:26 PM  

This article is very detailed on bulk transfer of users between various SQL database versions

How to move databases between computers that are running SQL Server

and How to transfer logins and passwords between instances of SQL Server

Vigilant CIOUser is Offline
Basic Member
Basic Member
Posts:360

--
08 Sep 2008 06:02 AM  
Odly enough, somtimes after restoring a database, the dbo user shows up when running
sp_change_users_login 'report'
In this case, running EXEC sp_changedbowner 'sa' seems to correct the issue
You are not authorized to post a reply.

Active Forums 4.2
Copyright 2006 - 2011 Vigilant Support   |  Privacy Statement  |  Terms Of Use