Sql-server – Error when restoring up a database backup: Cannot find file ID 1 on device

restoresql serversql-server-2008

Below is the query that I am using to restore my database.

However, whenever I run it, i always get this error message:

Msg 4038, Level 16, State 1, Line 1
Cannot find file ID 1 on device 'D:\DB_Backup\MMS.BAK'.

Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

This is my query:

RESTORE DATABASE METERIAL_MANAGEMENT_2 
FROM DISK = 'D:\DB_Backup\MMS.BAK'
WITH 
    MOVE 'METERIAL_MANAGEMENT' TO 'D:\DATA\METERIAL_MANAGEMENT_2.mdf',
    MOVE 'METERIAL_MANAGEMENT_log' TO 'D:\DATA\METERIAL_MANAGEMENT_2_Log.ldf'

Best Answer

Your code is for Restoring a database not to create a backup file. you have to use the following code:

BACKUP DATABASE METERIAL_MANAGEMENT_2 
TO DISK = 'D:\DB_Backup\MMS.BAK'

Read more about Creating a full backup using T-SQL in the following TechNet article