possible to restore full backup of a different database?

  • Question:

    I have SQL 2008, which has a few databases.

    I can create a copy of a current database to test and poke around in, and not worry about messing anything up. But now I need to restore a full backup from Friday.

    The backup is of database1. I need to restore this backup into database_test. I need the older version of the data in database1, not the most recent, so a copy_db will not work for me. When I try to restore database1 full backup into database_test, it tells me that the backup is not for this db. Anyway to override this?

  • It's not clear what you are doing or what's wrong.

    Any full backup can be restored on top of any database. You cannot, however, restore a differential unless it is being applied after a full backup restore of the same database. Those are linked.

    What backup (type and date) are you trying to restore.

  • I have a full backup of an existing database named db1, which I am trying to restore in an existing database named db2, on the same SQL server instance.

    This is the error I get:

    "The backup set holds a backup of a database other than the existing 'db2' database."

    I figured it out....

    I have to drop db2, and then I can restore db1 into db2.

  • You don't have to drop the database. You just have to move the files and overwrite the existing database.

    But I am confused by your initial question. You said that you wanted to restore the database but keep the old data? You can't do both. A restore will overwrite the existing data.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • restore with replace to copy over the existing database: http://msdn.microsoft.com/en-us/library/ms186858.aspx

    Or in SSMS, on the options tab, check the "overwrite"

    This, as Grant mentioned, overwrites everything in the database with what's in the backup file. There is no saving any data from the database.

  • I want to keep db1 as is, and overwrite db2. db2 is my sandbox playground, where I can do what I want to a copy of the real data, without actually damaging the real data. I have no need or desire to retain anything in db2 when I restore db1 into db2.

  • odeonkreel (3/14/2011)


    I have no need or desire to retain anything in db2 when I restore db1 into db2.

    so, as already stated when restoring DB1 over DB2 use the REPLACE option via T-SQL or the overwrite checkbox via the GUI

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply