Upravit

Sdílet prostřednictvím


View a Database Snapshot (SQL Server)

Applies to: SQL Server

This article explains how to view a SQL Server database snapshot using SQL Server Management Studio.

Note

To create, revert to, or delete a database snapshot, you must use Transact-SQL.

Use SQL Server Management Studio

To view a database snapshot

  1. In Object Explorer, connect to the instance of the SQL Server Database Engine and then expand that instance.

  2. Expand Databases.

  3. Expand Database Snapshots, and select the snapshot you want to view.

Use Transact-SQL

To view a database snapshot

  1. Connect to the Database Engine.

  2. From the Standard bar, select New Query.

  3. To list the database snapshots of the instance of SQL Server, query the source_database_id column of the sys.databases catalog view for non-NULL values.

  4. You can also use this query to get details about the database snapshot and its files

    SELECT
     db_name(db.source_database_id) source_database,
     db.name AS snapshot_db_name,
     db.database_id,
     db.source_database_id,
     db.create_date,
     db.compatibility_level,
     db.is_read_only,
     mf.physical_name
    FROM sys.databases db
    INNER JOIN sys.master_files mf
     ON db.database_id = mf.database_id
    WHERE db.source_database_id is not null
     AND mf.is_sparse =1
    ORDER BY db.name;
    

Related Tasks

Next steps