我想跟踪多个表上的插入更新和删除。我现在拥有的是
ALTER DATABASE AUDIT SPECIFICATION [mySpec]
ADD (INSERT ON OBJECT::[dbo].[SomeTable] BY [SomeUser]),
ADD (UPDATE ON OBJECT::[dbo].[SomeTable] BY [SomeUser]),
ADD (DELETE ON OBJECT::[dbo].[SomeTable] BY [SomeUser]),
... More Tables ..
WITH (STATE = ON);
是否有一组校长等于"任何用户"我可以使用而不是“SomeUser”#39;在我的剧本中?
答案 0 :(得分:1)
您可以使用public
群组
例如:
ALTER DATABASE AUDIT SPECIFICATION [mySpec]
ADD (INSERT ON OBJECT::[dbo].[SomeTable] BY [public])
...
或您所有用户所属的任何其他群组。
您还可以对要审核的事件进行分组,
ALTER DATABASE AUDIT SPECIFICATION [mySpec]
ADD (INSERT, UPDATE, DELETE ON OBJECT::[dbo].[SomeTable] BY [public])
...
如果要审核所有表,可以使用数据库对象
ALTER DATABASE AUDIT SPECIFICATION [mySpec]
ADD (INSERT, UPDATE, DELETE ON DATABASE::databasename BY [public])
...