Salı

How to shrink log file (ldf) on SQL Server 2005-2008

If you are using Full or Bulk logged recovery model, the log file sometimes grows huge and you have to shrink it once I saw a logfile that is 40 GB !

open SQL Server Management Studio and open a new query window, execute this chunk of t-sql code:


USE [Your_db]
GO DBCC SHRINKFILE(N'Your_db_log', 50)
BACKUP LOG Your_db WITH TRUNCATE_ONLY
DBCC SHRINKFILE(N'Your_db_log', 50)
GO

Hiç yorum yok:

Yorum Gönder