Sometimes when you try to restore a database backup in a new database then you will get below error:-
we can resolve this above error through below Steps
- first of allĀ you should find the DataFileLogicalName for .mdf & .ldf from backup file through below script:-
restore filelistonly from disk= N'C:\VAMS_DB_Backup\AdventureWorks_full'
you will get logical name of databaseĀ like below:-
- Now you can restore the database from backup through below script
RESTORE DATABASE ABCDEMO FROM DISK = N'C:\VAMS_DB_Backup\AdventureWorks_full' WITH MOVE 'AdventureWorks2012' TO 'D:\Data\ABCDEMO.mdf', MOVE 'AdventureWorks2012_log' TO 'E:\Log\ABCDEMO.ldf'
Now database has been restored successfully without any error
Hope it will help!!!