Saturday, February 25, 2012

osql - restore database

Please help,
Using OSQL
How can I restore into a database called ‘mydb1’ from a backup of database
‘mydb2’
Tanks
hi Carlos,
Carlos AZ wrote:
> Please help,
> Using OSQL
> How can I restore into a database called 'mydb1' from a backup of
> database 'mydb2'
>
you have to modify the database name to the new name..
and of course specify a different file system location for the physical
files or you will overwrite the original mydb1 files..
following you can see a statement that restores to pubs2 the pubs database
backup, moving the datafile and the transaction log file to new physical
files..
RESTORE DATABASE [pubs2] FROM DISK = N'C:\Programmi\Microsoft SQL
Server\MSSQL\BACKUP\pubs.bak'
WITH FILE = 1,
NOUNLOAD ,
STATS = 10,
RECOVERY ,
MOVE N'pubs' TO N'C:\Programmi\Microsoft SQL
Server\MSSQL\data\pubs_2.mdf',
MOVE N'pubs_log' TO N'C:\Programmi\Microsoft SQL
Server\MSSQL\data\pubs_log_2.ldf'
please have a look at
http://msdn.microsoft.com/library/de...ra-rz_25rm.asp
for RESTORE statement synopsis
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.10.0 - DbaMgr ver 0.56.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

No comments:

Post a Comment