Contents
How do I shrink a log file in SQL Server 2008 r2?
Shrink The Database
- Open up Sql Management Studio.
- Right click the database, Tasks > Shrink > Files.
- Under File Type, choose the the log file. Be sure to mark option Release unused space as the shrink action, click OK.
How do you shrink a log?
To shrink the log in SSMS, right click the database, choose Tasks, Shrink, Files:
- On the Shrink File window, change the File Type to Log.
- Shrink the log using TSQL.
- DBCC SHRINKFILE (AdventureWorks2012_log, 1)
What is shrink log file in SQL Server?
This topic describes how to shrink a data or log file in SQL Server by using SQL Server Management Studio or Transact-SQL. Shrinking data files recovers space by moving pages of data from the end of the file to unoccupied space closer to the front of the file.
How to shrink the transaction log in SQL Server?
Shrink the log in SQL Server Management Studio. To shrink the log in SSMS, right click the database, choose Tasks, Shrink, Files: On the Shrink File window, change the File Type to Log.
How to reduce the size of a SQL log file?
Log File Auto Shrink Event Class. sys.database_files (Transact-SQL) (See the size, max_size, and growth columns for the log file or files.) You can gain space by enlarging the existing log file (if disk space permits) or by adding a log file to the database, typically on a different disk.
When to take a SQL Server transaction log backup?
The SQL Server Transaction Log backup can be taken only from the database when the recovery model of that database is Full or Bulk-Logged. The recovery model of the database can be checked form the Options tab of the Database Properties window, as below:
When to truncate SQL Server transaction log file?
If no Transaction Log backup is taken from the database, the Transaction Log file will grow continuously, without truncation, until it runs out of free space. The SQL Server Transaction Log backup can be taken only from the database when the recovery model of that database is Full or Bulk-Logged.