Skip to main content

Posts

Showing posts from September, 2021

SQL mail profile

  select * from msdb.dbo.sysmail_profile p join msdb.dbo.sysmail_profileaccount pa on p.profile_id = pa.profile_id   join msdb.dbo.sysmail_account a on pa.account_id = a.account_id       join msdb.dbo.sysmail_server s on a.account_id = s.account_id

SQL trace log

  DECLARE @tracefile VARCHAR(500)  -- Get path of default trace file  SELECT @tracefile = CAST(value AS VARCHAR(500))  FROM ::fn_trace_getinfo(DEFAULT)  WHERE traceid = 1  AND property = 2  -- Get security changes from the default trace  SELECT *  FROM ::fn_trace_gettable(@tracefile, DEFAULT) trcdata -- DEFAULT means all trace files will be read  INNER JOIN sys.trace_events evt ON trcdata.EventClass = evt.trace_event_id  WHERE trcdata.EventClass IN (102, 103, 104, 105, 106, 108, 109, 110, 111)  and trcdata.DatabaseName = 'CRDM'  ORDER BY trcdata.StartTime