IdleTymes Blog

Personal Diary, Musing and rubish of a F*!^%#g bored programmer.

We all know that feeling, your wife left you, your car has broken down and your transaction logs are making your database look a little frumpy. Well here is the answer to all your problems (apart from the first two).

STEP ONE: Make sure you are logged into query analyer and logged into the correct database.

STEP TWO: Truncate the logs is the first statement you need to run agaisnt the database. This command flags all the completed transactions.

BACKUP LOG {database name} WITH TRUNCATE_ONLY

STEP THREE: The second statement clears out all the tranasaction that you just flagged.

DBCC SHRINKFILE ( {log file name},2 )

BUG FIX: The {log file name} is the name that appear in the Name field in the table sysfiles, which is not necessairly the same as the file name.

Example:

BACKUP LOG eshot WITH TRUNCATE_ONLY

DBCC SHRINKFILE (eshot_log,2)

TAA DAA , Ed


Comments are closed.