The Business Intelligence Blog

February 21, 2010

How to find Database Snapshots associated with a Database

Filed under: SQL Server Database — Tags: , , , , — Shahfaisal @ 6:33 am

Often times, you might want to find out a list of all the existing database snapshots. Here is a simple script that will return each database and the associated snapshots.

          USE MASTER
          SELECT  SourceDB.[name] AS SourceDatabase,
                  SnapshotDB.[name] AS SnapshotDatabase,
                  SnapshotDB.Create_Date AS DateOfCreation
          FROM sys.databases SourceDB
          INNER JOIN sys.databases SnapshotDB
          ON SourceDB.database_id = SnapshotDB.source_database_id

I have two database snapshots on my SQL Server, so the above script will return two rows as shown in the figure below.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: