Export (0) Print
Expand All
Expand Minimize

ALTER DATABASE AUDIT SPECIFICATION (Transact-SQL)

Alters a database audit specification object using the SQL Server Audit feature. For more information, see SQL Server Audit (Database Engine).

Topic link icon Transact-SQL Syntax Conventions

ALTER DATABASE AUDIT SPECIFICATION audit_specification_name
{
    [ FOR SERVER AUDIT audit_name ]
    [ { { ADD | DROP } ( 
           { <audit_action_specification> | audit_action_group_name } 
                ) 
      } [, ...n] ]
    [ WITH ( STATE = { ON | OFF } ) ]
}
[ ; ]
<audit_action_specification>::=
{
      <action_specification>[ ,...n ]ON [ class :: ] securable 
     BY principal [ ,...n ] 
}

audit_specification_name

The name of the audit specification.

audit_name

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

audit_action_specification

Name of one or more database-level auditable actions. For a list of audit action groups, see SQL Server Audit Action Groups and Actions.

audit_action_group_name

Name of one or more groups of database-level auditable actions. For a list of audit action groups, see SQL Server Audit Action Groups and Actions.

class

Class name (if applicable) on the securable.

securable

Table, view, or other securable object in the database on which to apply the audit action or audit action group. For more information, see Securables.

column

Column name (if applicable) on the securable.

principal

Name of SQL Server principal on which to apply the audit action or audit action group. For more information, see Principals (Database Engine).

WITH ( STATE = { ON | OFF } )

Enables or disables the audit from collecting records for this audit specification. Audit specification state changes must be done outside a user transaction and may not have other changes in the same statement when the transition is ON to OFF.

Database audit specifications are non-securable objects that reside in a given database. You must set the state of an audit specification to the OFF option in order to make changes to a database audit specification. If ALTER DATABASE AUDIT SPECIFICATION is executed when an audit is enabled with any options other than STATE=OFF, you will receive an error message. For more information, see tempdb Database.

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

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

The following example alters a database audit specification called HIPPA_Audit_DB_Specification that audits the SELECT statements by the dbo user, for a SQL Server audit called HIPPA_Audit.

ALTER DATABASE AUDIT SPECIFICATION HIPPA_Audit_DB_Specification
FOR SERVER AUDIT HIPPA_Audit
    ADD (SELECT
         ON OBJECT::dbo.Table1
         BY dbo)
    WITH (STATE = ON);
GO

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

Updated content

Corrected the Permissions section.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft