I'm looking to create a monitoring tool to track changes in transaction log usage on a production server we maintain.
Previously, I used DBCC SQLPERF(LOGSPACE);, which provided a list of all databases and their current transaction log memory status. However, Microsoft seem to suggest from 2012, the log details should be viewed from sys.dm_db_log_space_usage, which provides similar detail, but seems to be database specific, rather than giving a view of the server overall (i.e. you must be connected to the database you wish to use).
I guess my question is two fold:
- Is there a way to use
sys.dm_db_log_space_usagefor all databases? - Are there any reason the
DBCC SQLPERF(LOGSPACE);should not be used?
Is there any reason the DBCC SQLPERF(LOGSPACE); should not be used?
Is there a way to use sys.dm_db_log_space_usage for all databases?
You can use the following cursor. Maybe it required a more development;