how to fix the orphaned users problem

  • How to fix the orphaned users problem in sql server 2008.

  • take a look at "sp_change_users_login" and "alter user"

  • I tried but it is not working

  • what have you tried, whats not working and what errors are you getting?

  • Nice avatar Anthony 🙂


    Sujeet Singh

  • gantavasu (2/17/2012)


    How to fix the orphaned users problem in sql server 2008.

    It seems you are asking it for some interview preparation from the way you are asking it 😉

    Please accept the suggestion of Anthony & have a look on SP_Change_Users_Login & ALTER USER commands on MSDN. It is well explained there with examples. If you don't understand anything from that, you may ask the question here then.


    Sujeet Singh

  • gantavasu (2/17/2012)


    How to fix the orphaned users problem in sql server 2008.

    Have a look on this article.

    http://www.mssqltips.com/sqlservertip/1590/understanding-and-dealing-with-orphaned-users-in-a-sql-server-database/

  • Divine Flame (2/17/2012)


    Nice avatar Anthony 🙂

    thanks, its an animated gif, but some reason the animation is not happening.

  • Sorry not like that i have moved the database from one server to another server here i am getting this problem. and also i don't have the exact idea about the orphaned users problem. that is the case i have posted here

  • gantavasu (2/18/2012)


    Sorry not like that i have moved the database from one server to another server here i am getting this problem. and also i don't have the exact idea about the orphaned users problem. that is the case i have posted here

    Couple of questions

    has the database with the orphaned users come from a previous version of SQL Server?

    do you want the logins original passwords retained or can you use new ones?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Sp_change_users_login 'report'

    This gives you the list of orphaned users in the database.

    sp_change_users_login 'auto_fix','orphaned users'

    this will fix the orphaned user in the database.

    Cheers !!!!

    ---- Babu

  • Maybe you decided not to read the article posted in earlier posts because you like this forum better. So, here you go. Each user that is set up in SQL Server on an instance is given a unique id. Even though user 'jared' is on instanceA and instanceB, this user has a different unique id associated with it that was generated at the time the user was created. This way, if we change the users name from 'jared' to 'jkarney' we don't have to go and update every place where 'jared' exists. Similar to why we so this in normal database design. When you restore a database from another instance, even if it has the same user names, it's stored ids are different. So they are out of sync. This is "WHY" you have to identify and fix orphaned users.

    Jared
    CE - Microsoft

  • sp_change_users_login is going to be deprecated

    http://msdn.microsoft.com/en-us/library/ms174378.aspx

    --------------------------------------------------------------------------------------------------
    I am just an another naive wannabe DBA trying to learn SQL Server

  • Sachin Nandanwar (2/21/2012)


    sp_change_users_login is going to be deprecated

    http://msdn.microsoft.com/en-us/library/ms174378.aspx

    Yes, but this is a 2008 forum and we should still use the tools given to us for the time being. I don't see "many" people using this sp in their scripts, it is typically a manual thing. So why not use it?

    Jared
    CE - Microsoft

  • SQLKnowItAll (2/21/2012)


    Sachin Nandanwar (2/21/2012)


    sp_change_users_login is going to be deprecated

    http://msdn.microsoft.com/en-us/library/ms174378.aspx

    Yes, but this is a 2008 forum and we should still use the tools given to us for the time being. I don't see "many" people using this sp in their scripts, it is typically a manual thing. So why not use it?

    granted that yes it is going to be deprecated, and granted to Jared as well, but we also give the new syntax with ALTER USER statement

Viewing 15 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic. Login to reply