SQL Server tip

Just a quick tip for when developing with SQL Server.

When doing a lot of updates in SQL the transaction log might grow quite large clogging up the disk and slowing things down. An easy and quick way to cleanup is to use:

backup log <<Database name>> with truncate_only
dbcc shrinkdatabase ( <<Database name>> )

 Use the sp_databases stored procedure to see which database is getting big.


Warning: Keep in mind that the truncate_only option just dumps the transaction log so you do not want to do this on a production machine! But on a development machine where a database is just a test item it is a quick way to retrieve some disk space.


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>