Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Database backup for different database
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

United Kingdom
207 Posts

Posted - 10/19/2012 :  10:42:41  Show Profile  Reply with Quote
Hi there,

I know there is quite a few threads on this topic but can't for the life of me get this working.

I have a backup from a database (dbSource) and I want to use this backup and restore it to another database (dbTarget) which is at the moment emtpy.

I don't want to affect dbSource when I use this backup but I get errors saying I can't overwrite dbSrouce. I don't want to overwrite it... and don't want to touch this database.

I only want to use the back up to make a 'copy' of it over dbTarget.

Please can someone help me with this.

Most Valuable Yak

15732 Posts

Posted - 10/19/2012 :  11:06:09  Show Profile  Visit robvolk's Homepage  Reply with Quote
RESTORE DATABASE dbTarget FROM DISK='backup file location' WITH REPLACE
Note that if dbSource and dbTarget have different logical names for data and log files, you'll need to use the MOVE option in the RESTORE command:
RESTORE DATABASE dbTarget FROM DISK='backup file location' WITH REPLACE
, MOVE 'dbSource_Data' TO 'path to dbTarget MDF file'
, MOVE 'dbSource_Log' TO 'path to dbTarget LDF file'
Naturally it's a good idea to make a backup of dbTarget first, unless it's completely empty.
Go to Top of Page

Posting Yak Master

United Kingdom
207 Posts

Posted - 10/21/2012 :  09:54:19  Show Profile  Reply with Quote

With a bit of fiddling about and RESTORE FILELISTONLY, along with the code you supplied, I managed to get this working.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000