Search This Blog

Friday, July 25, 2008

Finding total / available / used space by transactional log file

DBCC SQLPERF(LOGSPACE)

It provides statistics that how much transactional log space was used by each database in the current server. So, you can monitor the amount of space used and can decide when to take backup or to truncate the transactional log file.

Its result set consists of:

Database Name – Name of the database
Log Size (MB) – Actual amount of log file size, it is less than initial value specified in database properties, because Database Engine reseves small amount of disk space for internal header information.
Log Space Used (%) – Percentage of total space that is occupied by transactional log.
Status – that is always 0

Example:

DBCC SQLPERF(LOGSPACE)

Database Name Log Size (MB) Log Space Used (%) Status
master 0.7421875 43.68421 0
tempdb 0.7421875 64.73684 0
model 0.4921875 76.19048 0
msdb 0.9921875 61.02362 0

No comments: