20 Nov 2009

Shrink SQL 2000 log file



BACKUP LOG MyDatabaseName WITH TRUNCATE_ONLY


DBCC SHRINKFILE(MyDatabaseName_log, FileSize)

(where MyDatabaseName_log is the logical file name, and is the target size in MB)

The log file has now been shrunk.

Note that the log file will start expanding in normal operation, depending on the way the database is defined. Make sure that the transaction log file is big enough to store all transactions for the normal period between backups. Makes sure that you take peak system loads into consideration when determining the target size.
 

Regular log file maintenance
In normal operation, you would normally never shrink the log file. Regularly backing up the log file will remove the data used in it, and maintain free space for new transaction.

Total Pageviews