防止SQLSERVER的事件探查器跟蹤軟件
發(fā)布日期:2022-01-30 19:57 | 文章來源:CSDN
第一種方法:
復(fù)制代碼 代碼如下:
procedure SQLCloseAllTrack;
const
sql = 'declare @TID integer ' +
'declare Trac Cursor For ' +
'SELECT Distinct Traceid FROM :: fn_trace_getinfo(default) ' +
'open Trac ' +
'Fetch Next From Trac into @TID ' +
'while @@fetch_status=0 ' +
'begin ' +
' exec sp_trace_setstatus @TID,0 ' +
' exec sp_trace_setstatus @TID,2 ' +
' Fetch Next From Trac into @TID ' +
'end ' +
'Close Trac ' +
'deallocate Trac';
begin
//停止所有SQLSERVER的跟蹤器,以防止程序被別人跟蹤
ExecSql(sql);
end;
第二種方法:
復(fù)制代碼 代碼如下:
with faq1 do
begin
Close;
sql.Clear;
sql.add('declare @t_count int');
sql.add('set @t_count=1');
sql.add('while exists(SELECT * FROM ::::fn_trace_geteventinfo(@t_count))');
sql.add('begin');
sql.add('exec sp_trace_setstatus @t_count,0');
sql.add('set @t_count=@t_count+1');
sql.add('end');
try
execSQL;
except;
end;
close;sql.Clear;
end;
end;
版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章