SELECTREVERSE(SUBSTRING(REVERSE(path),CHARINDEX('\',REVERSE(path)),LEN(path)))+'log.trc'
FROM
sys.traces WHERE path LIKE '%\MSSQL\Log\log%.trc';
===========================================================
SELECT
* FROM ::fn_trace_getinfo(default)
EXEC
sp_trace_setstatus @traceid = 3, @status = 0; -- Stop/pause Trace
EXEC
sp_trace_setstatus @traceid = 3, @status = 2; -- Close trace and delete it from the
EXEC
sp_trace_setstatus @traceid = #, @status = 0; -- Stop/pause Trace
EXEC
sp_trace_setstatus @traceid = #, @status = 2; -- Close trace and delete it from the serv select
===============================
select
[Status] =
case
tr.[status]
when
1 THEN 'Running'
when
0 THEN 'Stopped'
end
,
[Default] =
case
tr.is_default
when
1 THEN 'System TRACE'
when
0 THEN 'User TRACE'
end
,
[login_name] = coalesce(se.login_name,se.login_name,'No reader spid')
,
[Trace Path] = coalesce(tr.[Path],tr.[Path],'OLE DB Client Side Trace')
from
sys.traces tr
left
join sys.dm_exec_sessions se on tr.reader_spid = se.session_id
FROM
sys.traces WHERE path LIKE '%\MSSQL\Log\log%.trc';
===========================================================
SELECT
* FROM ::fn_trace_getinfo(default)
EXEC
sp_trace_setstatus @traceid = 3, @status = 0; -- Stop/pause Trace
EXEC
sp_trace_setstatus @traceid = 3, @status = 2; -- Close trace and delete it from the
EXEC
sp_trace_setstatus @traceid = #, @status = 0; -- Stop/pause Trace
EXEC
sp_trace_setstatus @traceid = #, @status = 2; -- Close trace and delete it from the serv select
===============================
select
[Status] =
case
tr.[status]
when
1 THEN 'Running'
when
0 THEN 'Stopped'
end
,
[Default] =
case
tr.is_default
when
1 THEN 'System TRACE'
when
0 THEN 'User TRACE'
end
,
[login_name] = coalesce(se.login_name,se.login_name,'No reader spid')
,
[Trace Path] = coalesce(tr.[Path],tr.[Path],'OLE DB Client Side Trace')
from
sys.traces tr
left
join sys.dm_exec_sessions se on tr.reader_spid = se.session_id
No comments:
Post a Comment