Create a server audit & database audit specification - SQL Server (2024)

  • Article

Applies to: Create a server audit & database audit specification - SQL Server (1) SQL Server

This article describes how to create a server audit and a database audit specification in SQL Server by using SQL Server Management Studio or Transact-SQL.

Auditing an instance of SQL Server or a SQL Server database involves tracking and logging events that occur on the system. The SQL Server Audit object collects a single instance of server-level or database-level actions and groups of actions to monitor. The audit is at the SQL Server instance level. You can have multiple audits per SQL Server instance. The Database-Level Audit Specification object belongs to an audit. You can create one database audit specification per SQL Server database per audit. For more information, see SQL Server Audit (Database Engine).

Limitations

Database audit specifications are non-securable objects that reside in a given database. When a database audit specification is created, it's in a disabled state.

When you're creating or modifying a database audit specification in a user database, don't include audit actions on server-scope objects, like the system views. If you include server-scoped objects, the audit is created. But the server-scoped objects aren't included, and no error is returned. To audit server-scoped objects, use a database audit specification in the master database.

Database audit specifications reside in the database where they're created, except for the tempdb system database.

Permissions

Use SQL Server Management Studio

Create a server audit

  1. In Object Explorer, expand the Security folder.

  2. Right-click the Audits folder and select New Audit. For more information, see Create a Server Audit and Server Audit Specification.

  3. When you finish selecting options, select OK.

Create a database-level audit specification

  1. In Object Explorer, expand the database where you want to create the audit specification.

  2. Expand the Security folder.

  3. Right-click the Database Audit Specifications folder and select New Database Audit Specification.

    These options are available in the Create Database Audit Specification dialog box:

    Name

    The name of the database audit specification. A name is generated automatically when you create a server audit specification. The name is editable.

    Audit

    The name of an existing server audit object. Either type in the name of the audit or select it from the list.

    Audit Action Type

    Specifies the database-level audit action groups and audit actions to capture. For a list of database-level audit action groups and audit actions and descriptions of the events they contain, see SQL Server Audit Action Groups and Actions.

    Object Schema

    Displays the schema for the specified Object Name.

    Object Name

    The name of the object to audit. This option is available only for audit actions. It doesn't apply to audit groups.

    Ellipsis (...)

    Opens the Select Objects dialog box so you can browse for and select an available object, based on the specified Audit Action Type.

    Principal Name

    The account to filter the audit by for the object being audited.

    Ellipsis (...)

    Opens the Select Objects dialog box so you can browse for and select an available object, based on the specified Object Name.

  4. When you finish selecting options, select OK.

Use Transact-SQL

Create a server audit

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, select New Query.

  3. Paste the following example into the query window and then select Execute.

    USE master;GO-- Create the server audit.CREATE SERVER AUDIT Payroll_Security_Audit TO FILE (FILEPATH = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA');GO-- Enable the server audit.ALTER SERVER AUDIT Payroll_Security_AuditWITH (STATE = ON);

Create a database-level audit specification

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, select New Query.

  3. Paste the following example into the query window and then select Execute. This example creates a database audit specification called Audit_Pay_Tables. It audits SELECT and INSERT statements by the dbo user for the HumanResources.EmployeePayHistory table, based on the server audit defined in the previous section.

    USE AdventureWorks2022;GO-- Create the database audit specification.CREATE DATABASE AUDIT SPECIFICATION Audit_Pay_TablesFOR SERVER AUDIT Payroll_Security_Audit ADD ( SELECT, INSERT ON HumanResources.EmployeePayHistory BY dbo)WITH (STATE = ON);GO

Related content

  • CREATE SERVER AUDIT (Transact-SQL)
  • CREATE DATABASE AUDIT SPECIFICATION (Transact-SQL)
Create a server audit & database audit specification - SQL Server (2024)
Top Articles
WWE Money In The Bank 2024: How To Watch, Start Times, Match Card, Everything To Know
Decrypt SSL with Wireshark - HTTPS Decryption: Step-by-Step Guide
Kostner Wingback Bed
Truist Bank Near Here
What is Mercantilism?
Dew Acuity
Toyota Campers For Sale Craigslist
Dr Lisa Jones Dvm Married
Stolen Touches Neva Altaj Read Online Free
How to Watch Braves vs. Dodgers: TV Channel & Live Stream - September 15
CSC error CS0006: Metadata file 'SonarAnalyzer.dll' could not be found
Publix 147 Coral Way
Midway Antique Mall Consignor Access
Syracuse Jr High Home Page
Slushy Beer Strain
U/Apprenhensive_You8924
Who called you from 6466062860 (+16466062860) ?
I Touch and Day Spa II
Suffix With Pent Crossword Clue
Nail Salon Goodman Plaza
Iu Spring Break 2024
Aes Salt Lake City Showdown
Valic Eremit
Southland Goldendoodles
Elbert County Swap Shop
Essence Healthcare Otc 2023 Catalog
Synergy Grand Rapids Public Schools
Kirk Franklin Mother Debra Jones Age
Pioneer Library Overdrive
Criterion Dryer Review
Mta Bus Forums
Evil Dead Rise Showtimes Near Regal Sawgrass & Imax
Our Leadership
ATM, 3813 N Woodlawn Blvd, Wichita, KS 67220, US - MapQuest
Mercedes W204 Belt Diagram
Franklin Villafuerte Osorio
Bad Business Private Server Commands
Kattis-Solutions
new haven free stuff - craigslist
Myfxbook Historical Data
About :: Town Of Saugerties
MSD Animal Health Hub: Nobivac® Rabies Q & A
Dee Dee Blanchard Crime Scene Photos
Directions To Cvs Pharmacy
[Teen Titans] Starfire In Heat - Chapter 1 - Umbrelloid - Teen Titans
Avance Primary Care Morrisville
Borat: An Iconic Character Who Became More than Just a Film
Gli italiani buttano sempre più cibo, quasi 7 etti a settimana (a testa)
UNC Charlotte Admission Requirements
10 Bedroom Airbnb Kissimmee Fl
Arnold Swansinger Family
Latest Posts
Article information

Author: Prof. Nancy Dach

Last Updated:

Views: 6081

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Prof. Nancy Dach

Birthday: 1993-08-23

Address: 569 Waelchi Ports, South Blainebury, LA 11589

Phone: +9958996486049

Job: Sales Manager

Hobby: Web surfing, Scuba diving, Mountaineering, Writing, Sailing, Dance, Blacksmithing

Introduction: My name is Prof. Nancy Dach, I am a lively, joyous, courageous, lovely, tender, charming, open person who loves writing and wants to share my knowledge and understanding with you.