How to Back Up and Restore SQL Server Logins

Backing Up and Restoring Logins

You can back up and restore logins using a script as described in the following procedures.

To back up a login using a script (SQL Server 2005 or SQL Server 2008)
  1. Start SQL Server Management Studio.
  2. Expand the Security folder, and then expand the list of Logins.
  3. Right-click the login you want to create a backup script for, and then select Script Login as.
  4. Click CREATE To, and then click one of New Query Editor WindowFile, or Clipboard to select a destination for the script. Typically, the destination is a file with a .sql extension.
  5. Repeat this procedure from Step 3 for each login you want to script.
To restore a login from a script (SQL Server 2005 or SQL Server 2008)
  1. Start SQL Server Management Studio.
  2. Click File, click Open, and then click File.
  3. Locate and open the file containing the scripted login.
  4. Execute the script to create the login.

Leave a Reply

Your email address will not be published. Required fields are marked *