SQL Server Database Snapshot vs Backup: When to Choose What?

The SQL Server Database backup is not more than a copy of the database, which is created as a kind of insurance policy in the situation when the original goes away. However, a database snapshot is not a backup as most of the users think, but, it is used to create a “copy” of the database and then a user can restore from that copy when required. As most of the users are not clear about the two and their difference. Therefore, let us differentiate between the snapshot and backup from SQL Server database point of view to have a proper understanding and choose right one at right time.

What is SQL Server Database Snapshot?

In SQL Server 2005 snapshot backups were introduced, which is available in the Enterprise versions of SQL Server also. It can also be said that it is a live backup. Whenever a user creates a snapshot it generates a read-only copy of the database. However, it is created by maintaining the copies of the database pages that are modified, but modified pages only. Or a user can say that it is copied to the snapshot before a page gets modified. Due this snapshot look like a backup containing a constant copy of the database. It is used as an alternative to backup in most of the situations.

It is always suggested that a user can use it when there is a requirement of short-term backup of the SQL Server database. Let us consider an example, a user can take a snapshot of a production upgrade so that it becomes easy to rollback any changes made during database modification. It is because snapshot allows users to revert the database back to the state at which the snapshot was taken. In addition, taking a snapshot is basically faster than backing up a SQL Server database and restoring the snapshot.

What is SQL Server Database Backup?

A SQL Server database backup is used to create the copy of the database, which is used to restore the data back whenever required. The backup files are the specific type of copy, that knows the transactional nature of SQL Server very well. This copy will be created in situations where transactions are ‘in process,’ and not completed yet. However, copying the files simply will not handle the transactions and may result in serious data corruption. Therefore in most of the situations, it always suggested to use the domestic backup processes or, third party tools that work directly with the domestic processes, for example, Red Gate SQL Backup is used.

Difference Between Snapshot & Backups Database in SQL Server

Snapshot-based backup systems can easily change if anyone starts using it’s as a primary method for backing up and restoring critical data. Therefore, it is really important to clear understand the difference between snapshot and backup in SQL Server.

Snapshot is a free feature that is used to manually create duplicate images of the servers. One can easily create them at any time. On the other side, Backup is a paid service. One can use this service, it automatically backed up most recent data every night.

The major difference between snapshot and backup in SQL Server is the time taken by the both to backup and restore data. However, backups are quite slow when compared snapshots while taking backup and restoring the database. Snapshot is really fast and there is no change in data.

The backup software in a traditional backup system has the ability to restore multiple points in time. It is the most critical function of a backup system because the data corruption and other factors sometimes lead to restore the system to a point in time other than the most recent backup. However, in a snapshot-based backup system, the snapshots offer this functionality. Multiple snapshots, which are created at different times are used to represent the multiple virtual views of the file system because they existed at different points in time.

If the snapshot is not replicated to another storage system it is not a backup. It is because the snapshot is not an actual copy of data, it is a virtual copy of the data. However, if something wrong happens to the storage where snapshot resides, then it will be of no use. On the other hand, it is not the case with database backups.

How to Decide B/w Snapshot or Backup

Situations when a user can take Backup:

When a user needs a Point in Time recovery option

When a user needs to Restore week/Month/Year old backup

During SQL Server upgrades, etc.

When there is a possibility of disk corruption or Server/SAN Disk migrations

Situations when a user can use Snapshot:

Whenever there is chance of data damage or during an application deployment.

Before executing a complex script to change data.

While taking a demo.

Conclusion

After understanding the difficulties faced by users in deciding between snapshot and backup, we have discussed all relevant information regarding snapshots and backups. In this post, we have discussed the difference between the snapshot and backup of SQL Server database so, that it becomes for a user to choose between the two according to the situation.

ABOUT THE AUTHOR

Puran Kandpal

I'm a SQL Server DBA. I love to explore my knowledge about SQL Server database ( stored procedures, functions, and troubleshooting) and have experience with database administration (installing, configuring, maintenance, transaction log shipping, replication, database mirroring etc) also I like to write blogs about these technologies.