Skip to content

Latest commit

 

History

History
100 lines (82 loc) · 6.07 KB

alter-server-audit-specification-transact-sql.md

File metadata and controls

100 lines (82 loc) · 6.07 KB
title ms.custom ms.date ms.prod ms.prod_service ms.reviewer ms.technology ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid author ms.author
ALTER SERVER AUDIT SPECIFICATION (Transact-SQL) | Microsoft Docs
05/01/2017
sql
sql-database
t-sql
language-reference
ALTER SERVER AUDIT SPECIFICATION
ALTER_SERVER_AUDIT_SPECIFICATION_TSQL
TSQL
server audit [SQL Server]
audits [SQL Server], specification
ALTER SERVER AUDIT SPECIFICATION statement
9cac288b-940e-4c16-88d6-de06aeed2b47
VanMSFT
vanto

ALTER SERVER AUDIT SPECIFICATION (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-asdbmi-xxxx-xxx-md]

Alters a server audit specification object using the [!INCLUDEssNoVersion] Audit feature. For more information, see SQL Server Audit (Database Engine).

Topic link icon Transact-SQL Syntax Conventions

Syntax

ALTER SERVER AUDIT SPECIFICATION audit_specification_name  
{  
    [ FOR SERVER AUDIT audit_name ]  
    [ { { ADD | DROP } ( audit_action_group_name )  
      } [, ...n] ]  
    [ WITH ( STATE = { ON | OFF } ) ]  
}  
[ ; ]  

Arguments

audit_specification_name
The name of the audit specification.

audit_name
The name of the audit to which this specification is applied.

audit_action_group_name
Name of a group of server-level auditable actions. For a list of Audit Action Groups, see SQL Server Audit Action Groups and Actions.

WITH ( STATE = { ON | OFF } )
Enables or disables the audit from collecting records for this audit specification.

Remarks

You must set the state of an audit specification to the OFF option to make changes to an audit specification. If ALTER SERVER AUDIT SPECIFICATION is executed when an audit specification is enabled with any options other than STATE=OFF, you will receive an error message.

Permissions

Users with the ALTER ANY SERVER AUDIT permission can alter server audit specifications and bind them to any audit.

After a server audit specification is created, it can be viewed by principals with the CONTROL SERVER, or ALTER ANY SERVER AUDIT permissions, the sysadmin account, or principals having explicit access to the audit.

Examples

The following example creates a server audit specification called HIPAA_Audit_Specification. It drops the audit action group for failed logins, and adds an audit action group for Database Object Access for a [!INCLUDEssNoVersion] audit called HIPAA_Audit.

ALTER SERVER AUDIT SPECIFICATION HIPAA_Audit_Specification  
FOR SERVER AUDIT HIPAA_Audit  
    DROP (FAILED_LOGIN_GROUP),  
    ADD (DATABASE_OBJECT_ACCESS_GROUP)  
    WITH (STATE=ON);  
GO  

For a full example about how to create an audit, see SQL Server Audit (Database Engine).

See Also

CREATE SERVER AUDIT (Transact-SQL)
ALTER SERVER AUDIT (Transact-SQL)
DROP SERVER AUDIT (Transact-SQL)
CREATE SERVER AUDIT SPECIFICATION (Transact-SQL)
DROP SERVER AUDIT SPECIFICATION (Transact-SQL)
CREATE DATABASE AUDIT SPECIFICATION (Transact-SQL)
ALTER DATABASE AUDIT SPECIFICATION (Transact-SQL)
DROP DATABASE AUDIT SPECIFICATION (Transact-SQL)
ALTER AUTHORIZATION (Transact-SQL)
sys.fn_get_audit_file (Transact-SQL)
sys.server_audits (Transact-SQL)
sys.server_file_audits (Transact-SQL)
sys.server_audit_specifications (Transact-SQL)
sys.server_audit_specification_details (Transact-SQL)
sys.database_audit_specifications (Transact-SQL)
sys.database_audit_specification_details (Transact-SQL)
sys.dm_server_audit_status (Transact-SQL)
sys.dm_audit_actions (Transact-SQL)
Create a Server Audit and Server Audit Specification