-- 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+1 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)%' ;

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-12
  • 2021-12-08
  • 2021-08-07
  • 2021-08-15
猜你喜欢
  • 2021-11-15
  • 2021-10-10
  • 2021-05-28
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案