none
RESTORE Database containing passwords not fitting to changed windows policy

    Question

  • Hi

    How can a backup of an SQL Server database be restored when it contains passwords which are not anymore fitting within windows password policy? 

     

    I do perform the following SQL command to restore the database:

    RESTORE DATABASE maindb FROM DISK = 'C:\..' WITH STATS,
    MOVE 'instance' to 'C:\...',
    MOVE 'instance_log' to 'C:\...'
    

    Now, the problem is, the backupfile might contain passwords which do not anymore fullfill the password policies of the machine.

    What are the solutions?

    • Is there a way to deactivate the check? Such as a /NOCHECK option to give to the RESTORE command?
    • Is there a way to give the RESTORE command new passwords?
    Thursday, July 14, 2011 1:55 PM

Answers

  • Hi tcom,

    AFAIK, database users do not have passwords associated, they have a Login associated with them, which is created on the Server not in the database.

    DATABASE does not contain passwords, and neither the BACKUP.

    It is the LOGIN which has the password associated.


    - Vishal

    SqlAndMe.com


    • Marked as answer by tcom Friday, July 15, 2011 11:51 AM
    Thursday, July 14, 2011 2:19 PM

All replies

  • There is no such option to skip the password if the back up is password protected. If you try to restore a backup that is password protected, you will get an error stating access denied due to incorrect password.

    For this you have to specify the password in your restore command.

    RESTORE DATABASE maindb FROM DISK = 'C:\..' WITH STATS,
    MOVE 'instance' to 'C:\...',
    MOVE 'instance_log' to 'C:\...',
    PASSWORD = 'YOUR PASSWORD'
    


     


    Regards, Deven ----------------------------------------- Please vote if you find any of my post helpful.
    Thursday, July 14, 2011 2:14 PM
  • Hi tcom,

    AFAIK, database users do not have passwords associated, they have a Login associated with them, which is created on the Server not in the database.

    DATABASE does not contain passwords, and neither the BACKUP.

    It is the LOGIN which has the password associated.


    - Vishal

    SqlAndMe.com


    • Marked as answer by tcom Friday, July 15, 2011 11:51 AM
    Thursday, July 14, 2011 2:19 PM
  • Thank you both for the replies.

    I tried to reproduce the problem just by using the RESTORE DATABASE command and was not able to. Vishal is right, the backup does not contain the passwords. The RESTORE command does seem to work whatever the password policies of the machine are. My problem was hidden in the code, I expected the RESTORE DATABASE was causing the problem, but it is the command after the restore where the LOGINs are created, here the passwords are checked against the policies.

    The problem is solved.

    Friday, July 15, 2011 11:50 AM