SQL server

Log file usage.

It is time for some housekeeping and you log into your DB server. The data and log files are all over the server in different drives. It would be nice if you could find one big log file and reduce its size and call it a day. Luckily there is a DBCC command that you can use to see the log files size that can be reduced.

The command is DBCC SQLPERF (logspace). The data returned will be the DB name, the current log size, and the percentage of the log file that is used by the active portion of the log. Find the one you would like to reduce, and then work your magic. Remember, shrinking the log files is not be the best way reduce the log file size. Check here to see the MS link that shows the other arguments to this command.

If you want to find the location of your log file, use sp_helpserver db_name to find the path to your log files.

Advertisements
Standard

Thinking about someting? 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