sys.databases (Transact-SQL)sys.databases (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse

SQL ServerSQL Server实例中的每个数据库都包含一行。Contains one row per database in the instance of SQL ServerSQL Server.

如果数据库不存在 ONLINE ,或者 AUTO_CLOSE 设置为 ON 并且数据库已关闭,则某些列的值可能为 NULLIf a database is not ONLINE, or AUTO_CLOSE is set to ON and the database is closed, the values of some columns may be NULL. 如果数据库为 OFFLINE ,则低权限用户看不到相应的行。If a database is OFFLINE, the corresponding row is not visible to low-privileged users. 如果数据库为,则若要查看相应的行 OFFLINE ,用户必须至少具有 ALTER ANY DATABASE 服务器级权限或 CREATE DATABASE 数据库中的权限 masterTo see the corresponding row if the database is OFFLINE, a user must have at least the ALTER ANY DATABASE server-level permission, or the CREATE DATABASE permission in the master database.

列名称Column name 数据类型Data type 说明Description
namename sysnamesysname 数据库名称,在 SQL ServerSQL Server 实例中或在 Azure SQL 数据库Azure SQL Database 服务器中是唯一的。Name of database, unique within an instance of SQL ServerSQL Server or within a Azure SQL 数据库Azure SQL Database server.
database_iddatabase_id intint 数据库的 ID,在 SQL ServerSQL Server 实例中或在 Azure SQL 数据库Azure SQL Database 服务器中是唯一的。ID of the database, unique within an instance of SQL ServerSQL Server or within a Azure SQL 数据库Azure SQL Database server.
source_database_idsource_database_id intint Non-NULL = 该数据库快照的源数据库 ID。Non-NULL = ID of the source database of this database snapshot.
NULL = 非数据库快照。NULL = Not a database snapshot.
owner_sidowner_sid varbinary(85)varbinary(85) 注册到服务器的数据库外部所有者的 SID(安全标识符)。SID (Security-Identifier) of the external owner of the database, as registered to the server. 有关谁可以拥有数据库的信息,请参阅ALTER authorization中的alter authorization for database 部分。For information about who can own a database, see the ALTER AUTHORIZATION for databases section of ALTER AUTHORIZATION.
create_datecreate_date datetimedatetime 数据库的创建或重命名日期。Date the database was created or renamed. 对于 tempdb,每次服务器重启时,此值都会发生更改。For tempdb, this value changes every time the server restarts.
compatibility_levelcompatibility_level tinyinttinyint 对应于兼容行为的 SQL ServerSQL Server 版本的整数:Integer corresponding to the version of SQL ServerSQL Server for which behavior is compatible:

Value适用于Applies to
7070SQL ServerSQL Server 7.0 到 SQL Server 2008SQL Server 20087.0 through SQL Server 2008SQL Server 2008
8080SQL Server 2000 (8.x)SQL Server 2000 (8.x) 周一至 SQL Server 2008 R2SQL Server 2008 R2through SQL Server 2008 R2SQL Server 2008 R2
9090SQL Server 2008SQL Server 2008 周一至 SQL Server 2012 (11.x)SQL Server 2012 (11.x)through SQL Server 2012 (11.x)SQL Server 2012 (11.x)
100100SQL ServerSQL Server(从 SQL Server 2008SQL Server 2008 开始)和 Azure SQL 数据库Azure SQL Database(Starting with SQL Server 2008SQL Server 2008) and Azure SQL 数据库Azure SQL Database
110110SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL Database(Starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
120120SQL ServerSQL Server(从 SQL Server 2014 (12.x)SQL Server 2014 (12.x) 开始)和 Azure SQL 数据库Azure SQL Database(Starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x)) and Azure SQL 数据库Azure SQL Database
130130SQL ServerSQL Server(从 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始)和 Azure SQL 数据库Azure SQL Database(Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x)) and Azure SQL 数据库Azure SQL Database
140140SQL ServerSQL Server(从 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 开始)和 Azure SQL 数据库Azure SQL Database(Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x)) and Azure SQL 数据库Azure SQL Database
150150SQL ServerSQL Server(从 SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始)和 Azure SQL 数据库Azure SQL Database(Starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x)) and Azure SQL 数据库Azure SQL Database
collation_namecollation_name sysnamesysname 数据库的排序规则。Collation for the database. 作为数据库中的默认排序规则。Acts as the default collation in the database.
NULL = 数据库不处于联机状态,或者 AUTO_CLOSE 设置为 ON 且数据库已关闭。NULL = Database is not online or AUTO_CLOSE is set to ON and the database is closed.
user_accessuser_access tinyinttinyint 用户访问设置:User-access setting:
0 = 已指定 MULTI_USER0 = MULTI_USER specified
1 = 已指定 SINGLE_USER1 = SINGLE_USER specified
2 = 已指定 RESTRICTED_USER2 = RESTRICTED_USER specified
user_access_descuser_access_desc nvarchar(60)nvarchar(60) 用户访问设置的说明。Description of user-access setting.
is_read_onlyis_read_only bitbit 1 = 数据库为 READ_ONLY1 = Database is READ_ONLY
0 = 数据库为 READ_WRITE0 = Database is READ_WRITE
is_auto_close_onis_auto_close_on bitbit 1 = AUTO_CLOSE 为 ON1 = AUTO_CLOSE is ON
0 = AUTO_CLOSE 为 OFF0 = AUTO_CLOSE is OFF
is_auto_shrink_onis_auto_shrink_on bitbit 1 = AUTO_SHRINK 为 ON1 = AUTO_SHRINK is ON
0 = AUTO_SHRINK 为 OFF0 = AUTO_SHRINK is OFF
statestate tinyinttinyint Value
0 = ONLINE 0 = ONLINE
1 = RESTORING1 = RESTORING
2 = 正在恢复 12 = RECOVERING 1
3 = RECOVERY_PENDING 13 = RECOVERY_PENDING 1
4 = SUSPECT 4 = SUSPECT
5 = 紧急 15 = EMERGENCY 1
6 = 脱机 16 = OFFLINE 1
7 = 正在复制 27 = COPYING 2
10 = OFFLINE_SECONDARY 210 = OFFLINE_SECONDARY 2

