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 );