{"id":599,"date":"2014-01-07T10:42:00","date_gmt":"2014-01-07T10:42:00","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=599"},"modified":"2022-11-05T10:53:19","modified_gmt":"2022-11-05T10:53:19","slug":"shrink-microsoft-sql-database-transaction-logs","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=599","title":{"rendered":"Shrink Microsoft SQL Database Transaction Logs"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>PROBLEM:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your SQL transaction log has grown to be really big, this might be because a load of data was added, or your backup procedures were failing to truncate the logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>SOLUTION:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Take a backup of the database, then open the SSMS and then run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE DATABASENAME\n\nGO\n\nALTER DATABASE DATABASENAME SET RECOVERY SIMPLE WITH NO_WAIT\n\nDBCC SHRINKFILE(DATABASENAME_log, 1024)\n\nALTER DATABASE DATABASENAME SET RECOVERY FULL WITH NO_WAIT\n\nGO<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now take a full backup of the database to ensure you have a recoverable version.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PROBLEM: Your SQL transaction log has grown to be really big, this might be because a load of data was added, or your backup procedures were failing to truncate the logs. SOLUTION: Take a backup of the database, then open the SSMS and then run this command: Now take a full backup of the database &#8230; <a title=\"Shrink Microsoft SQL Database Transaction Logs\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=599\" aria-label=\"Read more about Shrink Microsoft SQL Database Transaction Logs\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,13],"tags":[],"class_list":["post-599","post","type-post","status-publish","format-standard","hentry","category-databases","category-microsoft-sql"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=599"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/599\/revisions"}],"predecessor-version":[{"id":1470,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/599\/revisions\/1470"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}