SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Quick snapshot

By Igor Micev,

Snapshot script:
The script enables a quick creation of snapshots for databases. 
It has two run modes defined by the optional parameter @exec_mode.
 @exec_mode=0 (default) means printing the create snapshot statment and
 @exec_mode=1 means creation of the snapshot database.
 @database is mandatory input parameter.
Tested on SQL Server 2005, 2008, 2012.
EXEC [dbo].[Create_UserDb_Snapshot] @database = 'AdventureWorksDW2012'
EXEC [dbo].[Create_UserDb_Snapshot] @database = 'AdventureWorksDW2012', @exec_mode=0
EXEC [dbo].[Create_UserDb_Snapshot] @database = 'CWNET', @exec_mode=1
Date created: 2014-Mar-12
Author: Igor Micev (igor.micev@hotmail.com; igor.micev@outlook.com)

Total article views: 2248 | Views in the last 30 days: 1
Related Articles

Problems in creating database snapshots

Problems in creating database snapshots


Creating a Database Snapshot.

Creating a Database Snapshot, without space in disk.


Create Snapshot Dynamicly

Create Snapshot Dynamically considering multiple database files


Creating a Database Snapshot

Performance with databases Snapshots.


Database snapshot could not be created

database snapshot could not be created and the database or table could not be locked