SELECT * FROM sys.configurations WHERE configuration_id = 1568 --(check if trace option is set)
SELECT * FROM ::fn_trace_getinfo(0)
SELECT loginname, loginsid, spid, hostname, applicationname, servername, databasename, objectName,
e.category_id, cat.name AS [CategoryName], textdata, starttime, eventclass, eventsubclass,
--0=begin,1=commit e.name AS EventName FROM
::fn_trace_gettable('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log.trc',0)
INNER JOIN sys.trace_events e ON eventclass = trace_event_id INNER JOIN
sys.trace_categories AS cat ON e.category_id = cat.category_id WHERE
databasename = 'db' AND objectname IS NULL AND --filter by objectname
e.category_id = 5 AND
--category 5 is objects
e.trace_event_id = 46 --trace_event_id: 46=Create Obj,47=Drop Obj,164=Alter Obj
SELECT * FROM ::fn_trace_gettable('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log.trc',0)
No comments:
Post a Comment