top of page

Recovery model, log reuse wait, log file size, log usage Fsize and compatibility level for all DB

-- 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], db.is_auto_create_stats_on, db.is_auto_update_stats_on,

db.is_auto_update_stats_async_on, db.is_parameterization_forced,

db.snapshot_isolation_state_desc, db.is_read_committed_snapshot_on

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 N'Log File(s) Used Size (KB)%'

AND ls.counter_name LIKE N'Log File(s) Size (KB)%'

AND ls.cntr_value > 0 OPTION (RECOMPILE);


-- Things to look at:

-- How many databases are on the instance?

-- What recovery models are they using?

-- What is the log reuse wait description?

-- How full are the transaction logs ?

-- What compatibility level are they on?

-- What is the Page Verify Option?


5 views0 comments

Recent Posts

See All

SQL Server Profiler Trace

--Import multiple trace file in sql Table. --All the rollover files will be automatically imported --provide number tracefile to capture...

Comments


bottom of page