Identify Used Space in Log File- Interview Question of the Week #090

Question: How to identify Used Space in Log File?

Answer: Use following command to display used log file size and total used space in the logfile.

DBCC SQLPERF('LOGSPACE')

After running above DBCC command it will give the following results.

Identify Used Space in Log File- Interview Question of the Week #090 logfilespace

You can see four different columns in the resultset.

The first column displays the name of the database. The second column contains the total size of the logfile in MB. The third column is actually our answer. It contains a total Log Space Used in the percentage. We can simple formula of (LogSize * Log Space Used) / 100 to find how much total space in used in MB. The fourth and final column is always zero and it has no meaning when we are running DBCC SQLPERF with parameter LOGSPACE.

If you are taking regular backup of the logfile, your file will not grow beyond certain value and it will also have free space. There should not be any need of shrinking the log file.

Here are few of the related blog posts:

Reference: Pinal Dave (https://blog.sqlauthority.com)

, , ,
Previous Post
How to Find Missing SQL Server Configuration Manager? – Interview Question of the Week #089
Next Post
SQL SERVER – How to Find Out When Your SQL Login Will Expire?

Related Posts

3 Comments. Leave new

  • Saran-SQL Developer
    September 26, 2016 12:38 pm

    Normal developer will not have the access to use DBCC so then how can an user can find the used log space of the Database

    Reply
  • Hello Mr. Pinal

    I’m having a question on how can I reduce the disk space used by sql databases. I have db which occupies 18443.74 MB currently.

    Reply

Leave a Reply

Menu