注意: 对于 Always On 数据库,查询 database_state sys.dm_hadr_database_replica_states 的或 database_state_descsys.dm_hadr_database_replica_statesNote: For Always On databases, query the database_state or database_state_desc columns of sys.dm_hadr_database_replica_states.

1 适用于SQL ServerSQL Server 从) 开始 (SQL Server 2008SQL Server 2008Azure SQL 数据库Azure SQL Database1 Applies to: SQL ServerSQL Server (starting with SQL Server 2008SQL Server 2008) and Azure SQL 数据库Azure SQL Database
2 适用于: Azure SQL 数据库Azure SQL Database活动的地理复制Active Geo-Replication2 Applies to: Azure SQL 数据库Azure SQL Database 活动的地理复制Active Geo-Replication
state_descstate_desc nvarchar(60)nvarchar(60) 数据库状态的说明。Description of the database state. 请参阅状态。See state.
is_in_standbyis_in_standby bitbit 对于还原日志而言,数据库是只读的。Database is read-only for restore log.
is_cleanly_shutdownis_cleanly_shutdown bitbit 1 = 数据库完全关闭;在启动时不需要恢复1 = Database shut down cleanly; no recovery required on startup
0 = 数据库并未完全关闭;在启动时需要恢复0 = Database did not shut down cleanly; recovery is required on startup
is_supplemental_logging_enabledis_supplemental_logging_enabled bitbit 1 = SUPPLEMENTAL_LOGGING 为 ON1 = SUPPLEMENTAL_LOGGING is ON
0 = SUPPLEMENTAL_LOGGING 为 OFF0 = SUPPLEMENTAL_LOGGING is OFF
snapshot_isolation_statesnapshot_isolation_state tinyinttinyint 允许的快照隔离事务状态,如 ALLOW_SNAPSHOT_ISOLATION 选项所设置:State of snapshot-isolation transactions being allowed, as set by the ALLOW_SNAPSHOT_ISOLATION option:
0 = 快照隔离状态为 OFF(默认值)。0 = Snapshot isolation state is OFF (default). 不允许使用快照隔离。Snapshot isolation is disallowed.
1 = 快照隔离状态为 ON。1 = Snapshot isolation state ON. 允许使用快照隔离。Snapshot isolation is allowed.
2 = 快照隔离状态正在转换到 OFF 状态。2 = Snapshot isolation state is in transition to OFF state. 所有事务都将其修改版本化。All transactions have their modifications versioned. 无法使用快照隔离启动新的事务。Cannot start new transactions using snapshot isolation. 数据库仍保持向 OFF 状态转换,直到所有在执行 ALTER DATABASE 时处于活动状态的事务完成。The database remains in the transition to OFF state until all transactions that were active when ALTER DATABASE was run can be completed.
3 = 快照隔离状态正在转换到 ON 状态。3 = Snapshot isolation state is in transition to ON state. 新事务都将其修改版本化。New transactions have their modifications versioned. 在快照隔离状态变为 1 (ON) 之前,事务无法使用快照隔离。Transactions cannot use snapshot isolation until the snapshot isolation state becomes 1 (ON). 数据库仍保持向 ON 状态转换,直到所有在执行 ALTER DATABASE 时处于活动状态的更新事务完成。The database remains in the transition to ON state until all update transactions that were active when ALTER DATABASE was run can be completed.
snapshot_isolation_state_descsnapshot_isolation_state_desc nvarchar(60)nvarchar(60) 允许的快照隔离事务状态的说明,它由 ALLOW_SNAPSHOT_ISOLATION 选项设置。Description of state of snapshot-isolation transactions being allowed, as set by the ALLOW_SNAPSHOT_ISOLATION option.
is_read_committed_snapshot_onis_read_committed_snapshot_on bitbit 1 = READ_COMMITTED_SNAPSHOT 选项为 ON。1 = READ_COMMITTED_SNAPSHOT option is ON. read-committed 隔离级别下的读操作基于快照扫描,没有获取锁。Read operations under the read-committed isolation level are based on snapshot scans and do not acquire locks.
0 = READ_COMMITTED_SNAPSHOT 选项为 OFF(默认)。0 = READ_COMMITTED_SNAPSHOT option is OFF (default). read-committed 隔离级别下的读操作使用共享锁。Read operations under the read-committed isolation level use share locks.
recovery_modelrecovery_model tinyinttinyint 选定的恢复模式:Recovery model selected:
1 = FULL1 = FULL
2 = BULK_LOGGED2 = BULK_LOGGED
3 = SIMPLE3 = SIMPLE
recovery_model_descrecovery_model_desc nvarchar(60)nvarchar(60) 选定的恢复模式的说明。Description of recovery model selected.
page_verify_optionpage_verify_option tinyinttinyint PAGE_VERIFY 选项的设置:Setting of PAGE_VERIFY option:
0 = NONE0 = NONE
1 = TORN_PAGE_DETECTION1 = TORN_PAGE_DETECTION
2 = CHECKSUM2 = CHECKSUM
page_verify_option_descpage_verify_option_desc nvarchar(60)nvarchar(60) PAGE_VERIFY 选项设置的说明。Description of PAGE_VERIFY option setting.
is_auto_create_stats_onis_auto_create_stats_on bitbit 1 = AUTO_CREATE_STATISTICS 为 ON1 = AUTO_CREATE_STATISTICS is ON
0 = AUTO_CREATE_STATISTICS 为 OFF0 = AUTO_CREATE_STATISTICS is OFF
is_auto_create_stats_incremental_onis_auto_create_stats_incremental_on bitbit 指示自动统计信息的增量选项的默认设置。Indicates the default setting for the incremental option of auto stats.
0 = 自动创建统计信息不是增量统计信息0 = auto create stats are non-incremental
1 = 如果可能,自动创建统计信息是增量统计信息1 = auto create stats are incremental if possible
适用范围:SQL ServerSQL Server(从 SQL Server 2014 (12.x)SQL Server 2014 (12.x) 开始) 。Applies to: SQL ServerSQL Server (starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x)).
is_auto_update_stats_onis_auto_update_stats_on bitbit 1 = AUTO_UPDATE_STATISTICS 为 ON1 = AUTO_UPDATE_STATISTICS is ON
0 = AUTO_UPDATE_STATISTICS 为 OFF0 = AUTO_UPDATE_STATISTICS is OFF
is_auto_update_stats_async_onis_auto_update_stats_async_on bitbit 1 = AUTO_UPDATE_STATISTICS_ASYNC 为 ON1 = AUTO_UPDATE_STATISTICS_ASYNC is ON
0 = AUTO_UPDATE_STATISTICS_ASYNC 为 OFF0 = AUTO_UPDATE_STATISTICS_ASYNC is OFF
is_ansi_null_default_onis_ansi_null_default_on bitbit 1 = ANSI_NULL_DEFAULT 为 ON1 = ANSI_NULL_DEFAULT is ON
0 = ANSI_NULL_DEFAULT 为 OFF0 = ANSI_NULL_DEFAULT is OFF
is_ansi_nulls_onis_ansi_nulls_on bitbit 1 = ANSI_NULLS 为 ON1 = ANSI_NULLS is ON
0 = ANSI_NULLS 为 OFF0 = ANSI_NULLS is OFF
is_ansi_padding_onis_ansi_padding_on bitbit 1 = ANSI_PADDING 为 ON1 = ANSI_PADDING is ON
0 = ANSI_PADDING 为 OFF0 = ANSI_PADDING is OFF
is_ansi_warnings_onis_ansi_warnings_on bitbit 1 = ANSI_WARNINGS 为 ON1 = ANSI_WARNINGS is ON
0 = ANSI_WARNINGS 为 OFF0 = ANSI_WARNINGS is OFF
is_arithabort_onis_arithabort_on bitbit 1 = ARITHABORT 为 ON1 = ARITHABORT is ON
0 = ARITHABORT 为 OFF0 = ARITHABORT is OFF
is_concat_null_yields_null_onis_concat_null_yields_null_on bitbit 1 = CONCAT_NULL_YIELDS_NULL 为 ON1 = CONCAT_NULL_YIELDS_NULL is ON
0 = CONCAT_NULL_YIELDS_NULL 为 OFF0 = CONCAT_NULL_YIELDS_NULL is OFF
is_numeric_roundabort_onis_numeric_roundabort_on bitbit 1 = NUMERIC_ROUNDABORT 为 ON1 = NUMERIC_ROUNDABORT is ON
0 = NUMERIC_ROUNDABORT 为 OFF0 = NUMERIC_ROUNDABORT is OFF
is_quoted_identifier_onis_quoted_identifier_on bitbit 1 = QUOTED_IDENTIFIER 为 ON1 = QUOTED_IDENTIFIER is ON
0 = QUOTED_IDENTIFIER 为 OFF0 = QUOTED_IDENTIFIER is OFF
is_recursive_triggers_onis_recursive_triggers_on bitbit 1 = RECURSIVE_TRIGGERS 为 ON1 = RECURSIVE_TRIGGERS is ON
0 = RECURSIVE_TRIGGERS 为 OFF0 = RECURSIVE_TRIGGERS is OFF
is_cursor_close_on_commit_onis_cursor_close_on_commit_on bitbit 1 = CURSOR_CLOSE_ON_COMMIT 为 ON1 = CURSOR_CLOSE_ON_COMMIT is ON
0 = CURSOR_CLOSE_ON_COMMIT 为 OFF0 = CURSOR_CLOSE_ON_COMMIT is OFF
is_local_cursor_defaultis_local_cursor_default bitbit 1 = CURSOR_DEFAULT 为局部默认值1 = CURSOR_DEFAULT is local
0 = CURSOR_DEFAULT 为全局默认值0 = CURSOR_DEFAULT is global
is_fulltext_enabledis_fulltext_enabled bitbit 1 = 针对数据库启用全文1 = Full-text is enabled for the database
0 = 针对数据库禁用全文0 = Full-text is disabled for the database
is_trustworthy_onis_trustworthy_on bitbit 1 = 数据库已标记为可信1 = Database has been marked trustworthy
0 = 数据库尚未标记为可信0 = Database has not been marked trustworthy
默认情况下,还原的数据库或附加的数据库具有 "可信未启用"。By default, restored or attached databases have the trustworthy not enabled.
is_db_chaining_onis_db_chaining_on bitbit 1 = 跨数据库所有权链接为 ON1 = Cross-database ownership chaining is ON
0 = 跨数据库所有权链接为 OFF0 = Cross-database ownership chaining is OFF
is_parameterization_forcedis_parameterization_forced bitbit 1 = 参数化为 FORCED1 = Parameterization is FORCED
0 = 参数化为 SIMPLE0 = Parameterization is SIMPLE
is_master_key_encrypted_by_serveris_master_key_encrypted_by_server bitbit 1 = 数据库具有加密的主密钥1 = Database has an encrypted master key
0 = 数据库没有加密的主密钥0 = Database does not have an encrypted master key
is_query_store_onis_query_store_on bitbit 1 = 为此数据库启用查询存储。1 = The query store is enable for this database. 选中 sys.database_query_store_options 查看查询存储状态。Check sys.database_query_store_options to view the query store status.
0 = 未启用查询存储0 = The query store is not enabled
适用范围:SQL ServerSQL Server(从 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始) 。Applies to: SQL ServerSQL Server (starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x)).
is_publishedis_published bitbit 1 = 数据库为事务复制拓扑或快照复制拓扑中的发布数据库1 = Database is a publication database in a transactional or snapshot replication topology
0 = 不是发布数据库0 = Is not a publication database
is_subscribedis_subscribed bitbit 未使用此列。This column is not used. 它将始终返回 0,而与数据库的订阅服务器状态无关。It will always return 0, regardless of the subscriber status of the database.
is_merge_publishedis_merge_published bitbit 1 = 数据库为合并复制拓扑中的发布数据库1 = Database is a publication database in a merge replication topology
0 = 不是合并复制拓扑中的发布数据库0 = Is not a publication database in a merge replication topology
is_distributoris_distributor bitbit 1 = 数据库为复制拓扑的分发数据库1 = Database is the distribution database for a replication topology
0 = 不是复制拓扑的分发数据库0 = Is not the distribution database for a replication topology
is_sync_with_backupis_sync_with_backup bitbit 1 = 数据库标记为与备份进行复制同步1 = Database is marked for replication synchronization with backup
0 = 没有标记为与备份进行复制同步0 = Is not marked for replication synchronization with backup
service_broker_guidservice_broker_guid uniqueidentifieruniqueidentifier 该数据库的服务代理标识符。Identifier of the service broker for this database. 用作路由表中目标的 broker_instanceUsed as the broker_instance of the target in the routing table.
is_broker_enabledis_broker_enabled bitbit 1 = 该数据库中的代理当前正在发送和接收消息。1 = The broker in this database is currently sending and receiving messages.
0 = 所有已发送的消息都会停留在传输队列中,已接收的消息不会置于该数据库的队列中。0 = All sent messages will stay on the transmission queue and received messages will not be put on queues in this database.
默认情况下,还原的数据库或附加的数据库都禁用了代理。By default, restored or attached databases have the broker disabled. 与此相关的例外是数据库镜像,其中 Broker 在故障转移后启用。The exception to this is database mirroring where the broker is enabled after failover.
log_reuse_waitlog_reuse_wait tinyinttinyint 事务日志空间的重复使用目前正在等待最后一个检查点的下列其中一项。Reuse of transaction log space is currently waiting on one of the following as of the last checkpoint. 有关这些值的更多详细说明,请参阅 事务日志For more detailed explanations of these values, see The Transaction Log.
Value
0 = 无0 = Nothing
1 = 检查点 (当数据库使用恢复模式并且具有内存优化数据文件组时,应看到 log_reuse_wait 该列指示 checkpointxtp_checkpoint) 11 = Checkpoint (When a database uses a recovery model and has a memory-optimized data filegroup, you should expect to see the log_reuse_wait column indicate checkpoint or xtp_checkpoint) 1
2 = 日志备份 12 = Log Backup 1
3 = 活动备份或还原 13 = Active backup or restore 1
4 = 活动事务 14 = Active transaction 1
5 = 数据库镜像 15 = Database mirroring 1
6 = 复制 16 = Replication 1
7 = 数据库快照创建 17 = Database snapshot creation 1
8 = 日志扫描8 = Log scan
9 = Always On 可用性组的辅助副本正将此数据库的事务日志记录应用到相应的辅助数据库。9 = An Always On Availability Groups secondary replica is applying transaction log records of this database to a corresponding secondary database. 22
9 = 其他 (暂时性) 39 = Other (Transient) 3
10 = 仅供内部使用 210 = For internal use only 2
11 = 仅供内部使用 211 = For internal use only 2
12 = 仅供内部使用 212 = For internal use only 2
13 = 最早第213 = Oldest page 2
14 = 其他 214 = Other 2
16 = XTP_CHECKPOINT (当数据库使用恢复模式并且具有内存优化数据文件组时,应会看到 log_reuse_wait 列指示 checkpointxtp_checkpoint) 416 = XTP_CHECKPOINT (When a database uses a recovery model and has a memory-optimized data filegroup, you should expect to see the log_reuse_wait column indicate checkpoint or xtp_checkpoint) 4

