Set SQL for tracking

zhaozj2021-02-16  51

1: Confirm the relevant parameter settings.

Track your own code. If you can access the source code of the program, it is very easy to open it to extend SQL tracking. First, you must ensure that the TIMED_STATISTICS and MAX_DUMP_ FILE_SIZE parameter settings are set correctly:

Alter session set timed_statistics = truealter session set max_dump_file_size = unlimited

If timed_statistics = true is not set, the database core will send 0 values ​​to the tracking file. If you have a restriction on Max_Dump_ file_size, you will generate the following message in the trace file, not the time data you want:

You can use Show Parameters Timed_Statistics; to view his value.

2: If you are track yourself, use the alter session set sql_trace = true; if you are tracking other users, first query the V $ SESSION view, get process information: Select SID, Serial #, UserName from V $ session; sid serial # username ---------- ---------------------------------------------------------------------------------------------------------------- 1 1 2 1 3 1 4 1 5 1 6 1 7 284 iflow 11 214 iflow 12 164 SYS 16 1042 iflow

10 rows selected.

Then exec dbms_system.set_sql_trace_in_session (7,284, true); track .3: stop tracking, after a period of operation must remember to stop the tracking, the corresponding 2 were used: alter session set sql_trace = false; or the exec dbms_system.set_sql_trace_in_session (7,284 False;

4: Formatting the file generated by the TRC file is placed in the UDUMP directory, you can use TKPROF to view C: /> TKPROF D: /Oracle9/Admin/nbxtdb/udump/nbxtdb_ora_1912.trc 13.txt sys = no explain = test / test Then you can view the text file for analysis.

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

New Post(0)