--In the master database create a server audit
USE master
GO
CREATE SERVER AUDIT [Audit_Select_HumanResources_Employee]
TO FILE
( FILEPATH = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup'
,MAXSIZE = 0 MB
,MAX_ROLLOVER_FILES = 2147483647
,RESERVE_DISK_SPACE = OFF)
WITH
(QUEUE_DELAY = 1000, state= on)
ALTER SERVER AUDIT Audit_Select_HumanResources_Employee
WITH (STATE = ON) ;
GO
--In the database to monitor create a database audit
USE [AdventureWorks2012]
go
CREATE DATABASE AUDIT SPECIFICATION [Database-Audit]
FOR SERVER AUDIT [Audit_Select_HumanResources_Employee]
--In this example, we are monitoring the humanResources.employee
ADD (SELECT ON OBJECT::[HumanResources].[Employee] BY [dbo])
with (state=on)
--Now you can see the activity in the audit file created
SELECT * FROM sys.fn_get_audit_file ('c:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\Audit_Select_HumanResources_Employee.sqlaudit',default,default);
GO
Acabo de agregar un código para usted. El código crea una auditoría de servidor, una auditoría de base de datos para actividades seleccionadas y, finalmente, el archivo sys.fn_get_audit_file se usa para recuperar la información del archivo. Tienes que hacer eso individualmente para cada mesa. Si desea una consulta más automatizada, puede usar otras herramientas como Apex SQL Audit u otra herramienta de terceros de su preferencia.
También estaba investigando la auditoría de SQL Server 2008, pero desafortunadamente ahora estoy tratando con SQL Server 2005. Me pregunto si puedo crear un enlace al servidor de producción (2005) desde un servidor de desarrollo (2008) y luego usar la auditoría. – Sung
Además, es solo Enterprise. – Oliver