Find out the size of a SQL server's transaction log

Author: Christy White
Date Of Creation: 8 May 2021
Update Date: 25 June 2024
Anonim
SQL Server Log File is HUGE!
Video: SQL Server Log File is HUGE!

Content

This wikiHow teaches you how to find out the size of a database's transaction log, as well as how much of the total log space it uses on a Microsoft SQL Server.

To step

  1. Log in to SQL Server Management Studio. You can check the usage of the transaction log locally on the server or via a remote connection.
  2. Select the database in the Object Explorer. You can find this in the left panel.
  3. click on New query. It's in the toolbar at the top of the window.
  4. Find the size of the transaction log. To view the actual size of the log, as well as the maximum size it can occupy in the database, type this query and then click To carry out in the main menu:

      USE nameofdatabase; GO SELECT file_id, name, type_desc, physical_name, size, max_size FROM sys.database_files; GO>

  5. Find the amount of log space in use. To check how much log space is currently in use, enter this query and click To carry out in the main menu:

      USE nameofdatabase; GO SELECT (total_log_size_in_bytes - used_log_space_in_bytes) * 1.0 / 1024/1024 AS [free log space in MB] FROM sys.dm_db_log_space_usage;>