Database Snapshot By: Mahta Woldeselassie Julian Bester.

10
Database Snapshot By: Mahta Woldeselassie Julian Bester

Transcript of Database Snapshot By: Mahta Woldeselassie Julian Bester.

Page 1: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Database SnapshotBy:Mahta WoldeselassieJulian Bester

Page 2: Database Snapshot By: Mahta Woldeselassie Julian Bester.

What is a Database Snapshot? Database Snapshot is a static, read-

only copy of an existing Microsoft SQL Server database.

When a snapshot is created, it is an exact read-only replica of the source database at that point in time.

As the source database changes, the snapshot will be updated to ensure that it is synchronized.

Page 3: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Benefits of Database Snapshots Snapshots can be used for reporting purposes.

Clients can query a database snapshot, which makes it useful for writing reports based on the data at the time of snapshot creation.

Maintaining historical data for report generation. You can create a database snapshot at the end of a given time

period (such as a financial quarter) for later reporting. You can then run end-of-period reports on the snapshot.

Reverting to a database snapshot One of the biggest advantages you can leverage by creating

database snapshots is that you may be able to use them as a backup to a database backup.

For example, if someone accidently deleted data from a table in your database or a table has been dropped, instead of using a database backup you could use the snapshot. The snapshot may offer a more recent version of the database schema and data than your last backup.

Page 4: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Prerequisites and limitations of Database Snapshots

Database snapshots are supported only in the Enterprise version of SQL Server 2012

The source and the snapshot database must reside on the same SQL Server instance.

The source database or the snapshot can not be dropped, detached, or restored.

Performance could be negatively affected due to increased I/O on the source.

If a snapshot runs out of space, it must be deleted and re-created.

Page 5: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Creating a Database Snapshot

Page 6: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Database Snapshot in the Object Explorer

Page 7: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Dropping database snapshots If you decide that a database snapshot

is no longer useful or you want to start with a fresh snapshot, you can drop it.

There are two ‘very’ simple ways to drop a snapshot.

Page 8: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Dropping database snapshots (1) Using the Object Explorer:

Page 9: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Dropping database snapshots (2) In the query editor window:

Page 10: Database Snapshot By: Mahta Woldeselassie Julian Bester.

Summary Database snapshots offer you several

ways to leverage a copy of the data and schema that may have not been available before. They are commonly used for reports and ad-hoc queries. In addition you can use them for backup in case of data loss. You must take into account additional space requirements and potential performance degradation when using this feature.