{"id":129,"date":"2020-07-23T00:30:41","date_gmt":"2020-07-23T05:30:41","guid":{"rendered":"https:\/\/www.sqlbackupmaster.com\/wordpress\/?p=129"},"modified":"2020-07-23T00:50:02","modified_gmt":"2020-07-23T05:50:02","slug":"sql-server-recovery-models-log-truncation","status":"publish","type":"post","link":"https:\/\/www.sqlbackupmaster.com\/wordpress\/2020\/07\/23\/sql-server-recovery-models-log-truncation\/","title":{"rendered":"SQL Server Recovery Models &#038; Log Truncation"},"content":{"rendered":"\n<p>We get a fair number of questions from SQL Backup Master users about transaction log files, often accompanied by concerns regarding truncation and\/or shrinking of log files.<\/p>\n\n\n\n<p>We&#8217;ll start with the summary. It isn&#8217;t necessary to manually <em>truncate<\/em> SQL Server transaction log files. However, there may be an occasional need to manually <em>shrink<\/em> them.<\/p>\n\n\n\n<p>We&#8217;ll talk about log truncation first. Truncation is a process that frees up space in the log file for reuse. It will occur automatically at regular checkpoints if your SQL Server database is using the <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/backup-restore\/recovery-models-sql-server?view=sql-server-ver15\" target=\"_blank\">simple recovery model<\/a>. If the database uses the <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/backup-restore\/recovery-models-sql-server?view=sql-server-ver15\" target=\"_blank\">full or bulk-logged recovery model<\/a>, truncation occurs automatically after each log backup.<\/p>\n\n\n\n<p>Which recovery model your database <em>should<\/em> use depends on whether your recovery plan includes a requirement for point-in-time recovery. If not, then use the <strong>simple<\/strong> recovery model. Otherwise, SQL Server needs to use the <strong>full or bulk-logged<\/strong> recovery model and transaction log backups become a <em>requirement<\/em> (otherwise they will not truncate and will continually grow the log file).<\/p>\n\n\n\n<div class=\"is-layout-flow wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<p><span class=\"has-inline-color has-vivid-cyan-blue-color\"><em><strong>Note<\/strong>: The default recovery model for SQL Server depends on the product edition. SQL Server Express defaults the recovery model to SIMPLE, <\/em>\n<em>while most other editions default to FULL.<\/em><\/span><\/p>\n<\/div><\/div>\n\n\n\n<p>Which brings me to the final topic of this blog &#8211; <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/databases\/shrink-a-file?view=sql-server-ver15\" target=\"_blank\">log file shrinkage<\/a>. This should be an uncommon operation that is performed manually (usually as part of a database migration, bulk import, etc.), and not part of any maintenance or scheduled backup operation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We get a fair number of questions from SQL Backup Master users about transaction log files, often accompanied by concerns regarding truncation and\/or shrinking of log files. We&#8217;ll start with the summary. It isn&#8217;t necessary to manually truncate SQL Server transaction log files. However, there may be an occasional need to manually shrink them. We&#8217;ll [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/posts\/129"}],"collection":[{"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":5,"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":135,"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/posts\/129\/revisions\/135"}],"wp:attachment":[{"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/categories?post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlbackupmaster.com\/wordpress\/wp-json\/wp\/v2\/tags?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}