question

thennarasu avatar image
thennarasu asked

Restore Backup from one server to another server

I have two servers in different pc i wank to know the script for restore the database from one server in one pc to another server in another pc i did backup using this script
BACKUP DATABASE [MyDB1] 
TO DISK = N'c:\backup\MyDB1.bak' 
WITH INIT, SKIP, CHECKSUM
GO
now i want to know script to restore this backup to another server in another computer this script to restore within the same machine but how to madify this to another computer
RESTORE DATABASE
    MyDB1Restore
FROM DISK = N'C:\Backup\MyDB1.bak'
WITH 
    MOVE 'MyDB1' TO 'C:\MyDB1Restore.mdf',
    MOVE 'MyDB1_log' TO 'C:\MyDB1Restore.ldf'
, REPLACE
databasesql server 2014script-task
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
jason_clark03 avatar image
jason_clark03 answered
You can find out the name of the logical files (in the above, those are called MyDB1Restore.mdf and MyDB1Restore.ldf' by running the Below command: RESTORE FILELISTONLY FROM DISK = N'C:\Backup\MyDB1.bak'
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.