USE master;
GO
CREATE DATABASE TestDB;
GO
USE TestDB;
GO
CREATE TABLE Test
(
id INT ,
Name VARCHAR(10) NULL
);
INSERT INTO Test
VALUES ( 1, 'Naresh' ),
( 2, 'Kumar' ),
( 3, 'Koudagani' );
CREATE DATABASE TestDB_Snapshot ON
( NAME = TestDB, FILENAME = 'C:\MSSQL\Data\myDb_snapshot.ss' )
AS SNAPSHOT OF TestDB;
select file_id, name, type_desc from sys.database_files
delete from test
select * from test
SELECT * from TestDB_Snapshot.dbo.test
RESTORE DATABASE TestDB FROM DATABASE_SNAPSHOT ='TestDB_Snapshot'
go
select * from TestDB.dbo.Test
No comments:
Post a Comment