SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Backup and Restore Strategies in SQL Server : A Brief Introduction

Establishment of a successful business requires the proper maintenance of the data. SQL Server is one the popular platform for the same. In SQL Server, a proper strategy has been introduced for the management of data. The Main reason of introducing SQL Server backups and restore strategies in SQL Server is to enable the users to regain the database, which is corrupted. However, restoring and backing up of data must be done in particular environment and must work with the resources that are available. This is the reason users need a reliable strategy to backup and restore the database in SQL Server.

Need of Backup and Restore Strategies in SQL Server

An appropriate backup and restore strategy lessen the chances of data loss. No matter, how cautiously we access the data; there is always a possibility of data failure. There are various reasons behind it. Therefore, we require a proper strategy to backup and recover the data.

Possible Reasons for the Failure

These are some of the reasons for the failures:
Hardware failure
The failure of a controller on the disk, hard drive, etc. belongs to this category. However, the chances of hardware failure are less due to latest technologies and failover capabilities.
Software failure
Failure of an operating system, main memory of a computer system, CPU, etc. are all included in software failure. Failure of system or software occurs due to power failure, memory error, or any different reason.
Application failure
This failure occurs due to some bugs in application. These bugs modify when some bugs in an application inserted and modifies the data this kind of failure occurs.
User failure
One of the reasons for this error is when a user want to delete a specific row, but type DELETE without putting in WHERE clause. Then, this failure may occur. Moreover, this type of failure is very much similar to application failure.

Types of Backup Strategies In SQL Server

There are various types of backup, so users can choose any of the type according to their need.
Full Backup
This type takes the copy of the entire database, which includes the transaction log files. With this, full database can be recovered once the full database backup is restored. This backup can be taken on the network disk or on local tape drive or Windows Azure blob.
This is the easiest backup types of backup types and quite often required prior to the other types of backup. As mentioned earlier, full database can backup the whole data and you can restore the complete database in one-step.
Differential Backup
Differential database backup includes extents only, which were changed since the last full database backup. This type is very fast as compared to the full database backup. DCM, Differential Changed Map, is a bitmap page, which has a bit for every extent and tracks the extents that have changed since the last full database backup. In differential backup, SQL Server checks all the extents who has the bit value 1 and hence the length of time is proportional to the number of extents changed (value set to 1)
The last full database backup is compulsory to have a complete database backup at least once so that it can be started with differential database backups. The backup, upon which the differential backup is based, is known as the base of the differential backup. The size of differential backup is directly proportional to the time between differential database backup and its base. Sometimes it can be equal to base as well. This suggests that a huge differential database backup has no advantage of a quick and smaller backup time if the time between a differential database backup and its base increase in a longer way. Therefore, it is suggested to take a full database backup at some intervals for the establishment of a new differential base.
Transaction Log Backup
It is supported only with either Bulk-logged recovery model or full recovery model. In addition, it is necessary to take a full database backup as its base. Transaction log backup takes the entire transaction log records, which are written after the last transaction log backup or the last full database backup.
Note: Transaction log does not get truncated, even after checkpoint operation, for committed transactions unless you take the transaction log backup.
Transaction log backup determines all the changes with each repetition. Whereas, differential backup only defines the last changed values when a row was changed continually.

Impact of the Recovery Model on Backup and Restore

Backup and restore operations happen within the context of a recovery model. It is the property of the database, which controls management of transaction log. Moreover, recovery model of a database ascertain the types of backups and restoration scenarios that are supported for the database. Generally, a database uses either the simple or full recovery model.
The choice of the recovery model depends on the requirements of the business.
  • Use simple recovery model when you want to simplify backup and restore and to avoid transaction log management
  • Use full recovery model to minimize the work-loss exposure
We have understood that maintenance of data is essential to keep the data safe and secure. Therefore, in the above article, we have discussed the Backup and Restore Strategies in SQL Server. We have also learned the impact of a recovery model on the backup and restoration of SQL data.

Ganapathi's MSSQLLover

Ganapathi Varma is an MCP Lead Database Administrator and Blogger. He works as Lead SQL Server DBA for CtrlS Datacenters pvt ltd, Asia's only Tier 4 datacenter. He is responsible for managing thousands of SQL instances providing database managed services, High Availability and Disaster Recovery. Other than SQL Server, he is also expertised in different datacenter technologies. He is the owner of MSSQLLover blog and he is fully dedicated to the SQL Server community. You can also visit the mssqllover fb page for more SQL blogs and follow FB group: SQLHyderabad.


Leave a comment on the original post [mssqllover.blogspot.com, opens in a new window]

Loading comments...