Reposting it again 🙂

 

Today i had a problem.  when i checked my database LDF file (log) file it’s some where around 25GB. I was trying to shrink the file it’s not possible. Could not able to shrink it from management studio. Found an workaround for that, Here the command for it.

First make the database to SIMPLE Recovery mode and do it.

– Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [databasename]
SET RECOVERY SIMPLE;
GO
– Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ([log file name], 1);
GO
– Reset the database
ALTER DATABASE [databasename]
SET RECOVERY FULL;
GO

Let me know if any questions

Elam