How to clear Syabse Transaction Logs

It is often the case that developers new to databases will try to perform large data modifications without batching. When this happens in most cases the modification will fail with the error of the transaction log being full after you are presented with the message The transaction log in the database is almost full. Your transaction is suspended until space is made available in the log. What is happening is that the update/insert modification is trying to change too many rows without committing so the transaction log is getting filled up and once it is full the modification fails and no changes get saved to the database.

To correct this it is good practice to perform your database modifications in batches, and upon each iteration of the batch to clear your log transaction file. The dump tran command notifies Sybase that you want to clear the transaction log of a database and with which options. In these cases you simply want to clear it without backing up the log to a file so you would use the with turncate_only option.

dump tran MY_TABLE with truncate_only


// T-SQL //

Comments & Questions

Add Your Comment