dbTalk Databases Forums  

Restore sql server express bak file as different db?

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Restore sql server express bak file as different db? in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nano
 
Posts: n/a

Default Restore sql server express bak file as different db? - 08-24-2007 , 10:55 AM






I have a bak file of a sql server express database from another server,
and I'd like to restore it to my dev box as a different database. Does
anyone know how to do this?

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Restore sql server express bak file as different db? - 08-24-2007 , 04:49 PM






nano (nano (AT) nano (DOT) ono) writes:
Quote:
I have a bak file of a sql server express database from another server,
and I'd like to restore it to my dev box as a different database. Does
anyone know how to do this?
First run

RESTORE FILELIST_ONLY FROM DISK = '<path>'

Make a note of the logical files names. Then run:

RESTORE DATABASE db FROM DISK = '<path>'
WITH MOVE '<logicalfile1>' TO '<pathwhereyouwantit>.mdf',
MOVE '<logicalfile2>' TO '<pathwhereyouwantit>.ldf',
REPLACE

See also the RESTORE command in Books Online. I might have confused
FILELIST_ONLY and HEADERONLY.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.