X
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
This article has been viewed 84,813 times.
Learn more...
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’s using, on a Microsoft SQL Server.
Steps
-
1Log into the SQL Server Management Studio. You can check the transaction log usage locally on the server or when connected remotely.
-
2Select the database in the Object Explorer. It’s in the left panel.Advertisement
-
3Click New Query. It’s in the toolbar at the top of the window.
-
4Find the size of the transaction log. To view the actual size of the log, as well as the maximum size it can take up in the database, type this query and then click Execute in the toolbar: [1]
<USE nameofdatabase; GO SELECT file_id, name, type_desc, physical_name, size, max_size FROM sys.database_files ; GO>
-
5Find the amount of log space in use. To check how much log space is currently in use, type this query and then click Execute in the toolbar: [2]
<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;>
Advertisement
References
- ↑ https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-log-space-usage-transact-sql?view=sql-server-2017
- ↑ https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-log-space-usage-transact-sql?view=sql-server-2017
About This Article
Advertisement