메뉴 건너뛰기

Korea Oracle User Group

Guru's Articles

How do I capture a 10053 trace for a SQL statement called in a PL/SQL package?

Traditionally if you wanted to capture an Optimizer trace (10053) for a SQL statement you would issue an alter session command to switch on a 10053 trace for that entire session, and then issue the SQL statement you wanted to capture the trace for. Once the statement completed you would exit the session to disable the trace. You would then look in theUSER_DUMP_DEST directory for the trace file.


But what if the SQL statement you were interested  in was actually called as part of a PL/SQL package? Oracle Database 11g, introduced a new diagnostic events infrastructure, which greatly simplifies the task of generating a 10053 trace for a specific SQL statement in a PL/SQL package. All you will need to know is the SQL_ID for the statement you are interested in. Instead of turning on the trace event for the entire session you can now switch it on for a specific SQL ID. Oracle will then capture a 10053 trace for the corresponding SQL statement when it is issued in that session. Remember the SQL statement still has to be hard parsed for the 10053 trace to be generated.  Let's begin our example by creating a PL/SQL package called 'cal_total_sales'.



The SQL statement we are interested in is the same as the one in our original example, SELECT SUM(AMOUNT_SOLD) FROM SALES WHERE CUST_ID = :B1. We need to know the SQL_ID of this SQL statement to set up the trace, and we can find in V$SQL.


We now have everything we need to generate the trace.


Finally  you would look in the USER_DUMP_DEST directory for the trace file with the name you specified.

 

출처 : https://blogs.oracle.com/optimizer/entry/how_do_i_capture_a

번호 제목 글쓴이 날짜 조회 수
공지 Guru's Article 게시판 용도 ecrossoug 2015.11.18 605
43 Troubleshooting Another Complex Performance Issue – Oracle direct path inserts and SEG$ contention file ecrossoug 2015.11.16 99
42 Brief about Workload Management in Oracle RAC file ecrossoug 2015.11.18 512
41 NOUG Session: How Cache Fusion Works file ecrossoug 2015.11.18 136
40 How many checkpoints in Oracle database ? [1] file 명품관 2015.11.20 283
39 Parallel Execution 12c New Features Overview file 명품관 2015.11.23 110
38 On Invokers and Outs file 명품관 2015.11.23 102
37 Top 5 SQL Monitor Features file 명품관 2015.12.01 779
36 Oracle Enterprise Manager Cloud Control 13c Release 1 (13.1.0.0) Installation on Oracle Linux 6 and 7 명품관 2015.12.23 200
35 Oracle 12c SQL – Using JSON 명품관 2015.12.29 2576
34 Upgrade a Pluggable Database in Oracle 12c 명품관 2015.12.30 170
33 (유투브) KISS series on Analytics: Dealing with null - Connor McDonald 명품관 2016.01.05 155
» How do I capture a 10053 trace for a SQL statement called in a PL/SQL package? 명품관 2016.01.06 263
31 Why You Can Get ORA-00942 Errors with Flashback Query 명품관 2016.02.01 448
30 What is an In-Memory Compression Unit (IMCU)? 명품관 2016.02.24 181
29 Hybrid Columnar Compression Common Questions 명품관 2016.03.04 191
28 Parameter Recommendations for Oracle Database 12c - Part I 명품관 2016.03.07 836
27 Parameter Recommendations for Oracle Database 12c - Part II 명품관 2016.03.18 353
26 Oracle Linux 6.7 with Oracle 11.2.0.4 RAC 명품관 2016.04.15 9658
25 Quick tip on Function Based Indexes 명품관 2016.04.19 191
위로