如何更改log_reuse_wait和log_reuse_wait_desc [英] how to change log_reuse_wait and log_reuse_wait_desc
问题描述
我已经创建了新的数据库并且日志文件已经过去很久了,并且由于错误消息由于备份导致日志已满。
I have been created new database and the log file groth very past, and I get error mesaage that the log is full due to 'BACKUP'.
该数据库与SERVER中其他数据库之间的差异,我发现在所有数据库中log_reuse_wait为0且log_reuse_wait_desc为NOTHING,而在我的数据库中log_reuse_wait为0且log_reuse_wait_desc为LOG_BACKUP。
I looked in the differences between this Database and other databases in the SERVER, and I seen that in all databases log_reuse_wait is 0 and log_reuse_wait_desc is NOTHING and in my database log_reuse_wait is 0 and log_reuse_wait_desc is LOG_BACKUP.
我想将数据库中的此属性更改为0而不是。
我该怎么做?
I want to change this property in my database to 0 and NOTHING. How can I do that?
推荐答案
我找到了解决方案。
即使数据库处于 SIMPLE
模式下,也要等待 BACKUP_LOG
,因此您需要更改恢复模式到 Full
,然后返回 SIMPLE
,且不用等待
i found the solution.
even the database is in SIMPLE
mode is wait to BACKUP_LOG
, so you need to change the recovery mode to FULL
and then back to SIMPLE
with no wait
USE [master]
GO
ALTER DATABASE <db name> SET RECOVERY full
GO
ALTER DATABASE <db name> SET RECOVERY SIMPLE WITH NO_WAIT;
GO
USE [db name]
GO
DBCC SHRINKFILE('<log file name>', 0, TRUNCATEONLY)
这篇关于如何更改log_reuse_wait和log_reuse_wait_desc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!