1 适用于SQL ServerSQL Server 从) 开始 (SQL Server 2008SQL Server 20081 Applies to: SQL ServerSQL Server (starting with SQL Server 2008SQL Server 2008)
2 适用于SQL ServerSQL Server 从) 开始 (SQL Server 2012 (11.x)SQL Server 2012 (11.x)2 Applies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x))
3 适用于SQL ServerSQL Server 最多 (,包括 SQL Server 2008 R2SQL Server 2008 R2) 3 Applies to: SQL ServerSQL Server (up to, and including SQL Server 2008 R2SQL Server 2008 R2)
4 适用于SQL ServerSQL Server 从) 开始 (SQL Server 2014 (12.x)SQL Server 2014 (12.x)4 Applies to: SQL ServerSQL Server (starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x))
log_reuse_wait_desclog_reuse_wait_desc nvarchar(60)nvarchar(60) 日志空间的重复使用正在等待最后一个检查点的描述。Description of reuse of transaction log space is currently waiting on as of the last checkpoint.
is_date_correlation_onis_date_correlation_on bitbit 1 = DATE_CORRELATION_OPTIMIZATION 为 ON1 = DATE_CORRELATION_OPTIMIZATION is ON
0 = DATE_CORRELATION_OPTIMIZATION 为 OFF0 = DATE_CORRELATION_OPTIMIZATION is OFF
is_cdc_enabledis_cdc_enabled bitbit 1 = 对数据库启用变更数据捕获。1 = Database is enabled for change data capture. 有关详细信息,请参阅 (transact-sql)sys.sp_cdc_enable_db For more information, see sys.sp_cdc_enable_db (Transact-SQL).
is_encryptedis_encrypted bitbit 指示是否对数据库进行加密 (反映使用子句) 上次设置的状态 ALTER DATABASE SET ENCRYPTIONIndicates whether the database is encrypted (reflects the state last set by using the ALTER DATABASE SET ENCRYPTION clause). 可以是以下值之一:Can be one of the following values:
1 = 已加密1 = Encrypted
0 = 未加密0 = Not Encrypted
有关数据库加密的详细信息,请参阅透明数据加密 (TDE)For more information about database encryption, see Transparent Data Encryption (TDE).
如果数据库正处于解密过程中,将 is_encrypted 显示值0。If the database is in the process of being decrypted, is_encrypted shows a value of 0. 可以通过使用 sys.dm_database_encryption_keys 动态管理视图来查看加密过程的状态。You can see the state of the encryption process by using the sys.dm_database_encryption_keys dynamic management view.
is_honor_broker_priority_onis_honor_broker_priority_on bitbit 指示数据库是否采用会话优先级 (反映上次使用子句) 设置的状态 ALTER DATABASE SET HONOR_BROKER_PRIORITYIndicates whether the database honors conversation priorities (reflects the state last set by using the ALTER DATABASE SET HONOR_BROKER_PRIORITY clause). 可以是以下值之一:Can be one of the following values:
1 = HONOR_BROKER_PRIORITY 为 ON1 = HONOR_BROKER_PRIORITY is ON
0 = HONOR_BROKER_PRIORITY 为 OFF0 = HONOR_BROKER_PRIORITY is OFF
默认情况下,还原的数据库或附加的数据库的 broker 优先级为 off。By default, restored or attached databases have the broker priority off.
replica_idreplica_id uniqueidentifieruniqueidentifier 数据库参与的可用性组(如果有)的本地 Always On 可用性组Always On availability groups可用性副本的唯一标识符。Unique identifier of the local Always On 可用性组Always On availability groups availability replica of the availability group, if any, in which the database is participating.
NULL = 数据库不是可用性组中的可用性副本的一部分。NULL = database is not part of an availability replica of in availability group.
适用于SQL ServerSQL ServerSQL Server 2012 (11.x)SQL Server 2012 (11.x) 及更高版本)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (SQL Server 2012 (11.x)SQL Server 2012 (11.x) and later) and Azure SQL 数据库Azure SQL Database
group_database_idgroup_database_id uniqueidentifieruniqueidentifier 数据库参与到 Always On 可用性组(如果有)内的数据库的唯一标识符。Unique identifier of the database within an Always On availability group, if any, in which the database is participating. 对于主副本上的此数据库以及已将数据库联接到可用性组的每个辅助副本, group_database_id都是相同的。group_database_id is the same for this database on the primary replica and on every secondary replica on which the database has been joined to the availability group.
NULL = 数据库不是任何可用性组中的可用性副本的一部分。NULL = database is not part of an availability replica in any availability group.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
resource_pool_idresource_pool_id intint 映射到此数据库的资源池的 ID。The id of the resource pool that is mapped to this database. 此资源池控制对该数据库中的内存优化表可用的总内存。This resource pool controls total memory available to memory-optimized tables in this database.
适用范围SQL ServerSQL Server 从) 开始 (SQL Server 2014 (12.x)SQL Server 2014 (12.x)Applies to: SQL ServerSQL Server (starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x))
default_language_lciddefault_language_lcid smallintsmallint 指示包含数据库的默认语言的本地 ID (lcid)。Indicates the local id (lcid) of the default language of a contained database.
注意: 作为的 配置默认语言服务器配置选项 sp_configureNote: Functions as the Configure the default language Server Configuration Option of sp_configure. 对于非包含数据库,此值为 nullThis value is null for a non-contained database.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
default_language_namedefault_language_name nvarchar(128)nvarchar(128) 指示包含数据库的默认语言。Indicates the default language of a contained database.
对于非包含数据库,此值为 nullThis value is null for a non-contained database.
适用于SQL ServerSQL ServerSQL Server 2012 (11.x)SQL Server 2012 (11.x) 及更高版本)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (SQL Server 2012 (11.x)SQL Server 2012 (11.x) and later) and Azure SQL 数据库Azure SQL Database
default_fulltext_language_lciddefault_fulltext_language_lcid intint 指示包含数据库的默认全文语言 (lcid) 的区域设置 id。Indicates the locale id (lcid) of the default fulltext language of the contained database.
注意: 函数作为默认的默认 全文语言服务器配置选项 sp_configureNote: Functions as the default Configure the default full-text language Server Configuration Option of sp_configure. 对于非包含数据库,此值为 nullThis value is null for a non-contained database.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
default_fulltext_language_namedefault_fulltext_language_name nvarchar(128)nvarchar(128) 指示包含数据库的默认全文语言。Indicates the default fulltext language of the contained database.
对于非包含数据库,此值为 nullThis value is null for a non-contained database.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
is_nested_triggers_onis_nested_triggers_on bitbit 指示包含数据库中是否允许使用嵌套触发器。Indicates whether or not nested triggers are allowed in the contained database.
0 = 不允许使用嵌套触发器0 = nested triggers are not allowed
1 = 允许使用嵌套触发器1 = nested triggers are allowed
注意: 作为的 配置嵌套触发器服务器配置选项 sp_configureNote: Functions as the Configure the nested triggers Server Configuration Option of sp_configure. 对于非包含数据库,此值为 nullThis value is null for a non-contained database. 有关详细信息,请参阅 sys.configurations (transact-sql)See sys.configurations (Transact-SQL) for further information.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
is_transform_noise_words_onis_transform_noise_words_on bitbit 指示是否应在包含数据库中转换干扰词。Indicates whether or noise words should be transformed in the contained database.
0 = 不应转换干扰词。0 = noise words should not be transformed.
1 = 应转换干扰词。1 = noise words should be transformed.
注意: 作为的 转换干扰词服务器配置选项 sp_configureNote: Functions as the transform noise words Server Configuration Option of sp_configure. 对于非包含数据库,此值为 nullThis value is null for a non-contained database. 有关详细信息,请参阅 sys.configurations (transact-sql)See sys.configurations (Transact-SQL) for further information.
适用范围SQL ServerSQL Server 从) 开始 (SQL Server 2012 (11.x)SQL Server 2012 (11.x)Applies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x))
two_digit_year_cutofftwo_digit_year_cutoff smallintsmallint 指示 1753 到 9999 之间的数字值,以表示将两位数的年份解释为四位数的年份的截止年份。Indicates a value of a number between 1753 and 9999 to represent the cutoff year for interpreting two-digit years as four-digit years.
注意: 作为 " 配置两位数年份截止" 服务器配置选项 的功能 sp_configureNote: Functions as the Configure the two digit year cutoff Server Configuration Option of sp_configure. 对于非包含数据库,此值为 nullThis value is null for a non-contained database. 有关详细信息,请参阅 sys.configurations (transact-sql)See sys.configurations (Transact-SQL) for further information.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
containmentcontainment tinyint not nulltinyint not null 指示数据库的包含状态。Indicates the containment status of the database.
0 = 数据库包含状态为 OFF。0 = database containment is off. 适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
1 = 数据库在部分包容中适用于: SQL ServerSQL Server 从) 开始 (SQL Server 2012 (11.x)SQL Server 2012 (11.x)1 = database is in partial containment Applies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x))
containment_desccontainment_desc nvarchar (60) not nullnvarchar(60) not null 指示数据库的包含状态。Indicates the containment status of the database.
NONE = 早期数据库(零包含)NONE = legacy database (zero containment)
PARTIAL = 部分包含的数据库PARTIAL = partially contained database
适用于SQL ServerSQL ServerSQL Server 2012 (11.x)SQL Server 2012 (11.x) 及更高版本)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (SQL Server 2012 (11.x)SQL Server 2012 (11.x) and later) and Azure SQL 数据库Azure SQL Database
target_recovery_time_in_secondstarget_recovery_time_in_seconds intint 恢复数据库的估计时间(秒)。The estimated time to recover the database, in seconds. 可以为 NULL。Nullable.
适用范围:SQL ServerSQL Server(从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x)) and Azure SQL 数据库Azure SQL Database
delayed_durabilitydelayed_durability intint 延迟持续性设置:The delayed durability setting:
0 = 禁用0 = DISABLED
1 = 允许1 = ALLOWED
2 = 强制2 = FORCED
有关详细信息,请参阅控制事务持续性For more information, see Control Transaction Durability.
适用范围:SQL ServerSQL Server(从 SQL Server 2014 (12.x)SQL Server 2014 (12.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x)) and Azure SQL 数据库Azure SQL Database.
delayed_durability_descdelayed_durability_desc nvarchar(60)nvarchar(60) 延迟持续性设置:The delayed durability setting:
DISABLEDDISABLED
ALLOWEDALLOWED
FORCEDFORCED
适用范围:SQL ServerSQL Server(从 SQL Server 2014 (12.x)SQL Server 2014 (12.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x)) and Azure SQL 数据库Azure SQL Database.
is_memory_optimized_elevate_to_snapshot_onis_memory_optimized_elevate_to_snapshot_on bitbit 在会话设置 TRANSACTION ISOLATION LEVEL 设置为较低的隔离级别、READ COMMITTED 或 READ UNCOMMITTED 时,使用 SNAPSHOT 隔离访问内存优化表。Memory-optimized tables are accessed using SNAPSHOT isolation when the session setting TRANSACTION ISOLATION LEVEL is set to a lower isolation level, READ COMMITTED or READ UNCOMMITTED.
1 = 最低隔离级别为 SNAPSHOT。1 = Minimum isolation level is SNAPSHOT.
0 = 隔离级别未进行提升。0 = Isolation level is not elevated.
is_federation_memberis_federation_member bitbit 指示该数据库是否为联合的成员。Indicates if the database is a member of a federation.
适用于:Azure SQL 数据库Azure SQL DatabaseApplies to: Azure SQL 数据库Azure SQL Database
is_remote_data_archive_enabledis_remote_data_archive_enabled bitbit 指示是否延伸数据库。Indicates whether the database is stretched.
0 = 数据库未启用延伸。0 = The database is not Stretch-enabled.
1 = 数据库已启用延伸。1 = The database is Stretch-enabled.
适用范围SQL ServerSQL Server 从) 开始 (SQL Server 2016 (13.x)SQL Server 2016 (13.x)Applies to: SQL ServerSQL Server (starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x))
有关详细信息,请参阅 Stretch DatabaseFor more information, see Stretch Database.
is_mixed_page_allocation_onis_mixed_page_allocation_on bitbit 指示数据库中的表和索引是否可以从混合区分配初始页。Indicates whether tables and indexes in the database can allocate initial pages from mixed extents.
0 = 数据库中的表和索引始终从统一区分配初始页面。0 = Tables and indexes in the database always allocate initial pages from uniform extents.
1 = 数据库中的表和索引可以分配混合区中的初始页面。1 = Tables and indexes in the database can allocate initial pages from mixed extents.
有关详细信息,请参阅 SET MIXED_PAGE_ALLOCATION ALTER DATABASE SET Options (transact-sql)的选项。For more information, see the SET MIXED_PAGE_ALLOCATION option of ALTER DATABASE SET Options (Transact-SQL).
适用范围SQL ServerSQL Server 从) 开始 (SQL Server 2016 (13.x)SQL Server 2016 (13.x)Applies to: SQL ServerSQL Server (starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x))
is_temporal_history_retention_enabledis_temporal_history_retention_enabled bitbit 指示是否启用时态保留策略清理任务。Indicates whether temporal retention policy cleanup task is enabled.

1 = 启用时态保留1 = temporal retention is enabled
0 = 禁用时态保留0 = temporal retention is disabled
适用范围:SQL ServerSQL Server(从 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x)) and Azure SQL 数据库Azure SQL Database
catalog_collation_typecatalog_collation_type intint 目录排序规则设置:The catalog collation setting:
0 = DATABASE_DEFAULT0 = DATABASE_DEFAULT
2 = SQL_Latin_1_General_CP1_CI_AS2 = SQL_Latin_1_General_CP1_CI_AS
适用于:Azure SQL 数据库Azure SQL DatabaseApplies to: Azure SQL 数据库Azure SQL Database
catalog_collation_type_desccatalog_collation_type_desc nvarchar(60)nvarchar(60) 目录排序规则设置:The catalog collation setting:
COLLATEDATABASE_DEFAULT
SQL_Latin_1_General_CP1_CI_ASSQL_Latin_1_General_CP1_CI_AS
适用于:Azure SQL 数据库Azure SQL DatabaseApplies to: Azure SQL 数据库Azure SQL Database
physical_database_namephysical_database_name nvarchar(128)nvarchar(128) 对于 SQL ServerSQL Server ,则为数据库的物理名称。For SQL ServerSQL Server, the physical name of the database. 对于 Azure SQL 数据库Azure SQL Database ,为服务器上的数据库提供通用 id。For Azure SQL 数据库Azure SQL Database, a common id for the databases on a server.
适用范围:SQL ServerSQL Server(从 SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x)) and Azure SQL 数据库Azure SQL Database
is_result_set_caching_onis_result_set_caching_on bitbit 指示是否启用结果集缓存。Indicates whether result set caching is enabled.
1 = 已启用结果集缓存1 = result set caching is enabled
0 = 禁用结果集缓存0 = result set caching is disabled
适用于: Azure Synapse Analytics(SQL 数据仓库)Azure Synapse Analytics (SQL Data Warehouse) Gen2。Applies to: Azure Synapse Analytics(SQL 数据仓库)Azure Synapse Analytics (SQL Data Warehouse) Gen2. 尽管此功能已推出到所有区域,但请查看部署到实例的版本,以及最新的 Azure Synapse 发行说明Gen2 升级计划 以了解功能可用性。While this feature is being rolled out to all regions, please check the version deployed to your instance and the latest Azure Synapse release notes and Gen2 upgrade schedule for feature availability.
is_accelerated_database_recovery_onis_accelerated_database_recovery_on bitbit 指示是否启用加速数据库恢复 (ADR) 。Indicates whether Accelerated Database Recovery (ADR) is enabled.
1 = 启用 ADR1 = ADR is enabled
0 = 禁用 ADR0 = ADR is disabled
适用范围:SQL ServerSQL Server(从 SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x)) and Azure SQL 数据库Azure SQL Database
is_tempdb_spill_to_remote_storeis_tempdb_spill_to_remote_store bitbit 指示是否启用 tempdb 溢出到远程存储。Indicates whether tempdb spill to remote store is enabled.
1 = 已启用1 = enabled
0 = 已禁用0 = disabled
适用于: Azure Synapse Analytics(SQL 数据仓库)Azure Synapse Analytics (SQL Data Warehouse) Gen2。Applies to: Azure Synapse Analytics(SQL 数据仓库)Azure Synapse Analytics (SQL Data Warehouse) Gen2. 尽管此功能已推出到所有区域,但请查看部署到实例的版本,以及最新的 Azure Synapse 发行说明Gen2 升级计划 以了解功能可用性。While this feature is being rolled out to all regions, please check the version deployed to your instance and the latest Azure Synapse release notes and Gen2 upgrade schedule for feature availability.
is_stale_page_detection_onis_stale_page_detection_on bitbit 指示是否启用过时页检测。Indicates whether stale page detection is enabled.
1 = 已启用过时页检测1 = stale page detection is enabled
0 = 禁用陈旧页面检测0 = stale page detection is disabled
适用于: Azure Synapse Analytics(SQL 数据仓库)Azure Synapse Analytics (SQL Data Warehouse) Gen2。Applies to: Azure Synapse Analytics(SQL 数据仓库)Azure Synapse Analytics (SQL Data Warehouse) Gen2. 尽管此功能已推出到所有区域,但请查看部署到实例的版本,以及最新的 Azure Synapse 发行说明Gen2 升级计划 以了解功能可用性。While this feature is being rolled out to all regions, please check the version deployed to your instance and the latest Azure Synapse release notes and Gen2 upgrade schedule for feature availability.
is_memory_optimized_enabledis_memory_optimized_enabled bitbit 指示是否为数据库启用了某些 In-Memory 功能,如 混合缓冲池Indicates whether certain In-Memory features, such as Hybrid Buffer Pool, are enabled for the database. 不反映 内存中 OLTP的可用性或配置状态。Does not reflect the availability or configuration state of In-Memory OLTP.
1 = 启用了内存优化功能1 = memory-optimized features are enabled
0 = 禁用了内存优化的功能0 = memory-optimized features are disabled
适用范围:SQL ServerSQL Server(从 SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始)和 Azure SQL 数据库Azure SQL DatabaseApplies to: SQL ServerSQL Server (starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x)) and Azure SQL 数据库Azure SQL Database

