DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How to Restore a Transaction Log Backup in SQL Server
  • Resolving Log Corruption Detected During Database Backup in SQL Server
  • How to Restore Database Backup With T-SQL
  • How to Attach SQL Database Without a Transaction Log File

Trending

  • Beyond ChatGPT, AI Reasoning 2.0: Engineering AI Models With Human-Like Reasoning
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  • Create Your Own AI-Powered Virtual Tutor: An Easy Tutorial
  • How the Go Runtime Preempts Goroutines for Efficient Concurrency
  1. DZone
  2. Data Engineering
  3. Databases
  4. SQL Recovery Model: Simple vs. Full

SQL Recovery Model: Simple vs. Full

SQL Server provides different modes to set the database, like Simple, Full and Bulk-logged. In this article we will show the differences between them.

By 
Daniel Calbimonte user avatar
Daniel Calbimonte
·
May. 19, 20 · Presentation
Likes (3)
Comment
Save
Tweet
Share
42.8K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

There are three recovery models of SQL Server, and you may select the SQL Server recovery model to manage log files and make for the SQL recovery in case of disaster. This document is related to three SQL Server recovery models: simple, full, and bulk-logged. All of them are used to back up your SQL Server database.

SQL Server backup and reinstate operations happen within the framework of the recovery model of the database. SQL Server database comprises at least an MDF data file and a ldf log file. Mdf file holds all the database objects and data, such as the table, stored procedure, and user information. Recovery models are planned to control transaction log maintenance. A recovery model is a database property that controls how transactions are logged, whether the transaction log requires (and permits) backing up, and what kinds of reinstating operations are available. These recovery models are simple, full, and bulk-logged. Usually, a database uses the full recovery model or simple recovery model. A database can be transferred to another recovery model at any time.

Summary

Simple

The Simple recovery model is the simplest among the existing models. It mechanically retrieves log space to keep space requirements small, basically eliminating the need to manage the transaction log space. For data about database backups under the simple recovery model. It is supported by full, differential, and file-level backups. Transaction log backups are not maintained. The log space is reclaimed whenever the SQL Server background process checkpoint operation happens. The inactive portion of the log file is detached and is made available for reuse.

Point-in-time and page restore are not reinforced, only the restoration of the secondary read-only file is maintained.

Some of the reasons to select the simple database recovery model include:

  • It is most suitable for development and Test Databases
  • Simple reporting or application database, where data loss is tolerable
  • The point-of-failure recovery is exclusively for full and distinction backups
  • No administrative overhead

It supports:

  1. Full backup
  2. Differential backup
  3. Copy-Only backup
  4. File backup
  5. Partial backup

Advantage: It allows high-performance bulk copy operations, and regains log space to keep space requests small.

Disadvantage: It changes since the most recent database or discrepancy backup must be rebuilt.

Simple method

Full

With the full recovery model, SQL Server reserves the transaction log until you back it up. In this recovery model, all the dealings (DDL (Data Definition Language) + DML (Data Manipulation Language)) are fully recorded in the transaction log file. The log order is unbroken and is preserved for the databases to restore operations. Unlike the Simple recovery model, the transaction log file is not auto-truncated during CHECKPOINT operations.

You get the most flexibility restoring databases using the full recovery model when a database failure occurs All reinstate operations are supported, including point-in-time restore, page restore, and file restore.

Reasons to select the full database recovery model:

  • To support mission-critical applications
  • Design High Availability keys
  • To facilitate the recovery of all the data with zero or nominal data loss
  • If the database designed to have multiple filegroups, and you want to perform a piecemeal restore of reading/write secondary filegroups and, optionally, read-only filegroups
  • Allow random point-in-time restoration
  • Restore individual sheets
  • Sustain high administration overhead

It supports:

  1. Full backup
  2. Differential backup
  3. Transaction log backup
  4. Copy-Only backup
  5. File and/or file-group backup
  6. Partial backup

Advantage: No work is misplaced due to a lost or damaged data file. It can recuperate to a random point in time.

Disadvantage: If the log is damaged, changes since the most recent log backup must be rebuilt.

If the database is a development or a test server, the simple recovery model should mostly be adequate. However, if a database is a production one, it is normally recommended to go with a full recovery model. The full recovery model can be complemented by a bulk-logged recovery model. Of course, if your database is small, or is part of a data warehouse, or even if the database is read-only.

Bulk-Logged

This recovery model is ideal when you try to import massive data and do not want to increase the log with data.

If you had the full recovery model, importing massive data will increase the log file.

It is recommended to change the recovery mode during these scenarios:

  • BCP operations
  • When using INSERT with SELECT
  • INSERT INTO clauses
  • When using the WRITE, WRITETEXT, UPDATETEXT

When this option is set, the INDEX creation is minimally logged.

Conclusion

The choice of recovery model is mostly a business choice. The decision is based on what data the database holds, what amount of data loss is acceptable. If your group is already managing Full recovery mode databases, then keeping the Full recovery model selected is wise, However, if replies to the question "How do we manage disaster recovery for our SQL databases?" draws blank stares, giggles, or un-replied email, it is better to set up the database for the Simple recovery model, and make ensure that some regular "full backup" is completed, and the resultant backup file kept anywhere safe, the simple model may not be appropriate. At the same time, it is not feasible to use the full recovery model for every case, for obvious reasons of cost and complexity.

Database sql Data file Transaction log Backup

Opinions expressed by DZone contributors are their own.

Related

  • How to Restore a Transaction Log Backup in SQL Server
  • Resolving Log Corruption Detected During Database Backup in SQL Server
  • How to Restore Database Backup With T-SQL
  • How to Attach SQL Database Without a Transaction Log File

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!