Default Trace 查找日志文件快速增长的原因

select
  loginname,
  loginsid,
  spid,
  hostname,
  applicationname,
  servername,
  databasename,
  objectname,
  e.category_id,
  cat.name,
  textdata,
  starttime,
  endtime,
  duration,
  eventclass,
  eventsubclass,
  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 = 'TraceDB' and
      e.category_id = 2 and --categroy 2表示database
      e.trace_event_id = 93 --93表示日志文件自动增长事件

 

posted @ 2019-11-02 09:37  VicLW  阅读(185)  评论(0编辑  收藏  举报