权限Permissions

如果的调用方 sys.databases 不是数据库的所有者,并且数据库不是 master 或,则 tempdb 查看对应行所需的最小权限是 ALTER ANY DATABASEVIEW ANY DATABASE 数据库中的服务器级别权限或 CREATE DATABASE 权限 masterIf the caller of sys.databases is not the owner of the database and the database is not master or tempdb, the minimum permissions required to see the corresponding row are ALTER ANY DATABASE or the VIEW ANY DATABASE server-level permission, or CREATE DATABASE permission in the master database. 始终可以在中查看调用方连接到的数据库 sys.databasesThe database to which the caller is connected can always be viewed in sys.databases.

重要

默认情况下,公共角色具有 VIEW ANY DATABASE 权限,允许所有登录名查看数据库信息。By default, the public role has the VIEW ANY DATABASE permission, allowing all logins to see database information. 阻止登录名检测数据库、 REVOKE VIEW ANY DATABASE 权限 publicDENY VIEW ANY DATABASE 单个登录名的权限。To block a login from the ability to detect a database, REVOKE the VIEW ANY DATABASE permission from public, or DENY the VIEW ANY DATABASE permission for individual logins.

Azure SQL 数据库备注Azure SQL Database Remarks

Azure SQL 数据库Azure SQL Database 此视图中, master 数据库和用户数据库中提供了此视图。In Azure SQL 数据库Azure SQL Database this view is available in the master database and in user databases. master 数据库中,此视图返回 master 服务器上数据库和所有用户数据库的信息。In the master database, this view returns the information on the master database and all user databases on the server. 在用户数据库中,该视图仅返回有关当前数据库及 master 数据库的信息。In a user database, this view returns information only on the current database and the master database.

