You are here: Re: Restore sql server express bak file as different db? « MsSQL Server « IT news, forums, messages
Re: Restore sql server express bak file as different db?

Posted by Erland Sommarskog on 08/24/07 21:49

nano (nano@nano.ono) writes:
> 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@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация