Groups | Blog | Home
all groups > sql server (microsoft) > april 2007 >

sql server (microsoft) : Restore a backup to a different db name and path


Monik0277
4/11/2007 10:46:49 AM
Hello All,

I have the following situation:

Database1 on my sql server with the following path: C:\DBs
\Database1.mdf, etc... I made a backup of this database. Now I need
to restore this backup on a different pc into the following: Database2
with the following path C:\Customers\DBS\Database2.mdf, etc... I have
MSDE install on the pc so I dont have the enterprise manager that will
allow me to restore a db and rename the path and file name. What is
the script that I need to run using the osql command?

Thanks
Brian Bunin
4/11/2007 5:00:30 PM
[quoted text, click to view]


RESTORE DATABASE Database2
FROM DISK = ''C:\SQLBACKUP\Database.bak''
WITH MOVE ''Database'' TO ''C:\Program Files\Microsoft SQL Server
\MSSQL.1\MSSQL\DATA\Database2.mdf'',
MOVE ''Database_log'' TO ''C:\Program Files\Microsoft SQL Server
\MSSQL.1\MSSQL\DATA\Database2.ldf'',
REPLACE'
Monik0277
4/13/2007 11:45:23 AM


I get the following error:

Server: Msg 3234, Level 16, State 2, Line 1
Logical file 'Database1' is not part of database 'Database2'. Use
RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
AddThis Social Bookmark Button