Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9200361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:45:00+00:00 2026-06-17T22:45:00+00:00

I’m planning the migration of some SQL Server 2008 R2 databases between two servers.

  • 0

I’m planning the migration of some SQL Server 2008 R2 databases between two servers.

The proposal is to follow Method 3 in this article: http://support.microsoft.com/kb/918992 to transfer logins across after the databases have been migrated.

This mostly looks OK to me but one concern is if any of these logins already exist on the target server. If this is the case would anything additional need to be done and if so what?

[My understanding’s a little hazy here – is it possible that users in the restored database would still be orphaned since the logins they referenced have different SIDs on the new server?]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:45:02+00:00Added an answer on June 17, 2026 at 10:45 pm

    That script generates login scripts rather than executing the statements directly, so you can review them, and just run the scripts for users that don’t already exist on the target.

    The script will generate new SIDs dependant on whether the new login needs a new one – it depends on the type of login.

    From MSDN on the subject:

    The source of the SID depends on how the login is created. If the
    login is created from a Windows user or group, it is given the Windows
    SID of the source principal; the Windows SID is unique within the
    domain. If the SQL Server login is created from a certificate or
    asymmetric key, it is assigned a SID derived from the SHA-1 hash of
    the public key. If the login is created as a legacy-style SQL Server
    login that requires a password, the server will generate a SID.

    I don’t think you need to worry about that unless you’re using the sys.server_principals table for something special.


    From the comments below, Steve wanted to create the logins by script, and detach and re-attach the databases on the new server. The concern was that these logins would now be orphaned – i.e. attached to a login on the original server with the same name as the one on the new server, but with a different SID.

    Yes, this would be a problem. To sort this, you’d need to visit this MSDN article. To summarise:

    To detect orphaned users, execute the following Transact-SQL statements:

    USE <database_name>;
    GO; 
    sp_change_users_login @Action='Report';
    GO;
    

    The output lists the users and corresponding security identifiers (SID) in the current database that are not linked to any SQL Server login. For more information, see sp_change_users_login (Transact-SQL).

    To resolve an orphaned user, use the following procedure:

    The following command relinks the server login account specified by with the database user specified.

    USE <database_name>;
    GO
    sp_change_users_login @Action='update_one', @UserNamePattern='<database_user>', 
       @LoginName='<login_name>';
    GO
    

    As Steve points out, sp_change_users_login is depreciated and the preferred alternative is to use ALTER USER:

    ALTER USER <database_user>
    WITH LOGIN <login_name>
    

    MSDN link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I've tracked down a weird MySQL problem to the two different ways I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.