{"id":1199,"date":"2014-06-03T10:48:52","date_gmt":"2014-06-03T15:48:52","guid":{"rendered":"http:\/\/it.thelibrarie.com\/weblog\/?p=1199"},"modified":"2014-06-03T10:48:52","modified_gmt":"2014-06-03T15:48:52","slug":"clear-mssql-log-files","status":"publish","type":"post","link":"https:\/\/it.thelibrarie.com\/weblog\/2014\/06\/clear-mssql-log-files\/","title":{"rendered":"Clear MSSQL Log Files"},"content":{"rendered":"<p>So first of all I&#8217;m not a SQL expert.  Secondly I don&#8217;t recommend performing this on a production system.  Third, this actually won&#8217;t happen on a production system as long as you&#8217;re performing backups &#8211; and your backup solution supports MSSQL &#8211; and I hope if it *is* a production system that you are actually backing it up.<\/p>\n<p><strong>Open the SQL Management Studio<\/strong><br \/>\n<strong>Connect using the windows authentication piece, OR your SA password<\/strong><\/p>\n<p><strong>Run the following in the query window<\/strong><br \/>\n<code>DBCC sqlperf(logspace)<\/code><\/p>\n<p>This will show you the name of the database and associated size of log files.<\/p>\n<p><strong>Assuming that the INSERTNAMEHERE database is the one eating through the space<\/strong><br \/>\n<code>USE INSERTNAMEHERE;<\/code><br \/>\n<code>GO<\/code><br \/>\n<code>ALTER DATABASE INSERTNAMEHERE<\/code><br \/>\n<code>SET RECOVERY SIMPLE;<\/code><br \/>\n<code>GO<\/code><br \/>\n<code>DBCC SHRINKFILE (INSERTNAMEHERE, 1);<\/code><br \/>\n<code>GO<\/code><br \/>\n<code>ALTER DATABASE INSERTNAMEHERE<\/code><br \/>\n<code>SET RECOVERY FULL;<\/code><br \/>\n<code>GO<\/code><\/p>\n<p><strong>You can then run the logspace again and verify<\/strong><br \/>\n<code>DBCC sqlperf(logspace)<\/code><\/p>\n<p>This all worked nicely on my development system that doesn&#8217;t require\/have backups in place.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So first of all I&#8217;m not a SQL expert. Secondly I don&#8217;t recommend performing this on a production system. Third, this actually won&#8217;t happen on a production system as long as you&#8217;re performing backups &#8211; and your backup solution supports MSSQL &#8211; and I hope if it *is* a production system that you are actually &hellip; <a href=\"https:\/\/it.thelibrarie.com\/weblog\/2014\/06\/clear-mssql-log-files\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Clear MSSQL Log Files<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1199","post","type-post","status-publish","format-standard","hentry","category-microsoft"],"_links":{"self":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/1199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/comments?post=1199"}],"version-history":[{"count":1,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/1199\/revisions"}],"predecessor-version":[{"id":1200,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/1199\/revisions\/1200"}],"wp:attachment":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/media?parent=1199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/categories?post=1199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/tags?post=1199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}