T-SQL – Monitor All Database Logs

T-SQL – Monitor All Database Logs

One of the critical DBA’s job is to monitor the logs of the databases. The logs are almost as important as the data itself. They allow you to recover and/or roll back to known, stable states.

You can look at the file size through Windows Explorer.

You can see some log info through the SQL Management Studio > Database > right click Properties > Files


You can see the log size and more important the percentage used with TSQL. Using this script you can monitor all the database logs.

DBCC SQLPERF(LOGSPACEWITH no_infomsgs;

go

Note:

To expand or change the logs parameters in SQL Server Management Studio:

  • Select the database, right-click > Properties
  • Select Files
  • Specify how the file should grow by clicking (…) in the Autogrowth column.
  • Select the Enable Autogrowth check box.
  • Specify the growth by fixed increments in Mb. or
  • Specify the growth by fixed increments in %.
  • Specify the maximum file size limit
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s