Sunday, April 10, 2011

SQL: Shrinking a LDF file


USE DatabaseName
GO
DBCC SHRINKFILE(DatabaseName_Log, 1)
BACKUP LOG DatabaseName WITH TRUNCATE_ONLY
DBCC SHRINKFILE(DatabaseName_Log, 1)
 
Ex.
USE FMeasyKhadamatReports
GO
DBCC SHRINKFILE(TFM_Log, 1)
BACKUP LOG FMeasyKhadamatReports WITH TRUNCATE_ONLY
DBCC SHRINKFILE(TFM_Log, 1)


; TFM_Log is the logical name of the database log

No comments:

Post a Comment