使用正在其中创建新数据库的 Azure SQL 数据库Azure SQL Database 服务器的 master 数据库中的 sys.databases 视图。Use the sys.databases view in the master database of the Azure SQL 数据库Azure SQL Database server where the new database is being created. 数据库复制开始后,你可以 sys.databases sys.dm_database_copies 从目标服务器的数据库中查询和视图, master 以检索有关复制进度的详细信息。After the database copy starts, you can query the sys.databases and the sys.dm_database_copies views from the master database of the destination server to retrieve more information about the copying progress.

示例Examples

A.A. 查询 sys.databases 视图Query the sys.databases view

下面的示例返回视图中可用的几个列 sys.databasesThe following example returns a few of the columns available in the sys.databases view.

SELECT name, user_access_desc, is_read_only, state_desc, recovery_model_desc  
FROM sys.databases;  

B.B. 检查 SQL 数据库SQL Database 中的复制状态Check the copying status in SQL 数据库SQL Database

下面的示例查询 sys.databasessys.dm_database_copies 视图以返回有关数据库复制操作的信息。The following example queries the sys.databases and sys.dm_database_copies views to return information about a database copy operation.

适用于:Azure SQL 数据库Azure SQL DatabaseApplies to: Azure SQL 数据库Azure SQL Database

-- Execute from the master database.  
SELECT a.name, a.state_desc, b.start_date, b.modify_date, b.percent_complete  
FROM sys.databases AS a  
INNER JOIN sys.dm_database_copies AS b ON a.database_id = b.database_id  
WHERE a.state = 7;  

C.C. 检查临时保留策略状态 SQL 数据库SQL DatabaseCheck the temporal retention policy status in SQL 数据库SQL Database

下面的示例将查询 sys.databases 以返回有关是否已启用时态保留清理任务的信息。The following example queries the sys.databases to return information whether temporal retention cleanup task is enabled. 请注意,还原操作后,默认情况下会禁用临时保留。Be aware that after restore operation temporal retention is disabled by default. 使用 ALTER DATABASE 显式启用它。Use ALTER DATABASE to enable it explicitly.

适用于:Azure SQL 数据库Azure SQL DatabaseApplies to: Azure SQL 数据库Azure SQL Database

-- Execute from the master database.  
SELECT a.name, a.is_temporal_history_retention_enabled 
FROM sys.databases AS a;

后续步骤Next steps