Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restoring a backup to a different location

Status
Not open for further replies.

fdarkness

Programmer
Feb 17, 2006
110
CA
Currently, I have a backup file that's downloaded on a daily basis to a drive on my server called dn0r.dbu. There's a SQL management job that executes every morning that extracts the tables from the backup file to a database on my server called dn0r.

The command that's executing this backup is:

RESTORE DATABASE dn0r FROM DISK = 'G:\dbbkups\mssql\cis0\dn0r.dbu'

I need to change this so that the dn0r.dbu file is being restored to a database called CISSite. The problem I run into is that according to the MS support site, I cannot restore to a database where the files don't belong. I'm assuming this means that I can't just restore dn0r.dbu to CISSite.

MS support site page:

The page does add that you can "perform a full database restore in another location". Searching on this information gives me the MSDN page for it:


But from what I'm reading, it's about restoring from C:\ to D:\ in the example... not quite what I want to do.

Is there any way to restore the tables to a different database than the one that's named?

Thanks in advance!
 
right to clarify, so 'dn0r.dbu' is a full back up of your database dn0r.

And you want to get this restored onto another machine, renamed as CISSite. Is it just the tables you want or the whole database?

Matt

Brighton, UK
 
Hi Matt

I actually managed to get it going... but in a nutshell, dn0r is a subset of data on a remote server which is transferred to my server. Then a job restores the contents of the dn0r.dbu to a database called "dn0r".

What I wanted to do was restore the contents to the same server, but to a completely different database, namely CISSite. I was able to do that, but it seems that the restore option dumps all the existing tables in CISSite. I don't care if it dumps the ones its restoring, but the other 20 tables aren't supposed to disappear.

So right now I've got it restoring to a different database (dn0r.dbu restores to a database called Facts for example). It's not the optimal solution, as I'm going to wind up with two databases that I have to work with, but at least it's working:

Code:
use master
go
RESTORE DATABASE Facts
   FROM DISK = 'G:\dbbkups\mssql\cis0\dn0r.dbu'
   WITH MOVE 'dn0r_Data' TO 'G:\dbbkups\mssql\cis0\Facts_Data.mdf',
        MOVE 'dn0r_Log' TO 'G:\dbbkups\mssql\cis0\Facts_Log.ldf',
REPLACE

If you know of a way I can restore the dbase to CISSite while keeping the other tables in that dbase intact, I'd be very happy. :)
 
so you just want to copy tables from one database into another database, replacing the contents of the destination table?

If so you should be able to do that easily with dts (what version of sql server are you using?)

Matt

Brighton, UK
 
I'd like to restore from the backup into an existing database without dropping the tables that already exist (but overwriting the ones that are being replaced by the restore).

And I'm not sure which version... how do I find that? According to Query Analyzer and Enterprise Manager, it says 8.0. Does that make sense?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top