DROP SERVER AUDIT (Transact-SQL)DROP SERVER AUDIT (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

使用 SQL Server Audit 功能删除服务器审核对象。Drops a Server Audit Object using the SQL Server Audit feature. 有关 SQL Server Audit 的详细信息,请参阅 SQL Server Audit(数据库引擎)For more information on SQL Server Audit, see SQL Server Audit (Database Engine).

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

DROP SERVER AUDIT audit_name  
    [ ; ]  

备注

若要查看 SQL Server 2014 及更早版本的 Transact-SQL 语法,请参阅早期版本文档To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.

备注Remarks

为了对审核进行任何更改,必须将审核的状态设置为 OFF 选项。You must set the State of an audit to the OFF option in order to make any changes to an Audit. 使用 STATE=OFF 以外的任何选项启用审核时,如果执行 DROP AUDIT,您将接收到一条 MSG_NEED_AUDIT_DISABLED 错误消息。If DROP AUDIT is run while an audit is enabled with any options other than STATE=OFF, you will receive a MSG_NEED_AUDIT_DISABLED error message.

DROP SERVER AUDIT 删除审核的元数据,但不会删除发出该命令之前收集的审核数据。A DROP SERVER AUDIT removes the metadata for the Audit, but not the audit data that was collected before the command was issued.

DROP SERVER AUDIT 不删除关联的服务器或数据库审核规范。DROP SERVER AUDIT does not drop associated server or database audit specifications. 这些规范必须手动删除,或者保留为孤立状态,稍后再映射到新服务器审核。These specifications must be dropped manually or left orphaned and later mapped to a new server audit.

权限Permissions

若要创建、更改或删除服务器审核主体,需要拥有 ALTER ANY SERVER AUDIT 或 CONTROL SERVER 权限。To create, alter or drop a Server Audit Principals require the ALTER ANY SERVER AUDIT or the CONTROL SERVER permission.

示例Examples

下面的示例删除名为 HIPAA_Audit 的审核。The following example drops an audit called HIPAA_Audit.

ALTER SERVER AUDIT HIPAA_Audit  
STATE = OFF;  
GO  
DROP SERVER AUDIT HIPAA_Audit;  
GO  

另请参阅See Also

CREATE SERVER AUDIT (Transact-SQL) CREATE SERVER AUDIT (Transact-SQL)
ALTER SERVER AUDIT (Transact-SQL) ALTER 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 (Transact-SQL) sys.dm_server_audit_status (Transact-SQL)
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