Just wondering if there a log/audit table for holding info like which users have created/changed/deleted keys or indexes etc?
只是想知道是否有一个日志/审计表来保存信息,比如哪些用户创建/更改/删除了密钥或索引等?
1 个解决方案
#1
1
The default trace captures DDL changes. Below is an example to glean some of this information.
默认跟踪捕获DDL更改。下面是一个收集这些信息的例子。
--Object:Created and Object:Altered events from default trace
SELECT
te.name AS EventName
,tt.StartTime as st
,tt.DatabaseName
,tt.ObjectName
FROM sys.traces AS t
CROSS APPLY [fn_trace_gettable](t.path, DEFAULT) AS tt
JOIN sys.trace_events AS te ON
te.trace_event_id = tt.EventClass
WHERE
tt.EventClass in (46,164)
AND tt.EventSubClass = 0
ORDER BY st DESC;
#1
1
The default trace captures DDL changes. Below is an example to glean some of this information.
默认跟踪捕获DDL更改。下面是一个收集这些信息的例子。
--Object:Created and Object:Altered events from default trace
SELECT
te.name AS EventName
,tt.StartTime as st
,tt.DatabaseName
,tt.ObjectName
FROM sys.traces AS t
CROSS APPLY [fn_trace_gettable](t.path, DEFAULT) AS tt
JOIN sys.trace_events AS te ON
te.trace_event_id = tt.EventClass
WHERE
tt.EventClass in (46,164)
AND tt.EventSubClass = 0
ORDER BY st DESC;