Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I moved a database from SQL Server 2005 to SQL Server 2012. Is there any way of restoring all the logins on the new server?

share|improve this question
Should be similar / identical to how you copy logins to a mirror server - Robert Davis has a great script for this. – Aaron Bertrand Jul 31 '13 at 20:27
SSIS also makes the extremely easy and quick. – Thomas Stringer Jul 31 '13 at 20:53
up vote 4 down vote accepted

You will want to use the 'transfer logins' script provided by MS. Pinal had a write up of it here. I do not remember if I used this to move logins TO 2012, I think I did to setup a QA environment but not sure. You might need to make minor adjustments but I think it'll work fine.

Keep in mind if you use AD logins and changed domains with no trusts, those users will need to be recreated with the correct security permissions which this script does not do. This post references SQLSoldier (A SQL guru) and has a handy script.

share|improve this answer
If you are moving a single database from one instance to another you will also want to be sure that you move ONLY those logins that are required by that database. If you are like me and have an instance with 100s of databases/applications then you probably don't want to grant the 90% that are unrelated to the new DB access to the new instance. – Kenneth Fisher Jul 31 '13 at 20:34
Good point Kenneth, the OP did mention 'a database' and not 'database server'. OP, please only copy users that are in the DB that is in question, if that's the case. – Ali Razeghi Jul 31 '13 at 20:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.