How to create a database snapshot?
Use below code to create a database
snapshot:
CREATE DATABASE <SnapshotName> ON
( NAME = <Logical_FileName1>,
FILENAME = 'SnapshotFile1'), --eg. X:\Snap1.ss
(NAME = <Logical_FileName1>,
FILENAME = 'SnapshotFile1')
AS SNAPSHOT OF <SOURCEDatabase>;
GO
Note!
1) You must provide snapshot file name for
all the logical files of the source database. Snapshot is a readonly copy of the
source database at the given time when snapshot was created.
2) You must be careful about keeping snapshot for long time of a big busy (VLDB/OLTP) database. This can cause space issue and also performance issue. Please go through the architecture of this technology and sparse file before implementing it.
Comments