sys.dm_server_audit_status (Transact-SQL)sys.dm_server_audit_status (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance

对于每次服务器审核返回一行,以指示该审核的当前状态。Returns a row for each server audit indicating the current state of the audit. 有关详细信息,请参阅 SQL Server Audit(数据库引擎)For more information, see SQL Server Audit (Database Engine).

列名称Column name 数据类型Data type 说明Description
audit_idaudit_id intint 审核的 ID。ID of the audit. 映射到sys.databases目录视图中的audit_id字段。Maps to the audit_id field in the sys.audits catalog view.
namename sysnamesysname 审核的名称。Name of the audit. server_audits sys.databases目录视图中的name字段相同。Same as the name field in the sys.server_audits catalog view.
statusstatus smallintsmallint 服务器审核的数值状态:Numeric status of the server audit:

0 = 未启动0 = Not Started

1 =1 =
StartedStarted

2 =2 =
运行时失败Runtime Fail

3 = 目标创建失败3 = Target Create Fail

4 = 正在关闭4 = Shutting Down
status_descstatus_desc nvarchar(256)nvarchar(256) 显示服务器审核状态的字符串:String that shows the status of the server audit:

NOT_STARTEDNOT_STARTED

STARTEDSTARTED

RUNTIME_FAILRUNTIME_FAIL

TARGET_CREATION_FAILEDTARGET_CREATION_FAILED

SHUTTING_DOWNSHUTTING_DOWN
status_timestatus_time datetime2datetime2 审核的最后状态更改的时间戳(UTC 格式)。Timestamp in UTC of the last status change for the audit.
event_session_addressevent_session_address varbinary(8)varbinary(8) 与审核关联的扩展事件会话的地址。Address of the Extended Events session associated with the audit. dm_xe_sessions sys.databases 目录视图相关的。Related to the sys.dm_xe_sessions.address catalog view.
audit_file_pathaudit_file_path nvarchar(256)nvarchar(256) 当前使用的审核文件目标的完整路径名和文件名。Full path and file name of the audit file target that is currently being used. 仅对文件审核填充。Only populated for file audits.
audit_file_sizeaudit_file_size bigintbigint 审核文件的近似大小(字节数)。Approximate size of the audit file, in bytes. 仅对文件审核填充。Only populated for file audits.

权限Permissions

主体必须具有 VIEW SERVER STATE 权限。Principals must have the VIEW SERVER STATE permission.

目录视图中仅显示用户拥有的安全对象的元数据,或用户对其拥有某些权限的安全对象的元数据。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. 有关详细信息,请参阅 Metadata Visibility ConfigurationFor more information, see Metadata Visibility Configuration.

另请参阅See Also

CREATE SERVER AUDIT (Transact-SQL) CREATE SERVER AUDIT (Transact-SQL)
ALTER SERVER AUDIT (Transact-SQL) ALTER SERVER AUDIT (Transact-SQL)
DROP SERVER AUDIT (Transact-SQL) DROP SERVER AUDIT (Transact-SQL)
CREATE SERVER AUDIT SPECIFICATION (Transact-SQL) CREATE SERVER AUDIT SPECIFICATION (Transact-SQL)
ALTER SERVER AUDIT SPECIFICATION (Transact-SQL) ALTER SERVER AUDIT SPECIFICATION (Transact-SQL)
DROP SERVER AUDIT SPECIFICATION (Transact-SQL) DROP SERVER AUDIT SPECIFICATION (Transact-SQL)
CREATE DATABASE AUDIT SPECIFICATION (Transact-SQL) CREATE DATABASE AUDIT SPECIFICATION (Transact-SQL)
ALTER DATABASE AUDIT SPECIFICATION (Transact-SQL) ALTER DATABASE AUDIT SPECIFICATION (Transact-SQL)
DROP DATABASE AUDIT SPECIFICATION (Transact-SQL) DROP DATABASE AUDIT SPECIFICATION (Transact-SQL)
ALTER AUTHORIZATION (Transact-SQL) ALTER AUTHORIZATION (Transact-SQL)
sys.fn_get_audit_file (Transact-SQL) sys.fn_get_audit_file (Transact-SQL)
sys.server_audits (Transact-SQL) sys.server_audits (Transact-SQL)
sys.server_file_audits (Transact-SQL) sys.server_file_audits (Transact-SQL)
sys.server_audit_specifications (Transact-SQL) sys.server_audit_specifications (Transact-SQL)
sys.server_audit_specification_details (Transact-SQL) sys.server_audit_specification_details (Transact-SQL)
sys.database_audit_specifications (Transact-SQL) sys.database_audit_specifications (Transact-SQL)
sys.database_audit_specification_details (Transact-SQL) sys.database_audit_specification_details (Transact-SQL)
sys. dm_server_audit_status sys.dm_server_audit_status
sys.dm_audit_actions (Transact-SQL) sys.dm_audit_actions (Transact-SQL)
sys.dm_audit_class_type_map (Transact-SQL) sys.dm_audit_class_type_map (Transact-SQL)
创建服务器审核和服务器审核规范Create a Server Audit and Server Audit Specification