backup database Clinical_Data_Extension to disk='c:\Clinical_Data_Extension_full.bak'
restore filelistonly from disk='c:\Clinical_Data_Extension_full.bak'
restore database Clinical_Data from disk='c:\Clinical_Data_Extension_full.bak'
with move 'Clinical_Data_Extension' to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Clinical_Data.mdf',
move 'Clinical_Data_Extension_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Clinical_Data.ldf',
REPLACE
错误:
Msg 3234, Level 16, State 2, Line 3
Logical file 'Clinical_Data_Extension' is not part of database 'Clinical_Data'. Use RESTORE FILELISTONLY to list the logical file names.
Msg 3013, Level 16, State 1, Line 3
RESTORE DATABASE is terminating abnormally.
然而由于某种原因,以下相同的代码可以正常工作:
backup database Clinical_Data to disk='c:\Clinical_Data_full.bak'
restore filelistonly from disk='c:\Clinical_Data_full.bak'
restore database Clinical_Data_Extension from disk='c:\Clinical_Data_full.bak'
with move 'Clinical_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Clinical_Data_Extension.mdf',
move 'Clinical_Data_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Clinical_Data_Extension.ldf',
REPLACE
基本上,我正在做的是创建数据库“Clinical_Data_Extension”并对其进行处理。完成后,我有一个用于删除“Clinical_Data”的脚本,然后我使用我首先提到的脚本使用“Clinical_Data_Extension”中的数据恢复“Clinical_Data”,基本上覆盖“Clinical_Data”。但是由于某种原因,第一个脚本给了我一个错误,而第二个脚本还没有完全相同。你认为为什么会发生这种情况?