Montag, 29. Juni 2015

Find all database snapshots related to a database



--How to enlist all database snapshots in a sql server instance

 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

--only enlist the snapshots:


SELECT * FROM sys.databases  where  source_database_id IS NOT NULL
 

Keine Kommentare: