{"id":14,"date":"2008-09-17T15:48:16","date_gmt":"2008-09-17T19:48:16","guid":{"rendered":"http:\/\/dbtricks.com\/?p=14"},"modified":"2008-10-15T14:52:35","modified_gmt":"2008-10-15T18:52:35","slug":"what-to-do-when-ldf-files-grow","status":"publish","type":"post","link":"https:\/\/dbtricks.com\/?p=14","title":{"rendered":"What to do when ldf file grows"},"content":{"rendered":"<p>If you noticed that the free space on your hard drive is shrinking and you found that the log LDF file is taking most of it (and growing) don&#8217;t panic.<br \/>\nit is possible that the reason is that your recovery mode is is set to full.<br \/>\nto change this:<\/p>\n<p>1) Right click on the db (in SQL server Managment Studio) and click properties.<\/p>\n<p>2) Navigate to the option tab and make Make sure that the recovery model is set to simple.<\/p>\n<p><strong>If a full recovery mode is needed:<\/strong><\/p>\n<p><strong><\/strong> Issue regular backups (in the transaction log shipping tab)<br \/>\nand if Auto Shrink is enabled, the file will eventually shrink (though not immediatly)<\/p>\n<p><strong>If you need to shrink the file immediately:<\/strong><\/p>\n<p>\u2022\u00a0\u00a0\u00a0 Open MS SQL Server Management Studio, connect to Database Engine<\/p>\n<p>\u2022\u00a0\u00a0\u00a0 Select New Query and type:\u00a0 <strong>backup log &lt;db_name&gt; with truncate_only<\/strong><\/p>\n<p>(this is <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms144262.aspx\" target=\"_blank\">discontinued in SQL SERVER 2008<\/a> &#8211; Microsoft recommends using Simple mode instead)<br \/>\n\u2022\u00a0\u00a0\u00a0 Execute this query (press F5)<br \/>\n\u2022\u00a0\u00a0\u00a0 Right click on Database name and navigate to Tasks-&gt;Shrink -&gt;Files:<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you noticed that the free space on your hard drive is shrinking and you found that the log LDF file is taking most of it (and growing) don&#8217;t panic. it is possible that the reason is that your recovery mode is is set to full. to change this: 1) Right click on the db [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[10,4],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-sql-server","tag-ldf","tag-sqlserver"],"_links":{"self":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14"}],"version-history":[{"count":5,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":32,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions\/32"}],"wp:attachment":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}