SQL SERVER运维命令
不定时更新
0. 库相关
0.1 查询数据库版本
select @@version;
1. 表查询相关
1.1 查询CDC相关表数据行数
select * from (
SELECT OBJECT_NAME(ii.id) TableName ,rows
FROM sysindexes ii
INNER JOIN sysobjects oo
ON ( oo.id = ii.id
AND oo.xtype = 'U ')
WHERE ii.indid < 2 ) a
where TableName LIKE 'dbo_%_CT'
ORDER BY rows desc ;
2. 日志相关
2.1 查询日志使用率
DBCC SQLPERF(LOGSPACE)
2.2 查询日志等待状态
SELECT NAME,DATABASE_ID, LOG_Reuse_Wait, Log_Reuse_Wait_Desc
FROM Sys.DATABASES
WHERE Name = 'dbname'
本文来自博客园,作者:沧浪浊兮,转载请注明原文链接:https://www.cnblogs.com/shixiu/p/15397746.html