MS SQL SERVER看交易紀錄的T-SQL
如果想要看交易紀錄的成長 / 變化
除了蒐LOG以外 也可以透過以下語法監看
\See also :
http://snipplr.com/view/31966/
除了蒐LOG以外 也可以透過以下語法監看
- -- Recovery model, log reuse wait description, log file size, log usage size
- -- and compatibility level for all databases on instance
- SELECT db.[name] AS [DATABASE Name], db.recovery_model_desc AS [Recovery Model],
- db.log_reuse_wait_desc AS [Log Reuse Wait Description],
- ls.cntr_value AS [Log Size (KB)], lu.cntr_value AS [Log Used (KB)],
- CAST(CAST(lu.cntr_value AS FLOAT) / CAST(ls.cntr_value AS FLOAT)AS DECIMAL(18,2)) * 100 AS [Log Used %],
- db.[compatibility_level] AS [DB Compatibility Level], db.page_verify_option_desc AS [Page Verify OPTION]
- FROM sys.DATABASES AS db
- INNER JOIN sys.dm_os_performance_counters AS lu
- ON db.name = lu.instance_name
- INNER JOIN sys.dm_os_performance_counters AS ls
- ON db.name = ls.instance_name
- WHERE lu.counter_name LIKE 'Log File(s) Used Size (KB)%'
- AND ls.counter_name LIKE 'Log File(s) Size (KB)%';
\See also :
http://snipplr.com/view/31966/
留言