{"id":357,"date":"2011-11-19T07:47:26","date_gmt":"2011-11-19T05:47:26","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=357"},"modified":"2013-06-14T14:11:01","modified_gmt":"2013-06-14T12:11:01","slug":"how-to-empty-a-sql-server-database-transaction-log-file","status":"publish","type":"post","link":"https:\/\/www.extradrm.com\/?p=357","title":{"rendered":"How to empty a SQL Server database transaction log file"},"content":{"rendered":"<p>I have 1 GB databases that grow several GB log files.<\/p>\n<p>Well, probably the best practice includes backing them up.<\/p>\n<p>That was overkill for me, and sifting through all the documentation and forums (eventually) led me to this simple pair of statements that do the trick immediately :<\/p>\n<blockquote>\n<pre>backup log [dbname] with truncate_only\ngo\nDBCC SHRINKDATABASE ([dbname], 10, TRUNCATEONLY)\ngo<\/pre>\n<\/blockquote>\n<p>Warning : Clearing the transaction log with TRUNCATE_ONLY will break your backup chain needed for FULL recovery. A FULL database backup should be executes right after truncating the logs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have 1 GB databases that grow several GB log files. Well, probably the best practice includes backing them up. That was overkill for me, and sifting through all the documentation and forums (eventually)&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2845,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[28],"tags":[],"youtube_video":null,"_links":{"self":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/357"}],"collection":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357"}],"version-history":[{"count":0,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2845"}],"wp:attachment":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}