January 2, 2013 at 9:46 pm
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.
January 2, 2013 at 10:04 pm
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
January 3, 2013 at 4:19 am
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;-)
January 3, 2013 at 4:21 am
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 usersOnce 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;-)
January 3, 2013 at 4:35 am
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.
January 4, 2013 at 1:40 am
I hope this link will help you..
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply