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:
Although there is no one optimal value for Transaction Log File initial size and auto-growth that fits all situations, but setting the initial size of the SQL Server Transaction Log file to 20-30% of the database data file size and the auto-growth to a large amount, above 1024MB, based on your database growth plan can ...
If you set the maximum file size to unlimited, the maximum size for the transaction log will be set to the limiting amount of 2 TB.
Large database transactions, such as importing large amounts of data, can lead to a large transaction log file. Transaction log backups not happening fast enough causes the SQL log file to become huge. SQL log files also enlarge due to incomplete replication or availability group synchronization.
Short answer:
Long answer: you can use ALTER DATABASE ... MODIFY FILE
to change the size of database files, including LOG files. You can look up master_files/sysfiles
(2k) or <dbname>.sys.database_files
(2k5/2k8) to get the logical name of the log. And you can use DBCC SHRINKFILE
to shrink a file (if possible).
can I tell how large I need the transaction log to be for my operation?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With