我試圖運行下面的查詢來恢復數據庫:SQL Server 2012中:麻煩恢復數據庫備份
restore database myDatabase
from disk=
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\Backup\myDatabase_backup_2012_06_20.bak'
with replace,
move 'myDatabase' to
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\DATA\myDatabase',
move 'Analytics_log' to
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\DATA\myDatabase_log.ldf'
而且正在以下錯誤:
Msg 5133, Level 16, State 1, Line 1 Directory lookup for the file
"C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\DATA\myDatabase_log.ldf" failed with the operating system error 2(The system cannot find the file specified.).Msg 3156, Level 16, State 3, Line 1 File 'myDatabase_log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\DATA\myDatabase_log.ldf'.
Use WITH MOVE to identify a valid location for the file.
對於第一個錯誤,似乎像SQL Server找不到.ldf文件。但是,它位於該位置,並且在.bak文件上運行restore filelistonly
時已列在結果中。
@Shenaniganz,你是對的!謝謝!如果你寫出你的評論作爲迴應,我會將其標記爲接受的答案。 – dmr