1、创建SQL Server审计
USE master
GO
CREATE SERVER AUDIT ServerAudit
TO FILE (FILEPATH = ‘D:bakAudit’, MAXSIZE = 1 GB)–注意更改文件路径
WITH (ON_FAILURE = CONTINUE);
GO
2、创建服务器审计规范
USE slxsina
GO
CREATE DATABASE AUDIT SPECIFICATION product_nostandard FOR SERVER AUDIT ServerAudit
ADD(UPDATE,INSERT,DELETE ON dbo.product_nostandard by dbo)
GO
3、激活SQL Server审计
USE master
GO
ALTER SERVER AUDIT ServerAudit
WITH (STATE=ON)
4、查看审计数据
SELECT event_time ,
succeeded ,
server_principal_name ,
[object_name] ,
[statement]
FROM sys.fn_get_audit_file(‘D:bakAudit*’, NULL, NULL)
WHERE database_name = ‘slxsina’ ;