1) Place the backup file <SampleBackupFile.bak> to an accessible location <E:\SampleFolder>.
2) Retrieve the mdf and ldf file names of the database from the backup file using the below query.
RESTORE FILELISTONLY
FROM DISK = 'E:\SampleFolder\SampleBackupFile.bak'
3) Now restore the database <SampleDB> using the below query.
RESTORE DATABASE <SampleDB>
FROM DISK = 'E:\SampleFolder\SampleBackupFile.bak'
WITH MOVE 'mdf_filename'
TO 'E:\SampleFolder\SampleMDFFile.mdf',
MOVE 'ldf_filename'
TO 'E:\SampleFolder\SampleLDFFile.ldf'
Good one. Will try next time while restoring backup.
ReplyDeleteohh great you solve my problem..
ReplyDelete