Wednesday, February 1, 2023

Creat DB snapshot in order to reuse the test data

 --Taking the snapshot

CREATE DATABASE AxDB_Snapshot ON  
( NAME = <DB Logical name>, FILENAME =  
'J:\MSSQL_BACKUP\AX_Snapshot2.ss' )  
AS SNAPSHOT OF AxDB;
It took me around 2 mins to create the snapshot

--Restoring the database from the snapshot
ALTER DATABASE AxDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
RESTORE DATABASE AxDB from  
DATABASE_SNAPSHOT = 'AxDB_Snapshot';  
ALTER DATABASE AxDB SET MULTI_USER;

No comments:

Post a Comment

Debug in a Tier-2 (UAT) environment

 From time to time, you may have to debug a copy of the production database, but you are unable to export & import the DB to your dev ma...