Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

orphaned Users Expand / Collapse
Author
Message
Posted Wednesday, January 2, 2013 9:46 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 23, 2013 7:48 AM
Points: 3, Visits: 64
hi can you please any one tell me what is exactly orphaned users and when will use this one and how to troubleshoot?

Thanks in Advance.

Regards,
Raja.
Post #1402166
Posted Wednesday, January 2, 2013 10:04 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, August 22, 2014 11:33 PM
Points: 15, Visits: 131
Attaching and restoring databases from one server instance to another are common tasks executed by a DBA.If we move our database to another SQL Server instance through any process, the new server might or might not have the same logins and the SIDs of these logins would probably be different from the SIDs of these logins in the original server. What this means is that, the sysusers table in the moved database has SIDs that are not matched with the login info in the master database on this new server. Therefore we get orphaned users


Once the Database is restored on the new instance. Run the below commands to troubleshoot and fix the issue.

-Command to generate list of orphaned users

USE <DBNAME>
GO

sp_change_users_login @Action='Report'

GO


--Command to map an orphaned user

EXEC sp_change_users_login 'Auto_Fix', '<Username>'
GO

If a login name does not exists, you would have to create it first before doing the mapping. A quick way to do this is to use the following command which will create the login and then map the login to the user


--Command to map an orphaned user to a login that is not present but will be created

EXEC sp_change_users_login 'Auto_Fix', '<Username>', null,'<pwd>'
GO
Post #1402169
Posted Thursday, January 3, 2013 4:19 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 12:26 AM
Points: 2,840, Visits: 3,963
brangaraja (1/2/2013)
hi can you please any one tell me what is exactly orphaned users and when will use this one and how to troubleshoot?
For details see this link http://www.mssqltips.com/sqlservertip/1590/understanding-and-dealing-with-orphaned-users-in-a-sql-server-database/


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1402286
Posted Thursday, January 3, 2013 4:21 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 12:26 AM
Points: 2,840, Visits: 3,963
Rama Chandra Gowtham. Peddada (1/2/2013)
Attaching and restoring databases from one server instance to another are common tasks executed by a DBA.If we move our database to another SQL Server instance through any process, the new server might or might not have the same logins and the SIDs of these logins would probably be different from the SIDs of these logins in the original server. What this means is that, the sysusers table in the moved database has SIDs that are not matched with the login info in the master database on this new server. Therefore we get orphaned users


Once the Database is restored on the new instance. Run the below commands to troubleshoot and fix the issue.

-Command to generate list of orphaned users

USE <DBNAME>
GO

sp_change_users_login @Action='Report'

GO


--Command to map an orphaned user

EXEC sp_change_users_login 'Auto_Fix', '<Username>'
GO

If a login name does not exists, you would have to create it first before doing the mapping. A quick way to do this is to use the following command which will create the login and then map the login to the user


--Command to map an orphaned user to a login that is not present but will be created

EXEC sp_change_users_login 'Auto_Fix', '<Username>', null,'<pwd>'
GO
you need to give credit to the main poster/blogger OR even paste his/her link.These are forum etiquettes


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1402288
Posted Thursday, January 3, 2013 4:35 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 8:53 AM
Points: 5,218, Visits: 5,072
Also remember that sp_change_users_login is a depreciated command, it has been replaced by ALTER LOGIN and will be removed from a future release on SQL.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1402294
Posted Friday, January 4, 2013 1:40 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, May 5, 2014 4:05 AM
Points: 10, Visits: 72
I hope this link will help you..
http://sqlscripthub.blogspot.in/2012/11/sqlworld.html
Post #1402746
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse