Step 1: Verify the logical file names with the following command:
RESTORE FILELISTONLY FROM DISK = 'E:\DBBackups\mydb.bak'
Step 2. Use the logical names that you get from the above query in the following query:
RESTORE DATABASE [mydb_new] FILE = N'<MDFLogicalName>' FROM DISK = N'E:\DBBackups\mydb.bak' WITH FILE = 1, NOUNLOAD, STATS = 10, MOVE N'<MDFLogicalname>' TO N'E:\DBBackups\mydb_new.mdf', MOVE N'<LDFLogicalName>' TO N'E:\DBBackups\mydb_new_0.ldf'
After executing the above commands with the correct values, you will see output similar to the following:
10 percent processed. 20 percent processed. 30 percent processed. 40 percent processed. 50 percent processed. 60 percent processed. 70 percent processed. 80 percent processed. 90 percent processed. 100 percent processed. Processed 7672 pages for database 'mydb_new', file '<MDFLogicalname>' on file 1. Processed 5 pages for database 'mydb_new', file '<LDFLogicalName>' on file 1. RESTORE DATABASE ... FILE=<name> successfully processed 7677 pages in 0.780 seconds (76.893 MB/sec). Completion time: 2019-10-20T11:35:31.8343787+05:30
source share