Sunday, 14 June 2020

How to create a snapshot database in SQL Server


Example 1: 

CREATE DATABASE GNT_JaiVermaDB_dbss ON  

( NAME = metro_Data, FILENAME = 'E:\GNT_JaiVermaDB_data_1800.ss' )  ,

( NAME = ftrow_GNT_JaiVermaDB_HelpIndex, FILENAME = 'E:\ftrow_GNT_JaiVermaDBHelpIndex_data_1800.ss' )  ,

( NAME = ftrow_GNT_JaiVermaDB_MaterialIndex, FILENAME = 'E:\ftrow_GNT_JaiVermaDB_MaterialIndex_data_1800.ss' )  

AS SNAPSHOT OF GNT_JaiVermaDB;  
GO  

Example 2: 

CREATE DATABASE JaiVermaDB_Snapshot_1800 ON ( NAME = AdventureWorks, FILENAME = 'C:\Program Files\Microsoft SQL Server\JaiVermaDB_data_1800.ss' ) AS SNAPSHOT OF JaiVermaDB; GO


Example 3:

--Creating JaiVerma_snapshot as snapshot of the JaiVermaDB with multiple filegroups
CREATE DATABASE JaiVerma_snapshot1200 ON ( NAME = SPri1_dat, FILENAME = 'C:\Program Files\data\SJVdat_1200.ss'), ( NAME = SPri2_dat, FILENAME = 'C:\Program Files\data\SJV2dt_1200.ss'), ( NAME = SGrp1Fi1_dat, FILENAME = 'C:\Program Files\data\SG1JV1dt_1200.ss'), ( NAME = SGrp1Fi2_dat, FILENAME = 'C:\Program Files\data\SG1JV2dt_1200.ss'), ( NAME = SGrp2Fi1_dat, FILENAME = 'C:\Program Files\data\SG2JV1dt_1200.ss'), ( NAME = SGrp2Fi2_dat, FILENAME = 'C:\Program Files\data\SG2Fi2dt_1200.ss')
AS SNAPSHOT OF JaiVerma_DB; GO


No comments:

Post a Comment