Prevents SQL Server event probe tracking software

Source: Internet
Author: User

The two methods work in the same way.
Method 1: Copy codeThe Code is as follows: procedure SQLCloseAllTrack;
Const
SQL = 'Clare @ TID integer '+
'Descare 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' +
'Destlocate trac ';
Begin
// Stop all trackers to prevent programs from being tracked by others
ExecSql (SQL );
End;

Method 2:Copy codeThe Code is as follows: with faq1 do
Begin
Close;
SQL. Clear;
SQL. add ('Clare @ 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;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.