SQL Orphan login issue

  • I copied database from Prod to Dev instance. Whe the database was restored I ran

    -----See if there are any orphan users:

    EXEC sp_change_users_login 'Report'

    The output was :

    finq_sql 0xB058747F1E577148862C570381789901

    linkserver 0xE040BAD5EEE23049B759C8D750F6C82E

    NOTE : These 2 users are SQL users only and I not have password for them. They are there in Prod but not in Dev. SO How do i crate those users in Dev from Prod. I did script the user from Prod but gives me error that 'it does not meet the minimum password requirement'

    Can someone please tell me how to create user at instance level and map it to database in Dev?

  • In your script that you have to create the logins in dev you need to add the following:

    , CHECK_POLICY = OFF to turn off the password policy. After that try running your sproc again.



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • http://www.sqlservercentral.com/scripts/Logins/104750/[/url]

    If you are comfortable with PowerShell, this will script the login with the same password and SID.

  • I use the Auto_Fix option on sp_change_users_login to fix orphan users.

    Kurt

    Kurt W. Zimmerman
    SR DBA
    Lefrak Organization
    New York, NY

    http://www.linkedin.com/in/kurtwzimmerman

  • Aatish Patel (12/5/2013)


    I copied database from Prod to Dev instance. Whe the database was restored I ran

    -----See if there are any orphan users:

    EXEC sp_change_users_login 'Report'

    The output was :

    finq_sql 0xB058747F1E577148862C570381789901

    linkserver 0xE040BAD5EEE23049B759C8D750F6C82E

    NOTE : These 2 users are SQL users only and I not have password for them. They are there in Prod but not in Dev. SO How do i crate those users in Dev from Prod. I did script the user from Prod but gives me error that 'it does not meet the minimum password requirement'

    Can someone please tell me how to create user at instance level and map it to database in Dev?

    This script will generate the create login command retaining the password and SID. execute the script itself against the Prod server and then execute the output against the dev server

    SELECT'CREATE LOGIN ' + name + ' WITH PASSWORD = ' +

    sys.fn_varbintohexstr(password_hash) +

    ' HASHED, SID = ' + sys.fn_varbintohexstr(sid) +

    ', DEFAULT_DATABASE = ' + QUOTENAME(default_database_name) +

    ', DEFAULT_LANGUAGE = ' + default_language_name +

    ', CHECK_EXPIRATION = ' +

    CASE

    WHEN is_expiration_checked = 0 THEN 'OFF'

    ELSE 'ON'

    END +

    ', CHECK_POLICY = ' +

    CASE

    WHEN is_policy_checked = 0 THEN 'OFF'

    ELSE 'ON'

    END

    FROM master.sys.sql_logins

    WHERE name = 'yoursqllogin'

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

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

Viewing 5 posts - 1 through 4 (of 4 total)

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