liveBook · Manning

Database audit specification

As explained in 100 SQL Server Mistakes and How to Avoid Them

A database audit specification is a SQL Server database-level object that defines actions to record within a database through an audit.

A database audit specification defines which activities to record inside one database and attaches those rules to an audit object. It supports fine-grained auditing, down to SELECT statements, unlike instance-focused auditing. section 14.5

Mistake: enabling every available action type. Auditing unnecessary low-level events can affect performance on a busy server, so reserve detailed database auditing for compliance requirements or specific investigations. section 14.5

Apply these rules when planning database-level auditing:

  • Create a separate database audit specification in each database that requires coverage. section 14.5
  • Select only the action types required by the compliance need or investigation, then review the performance impact. section 14.5
  • Pair database-level coverage with instance-level auditing when administrative activity and nonrepudiation matter. section 14.5
Table 14.2 Audit action types (view table figure)

Audit action type

Description

AUDIT_CHANGE_GROUP

The event is raised when an audit is created, dropped, or altered. Adding this will ensure nonrepudiation if an administrative user tries to shut down an audit, perform a nefarious activity, and then reenable it.

DBCC_GROUP

The event is raised when a DBCC statement is run.

SERVER_OBJECT_CHANGE_GROUP

The event is raised when an instance-level object is created, dropped, or altered.

SERVER_OBJECT_PERMISSION_CHANGE_GROUP

The event is raised when permissions are assigned to or revoked from a schema-bound object.

SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP

The event is raised when the owner of an instance-level object is changed.

SERVER_OPERATION_GROUP

The event is raised when instance configuration changes are made.

SERVER_PERMISSION_CHANGE_GROUP

The event is raised when permissions are assigned to or revoked from instance-level permissions.

SERVER_PRINCIPAL_CHANGE_GROUP

The event is fired when instance-level principals are created, dropped, or altered.

SERVER_PRINCIPAL_IMPERSONATION_GROUP

The event is raised when impersonation of an instance-level principal occurs.

SERVER_ROLE_MEMBER_CHANGE_GROUP

The event is raised when the membership of a server role is changed.

SERVER_STATE_CHANGE_GROUP

The event is raised when the state of the instance is modified.

Use the audit action-type reference to identify the events appropriate for the required auditing scope. section 14.5

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Descends to fine-grained activity such as SELECT statements, but does not provide the complete action-type list or database creation syntax.
Examples
Uses per-database specifications, SELECT auditing, and broad action categories such as DBCC and permission changes.
What you can do after
Evaluate/understand which database events require auditing and avoid unnecessary event collection that can affect performance.
How it connects
Connects database audit specifications to audit objects, server audit specifications, administrative activity, and compliance requirements.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.