我尝试使用sql-server 2008备份和恢复数据库并出错。
备份我完成了这个:BACKUP DATABASE MyDB TO DISK='d:\MyDB.BAK'
(并且工作正常)
要恢复我这样做:USE MASTER RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK
并收到此错误:
Msg 3159, Level 16, State 1, Line 7
The tail of the log for the database "MyDB " has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log.
Msg 3013, Level 16, State 1, Line 7
RESTORE DATABASE is terminating abnormally.
我哪里错了?缺少什么?
提前谢谢
答案 0 :(得分:2)
如果您的MyDB数据库处于“完全”恢复模式,您需要完全按照消息的说明进行操作,然后对其进行备份或替换。
所以将恢复命令更改为
RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK' WITH REPLACE
如果您不需要处于“完全”恢复模式,请更改为“简单”并避免处理日志