SQL SERVER-日志增长原因定位

SQL SERVER-日志增长原因定位

以下脚本第一句是查询整个实例各数据库日志文件的使用情况,

第二句是查询各数据库的恢复模式和不能截断的原因

DBCC SQLPERF(LOGSPACE)

SELECT name,recovery_model_desc,log_reuse_wait,log_reuse_wait_desc
	FROM sys.databases

各原因的解释如下:

Reuse of transaction log space is currently waiting on one of the following as of the last checkpoint. For more detailed explanations of these values, see The Transaction Log.Value
0 = Nothing
1 = Checkpoint (When a database uses a recovery model and has a memory-optimized data filegroup, you should expect to see the log_reuse_wait column indicate checkpoint or xtp_checkpoint) 1
2 = Log Backup 1
3 = Active backup or restore 1
4 = Active transaction 1
5 = Database mirroring 1
6 = Replication 1
7 = Database snapshot creation 1
8 = Log scan
9 = An Always On Availability Groups secondary replica is applying transaction log records of this database to a corresponding secondary database. 2
9 = Other (Transient) 3
10 = For internal use only 2
11 = For internal use only 2
12 = For internal use only 2
13 = Oldest page 2
14 = Other 2
16 = XTP_CHECKPOINT (When a database uses a recovery model and has a memory-optimized data filegroup, you should expect to see the log_reuse_wait column indicate checkpoint or xtp_checkpoint) 4

1 Applies to: SQL Server (starting with SQL Server 2008)
2 Applies to: SQL Server (starting with SQL Server 2012 (11.x))
3 Applies to: SQL Server (up to, and including SQL Server 2008 R2)
4 Applies to: SQL Server (starting with SQL Server 2014 (12.x))

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值