Set up SQL for tracking

Source: Internet
Author: User

1: Confirm the relevant parameter settings.

Keep track of your own code. If you can access the program's source code, it is easy to open its extended SQL Trace. You must first ensure that the Timed_statistics and max_dump_ file_size parameters of the session 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 kernel sends a value of 0 instead of a real duration to the trace file. If the Max_dump_ file_size is severely restricted, the following message is generated in the trace file, rather than the time data you want:

You can use show parameters timed_statistics to view his values.

2: If you are tracking yourself, use    alter session set Sql_trace = true;   If you are tracking other users, first query 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

Ten rows selected.

Then use exec dbms_system.set_sql_trace_in_session (7,284,true); 3: Stop tracking, remember to run after a period of time must stop tracking, corresponding 2 respectively: Alter session set   Sql_trace= false; or exec dbms_system.set_sql_trace_in_session (7,284,false);

4: Format TRC files generated files are 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.




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.