First post from my mobile

Today was a great day. I had moved my blog to godaddy hosting and installed new theme. Planning to start my blog journey again.this time I plan to write on technical and also what is happening around me. Need to write at least two post in a week.
Let’s hope for the best
Have a great week

Shrink LDF file in SQL SERVER 2008

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