Use SQL statements to establish tracking issues

zhaozj2021-02-16  82

/ * - Below is the tracking of the Event Explosure I use with SQL, and the generated SQL script now has several questions: 1. This track does not generate data, with: select * from :: fn_trace_getinfo (1) can be seen The status is running, but C: /Test.TRC is always empty file

2. When setting the filter in the event detector, the ObjectType is the TYPE column corresponding to the sysobjects table. This column is a character pattern, but when I enter characters, the number is the number, from there? 3. If you only generate INSERT , update, delete statement successfully tracking events should be set? There is no related settings in the event detector, use the statement settings to find the event number 28, which occurs before executing the SELECT, INSERT, or UPDATE statement. 4. Establish an event detector Tracking, you can save the tracking result into the table, but the SQL script generated below does not support this feature - * /

/ ************************************************** *** // * Created by: SQL Profiler * // * Date: 2004/06/19 16:50:05 * // ****************************** ****************************** /

- Create a Queuedeclare @rc intDeclare @maxfilesize bigintset @maxfilesize = 5

. - Please replace the text InsertFileNameHere, with an appropriate-- filename prefixed by a path, eg, c: / MyFolder / MyTrace The .trc extension-- will be appended to the filename automatically If you are writing from-- remote. Server to Local Drive, Please Use UNC Path and make Sure Server Has - Write Access to your network share

Exec @rc = sp_trace_create @traceid outprut, 0, n'c: / test ', @maxfilesize, null if (@rc! = 0) GOTO Error

- Client Side File and Table Cannot Be Scripted

- Writing to a Table is Not Supported THROUGH THE SP'S

- set the eventsdeclare @on bitset @on = 1exec sp_trace_setevent @traceid, 12, 1, @ONEXEC sp_trace_sevent @TraceID, 12, 12, @ONEXEC sp_trace_setevent @traceid, 12, 14, @on

- set the filtersdeclare @intfilter intDeclare @Bigintfilter Bigint

Exec sp_trace_setfilter @traceid, 10, 0, 7, n'sql profiler'set @intfilter = 100exec sp_trace_setfilter @TRACEID, 22, 0, 4, @intfilter

Set @intfilter = 1exec sp_trace_setfilter @TraceID, 23, 1, 0, @intfilterexec sp_trace_setfilter @TraceId, 35, 1, 6, n'pubs'

- set the trace status to startexec sp_trace_setstatus @traceid, 1

- Display TRACE ID for Future ReferencesselectTrap = @ TRACEIDGOTO FINISH

Error: select errorcode = @ rc

FINISH: Go

转载请注明原文地址:https://www.9cbs.com/read-14564.html

New Post(0)