How do I increase the size of the transaction log? Is is also possible to temporarily increase the transaction log?
Let’s say I have the following scenario. I have a Delete operation that’s too big for the current transaction log. I wan’t to:
- Increase the transaction log (can I detect the current size?, can I tell how large I need the transaction log to be for my operation?)
- (Perform my operation)
- Backup the transaction log
- Restore the size of the transaction log.
Short answer:
Long answer: you can use
ALTER DATABASE ... MODIFY FILEto change the size of database files, including LOG files. You can look upmaster_files/sysfiles(2k) or<dbname>.sys.database_files(2k5/2k8) to get the logical name of the log. And you can useDBCC SHRINKFILEto shrink a file (if possible).It depends on a lot of factors (is this new data? is it an update? is it a delete? what recovery model? Do you have compression on SQL 2k8? etc etc) but is usually bigger than you expect. I would estimate 2.5 times the size of the update you are about to perform.
Update:
Missed you say is an DELETE. A rough estimate is 1.5 times the size of the data deleted (including all indexes).