How to shrink LOG files in Microsoft SQL Server 2005 and 2008

by Vitaly Zayko 10. April 2009 15:26

You know that LOG files of actively used SQL Server databases could become huge, even bigger than data (MDF) file.
In SQL2005 you can use this script to shrink LOG file size:

USE <database name>
BACKUP LOG <database name> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<log file name>, <preferred size>)

But this is no longer working in SQL2008. So do this:

USE <database name>
ALTER DATABASE <database name> SET RECOVERY SIMPLE
DBCC SHRINKFILE(<log file name>, <preferred size>)
ALTER DATABASE <database name> SET RECOVERY FULL

Good luck!

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

SQL

Where do you want to connect today?

by Vitaly Zayko 24. October 2008 10:20
If you are developing database driven Applications, then you definitely need to add this resource to your Internet Favorites: http://www.connectionstrings.com
This is the most complete resource I ever seen that contains connection strings to probably any database system around.
Great job! Thank you, guys!
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

General

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

About the author

Vitaly Zayko

Senior Software Developer / Team Lead / Product Manager

Moscow, Russia