Log File Shrink
Log File Shrink
If you are trying to shrink Log File and its not shrinking then use below method to shrink :-
Soln: - Active VLFs will have a status of 2, and the log can only be shrunk if inactive VLFs are available
(status 0).
5. Then take 2-3 log Backup (.trn) and then try to shrink. After that I was able to shrink.
Used by me in BIRLASOFT Project :- In Birlasoft, we use to have multiple log files for a database, so we
use below method :-
Use dbname;
Go
Alter database dbname set recovery simple;
Go
DBCC SHRINKFILE (LOGFILE name, 1,truncateonly) ;
Go
Alter Database dbname set recovery full;
Go
Example:---
1. First run sp_helpfile against Database for which you need to shrink logfile.
Here we have to run for “tempdb”.
You have to change db name and logfile name and then run the query.
logfile name = name (see ina bove image)
Ex:- If we have to run query for “tempdev2 (logfile name)” query will be as :-
Use tempdb;
Go
Go
Go
Go