Dela via


sys.database_recovery_status (Transact-SQL)

Contains one row per database. If the database is not opened, the SQL Server Database Engine tries to start it.

To see the row for a database other than master or tempdb, one of the following must apply:

  • Be the owner of the database.

  • Have ALTER ANY DATABASE or VIEW ANY DATABASE server-level permissions.

  • Have CREATE DATABASE permission in the master database.

Column name

Data type

Description

database_id

int

ID of the database, unique within an instance of SQL Server.

database_guid

uniqueidentifier

Used to relate all the database files of a database together. All files must have this GUID in their header page for the database to start as expected. Only one database should ever have this GUID, but duplicates can be created by copying and attaching databases. RESTORE always generates a new GUID when you restore a database that does not yet exist.

NULL= Database is offline, or the database will not start.

family_guid

uniqueidentifier

Identifier of the "backup family" for the database for detecting matching restore states.

NULL= Database is offline or the database will not start.

last_log_backup_lsn

numeric(25,0)

Log sequence number of the most recent log backup. This is the end LSN of the previous log backup and the starting LSN of the next log backup.

NULL= No log backup exists. The database is offline or the database will not start.

recovery_fork_guid

uniqueidentifier

Identifies the current recovery fork on which the database is currently active.

NULL= Database is offline, or the database will not start.

first_recovery_fork_guid

uniqueidentifier

Identifier of the starting recovery fork.

NULL= Database is offline, or the database will not start.

fork_point_lsn

numeric(25,0)

If first_recovery_fork_guid is not equal (!=) to recovery_fork_guid, fork_point_lsn is the log sequence number of the current fork point. Otherwise, the value is NULL.

Permissions

The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.

See Also

Reference

Catalog Views (Transact-SQL)

Databases and Files Catalog Views (Transact-SQL)

RESTORE HEADERONLY (Transact-SQL)

Concepts

Querying the SQL Server System Catalog FAQ