|
Posted by Erland Sommarskog on 09/21/06 21:56
BD (robert.drea@gmail.com) writes:
> -Used 'Create SQL script' to generate a create db statement from the
> current db.
> -Changed the db name, and all file paths to not conflict with the
> current db.
> -Created a new db in a new directory with this script.
> -Restored last night's backup from the 'real' db to the new one.
That's a bit overkill. You can use the RESTORE command to do all that:
RESTORE newdbname FROM disk = '...'
WITH MOVE 'datafile' TO 'newpath',
MOVE 'logfile' TO 'newpath',
REPLACE
You can get the values for datafile and logfile from sp_helpdb or
RESTORE FILELISTONLY if there is no copy of the database online.
--
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]
|