Oracle TRACE acquisition method

Source: Internet
Author: User

1. Obtain the TRACE method from the SESSION.
SQL code
// Get started
Alter session set TIMED_STATISTICS = TRUE;
Alter session set SQL _TRACE = TRUE;
// SQL Execution
..............................
..............................
// End of Acquisition
Alter session set TIMED_STATISTICS = FALSE;
Alter session set SQL _TRACE = FALSE;
// Obtain the result
D: \ Oracle \ product \ 10.2.0 \ admin \ orcl \ udump \ orcl_ora_360.trc
TKPROF orcl_ora_360.trc report.txt

2. Specify the TRACE acquisition method for the user's specified SESSION.
SQL code
// Locate the SID and SERIAL to be detected
Select sid, STATUS,
SUBSTR (USERNAME, 1, 8) USERNAME,
SUBSTR (SCHEMANAME, 1, 8) SCHEMANAME,
SUBSTR (OSUSER, 1, 16) OSUSER,
SUBSTR (MACHINE, 1, 16) MACHINE,
SUBSTR (PROGRAM, 1, 16) PROGRAM,
SERIAL #
From v $ SESSION
WHERE USERNAME IS NOT NULL
Order by sid;
// Get started
EXEC DBMS_SYSTEM.SET_ SQL _TRACE_IN_SESSION (157,262, TRUE );
// SQL Execution
....................................
....................................
// The result is obtained.
EXEC DBMS_SYSTEM.SET_ SQL _TRACE_IN_SESSION (157,262, FALSE );

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.