Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2008 还原数据库时出现问题-sql server_Sql Server 2008 - Fatal编程技术网

Sql server 2008 还原数据库时出现问题-sql server

Sql server 2008 还原数据库时出现问题-sql server,sql-server-2008,Sql Server 2008,我尝试使用SQLServer2008备份和恢复数据库,但出现错误 为了备份,我做了以下操作:将数据库MyDB备份到磁盘='d:\MyDB.BAK'(工作正常) 要还原,我执行了以下操作:使用主还原数据库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 BAC

我尝试使用SQLServer2008备份和恢复数据库,但出现错误

为了备份,我做了以下操作:
将数据库MyDB备份到磁盘='d:\MyDB.BAK'
(工作正常)

要还原,我执行了以下操作:
使用主还原数据库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.
我错在哪里?少了什么


提前感谢

如果您的MyDB数据库处于“完全”恢复模式,您需要完全按照消息所述操作,并对日志进行操作备份或替换

因此,将restore命令更改为

RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK' WITH REPLACE

如果您不需要处于“完整”恢复模式,请更改为“简单”并避免处理日志

如果您发布代码或XML,请在文本编辑器中突出显示这些行,然后单击编辑器工具栏上的“代码”按钮(101 010),以很好地格式化和语法突出显示它!谢谢您的帮助,但我得到了这个错误:Msg 3101,16级,状态1,第7行独占访问无法获得,因为数据库正在使用中。Msg 3013,级别16,状态1,第7行还原数据库异常终止。请尝试从主数据库运行该命令。并确保没有其他会议。使用活动监视器检查其他会话