RESTORE filelistonly from DISK = ' E:\bbs8.1\Dvbbs8.1.0_SQL\Data\sq_ebendegfzds_bkp_1.bak '
Go
The above text lists the logical name (LogicalName) of the. bak file that you want to restore. The logical names of the. mdf and. LDF in this example are "Sq_ebende_data" and "Sq_ebende_log", respectively, with logical names to restore the database
The statement is:
Restore Database name
From disk= ' backup file path '
With
Move '. mdf file logical filename '
To '. MDF path to restore to '
The logical file name of the move '. log file '
To '. Log path to return to '
Go
Here is an example:
Where the red part is the logical file name, if it is not correct, the following error will occur
Server: Msg 3234, Level 16, State 2, line 2
The logical file ' Sq_ebende ' is not part of the database ' Sq_ebende '. Please use RESTORE filelistonly to list the logical file names.
Restore Database Sq_ebende
From disk= ' E:\Data\sq_ebendeg_bkp_1.bak '
With Replace,move ' Sq_ebende_data '
To ' E:\Data\sq_ebende.mdf ',
Move ' Sq_ebende_log '
To ' E:\\data\sq_ebende.ldf '
Go
Because, the backup file name is ' Sq_ebende_bkp_1.bak ' easy to think that the logical file name is Sq_ebende, in fact, it is not necessarily, it is best to use the restore FILELISTONLY from DISK to view.
Summary of recovering database problems with Bak file