locked
SetRestoreOptions - Restore with Rename RRS feed

  • Question

  • Hello,

    Is it possible to restore database with rename side by side with original database on same instance? If I use SetRestoreOptions as described in previous answers I could restore DB with new name only if original does not exists on server. 

    Thursday, January 5, 2012 12:47 PM

Answers

  • You should be able to restore a database side-by-side with the original which was backed up provided you give the restored database a new name, AND relocate the files so that they don't try to overwrite the original database files.  By default a database will restore to the same location/file path that it was backed up from.

    As long as that is done, there should be no issue with restoring a database to the same instance, and in fact this is done all the time in our test suites, with both TSQL and VSS/snapshot backups.


    Microsoft SQL Server Storage Engine PM
    • Proposed as answer by PrinceLucifer Tuesday, January 10, 2012 7:14 AM
    • Marked as answer by Ljubomir Tuesday, January 10, 2012 8:09 AM
    Monday, January 9, 2012 5:15 PM

All replies

  • Hi

    There is nothing stopping you from restoring the same DB from a backup several times on the same server, using different names, if that is what your question was all about.

    Lucifer

    Monday, January 9, 2012 7:11 AM
  • You should be able to restore a database side-by-side with the original which was backed up provided you give the restored database a new name, AND relocate the files so that they don't try to overwrite the original database files.  By default a database will restore to the same location/file path that it was backed up from.

    As long as that is done, there should be no issue with restoring a database to the same instance, and in fact this is done all the time in our test suites, with both TSQL and VSS/snapshot backups.


    Microsoft SQL Server Storage Engine PM
    • Proposed as answer by PrinceLucifer Tuesday, January 10, 2012 7:14 AM
    • Marked as answer by Ljubomir Tuesday, January 10, 2012 8:09 AM
    Monday, January 9, 2012 5:15 PM
  • Kevin,

    Thank you for your answer. I was aware that databases should be restored to another physical location in order to get them up and running. So, I used AddNewTarget() to set alternate restore location. Files are restored, and database is showed in Management Studio - but it is showed as ghost - just icon. There is no tables, no files, nothing. 

     

    Tuesday, January 10, 2012 8:18 AM
  • Hello, Kevin

    When I do aside-by-side restore usingthe VSS I receivetwodatabaseswith the sameguid in the sys.database_recovery_status.

    Is this normal?

    Whydatabaseis identified bynamerather thanguid?Indeed,within thedifferentinstancesthat name is notunique.

    When I made ​​a backup of database "A" at the instance "instance1" and tried to restore the database "A" at the instance "instance2" this is database will be differ from "A" at the instance "instance2"?

    Regards, Dima.

    Friday, March 2, 2012 9:10 AM