{"id":478,"date":"2021-05-02T12:28:00","date_gmt":"2021-05-02T10:28:00","guid":{"rendered":"https:\/\/jal-bs.de\/blog\/?p=478"},"modified":"2021-04-20T12:32:45","modified_gmt":"2021-04-20T10:32:45","slug":"oracle-tkprof-option-pdbtrace","status":"publish","type":"post","link":"https:\/\/jal-bs.de\/blog\/?p=478","title":{"rendered":"Oracle tkprof &#8211; option pdbtrace"},"content":{"rendered":"\n<p>Eine wenig bekannte aber interessante Option des TKPROFs ist &#8222;pdbtrace&#8220;.<\/p>\n\n\n\n<p>tkprof kann so die formatierte Ausgabe erzeugen ohne direkt Zugriff auf die Trace-Files auf Fileebene des Datenbank-Servers zu haben.<\/p>\n\n\n\n<p><code>select value from v$diag_info where name='Diag Trace';<\/code><\/p>\n\n\n\n<p>&#8211;&gt; Trace-Directory ermittlen<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><code>tkprof &lt;input_tracefile&gt; &lt;output_textfile&gt; &lt;options&gt; pdbtrace=&lt;DB-user&gt;&lt;password&gt;\/@ora_connectstring<\/code><\/p>\n\n\n\n<p>Beispiel:<\/p>\n\n\n\n<p><code>ALTER SESSION SET TRACEFILE_IDENTIFIER = 'my_trace_id';<\/code><\/p>\n\n\n\n<p><code>EXEC DBMS_SESSION.SET_SQL_TRACE(sql_trace =&gt; true)<\/code>;<\/p>\n\n\n\n<p><code>select user from dual;<\/code><\/p>\n\n\n\n<p><code>EXEC DBMS_SESSION.SET_SQL_TRACE(sql_trace =&gt; false);<\/code><\/p>\n\n\n\n<p><code>tkprof ..._my_trace_id.trc \/tmp\/tkprof_output.txt pdbtrace=...<\/code><\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<p class=\"has-small-font-size\"><strong>[]$ more \/tmp\/tkprof_output.txt<\/strong><\/p>\n\n\n\n<p class=\"has-small-font-size\">TKPROF: Release 19.0.0.0.0 &#8211; Development on Tue Apr 20 12:09:42 2021<\/p>\n\n\n\n<p class=\"has-small-font-size\">Copyright (c) 1982, 2019, Oracle and\/or its affiliates. All rights reserved.<\/p>\n\n\n\n<p class=\"has-small-font-size\">Trace file: CDB1_ora_11507_my_trace_id.trc<br>Sort options: default<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-small-font-size\">count = number of times OCI procedure was executed<br>cpu = cpu time in seconds executing<br>elapsed = elapsed time in seconds executing<br>disk = number of physical reads of buffers from disk<br>query = number of buffers gotten for consistent read<br>current = number of buffers gotten in current mode (usually for update)<br>rows = number of rows processed by the fetch or execute call<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-small-font-size\">SQL ID: 0g5n01r51t3f1 Plan Hash: 0<\/p>\n\n\n\n<p class=\"has-small-font-size\">BEGIN DBMS_SESSION.SET_SQL_TRACE(sql_trace =&gt; true); END;<\/p>\n\n\n\n<p class=\"has-small-font-size\">call count cpu elapsed disk query current rows<br>&#8212;&#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br>Parse 0 0.00 0.00 0 0 0 0<br>Execute 1 0.00 0.00 2 184 0 1<br>Fetch 0 0.00 0.00 0 0 0 0<br>&#8212;&#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br>total 1 0.00 0.00 2 184 0 1<\/p>\n\n\n\n<p class=\"has-small-font-size\">Misses in library cache during parse: 0<br>Misses in library cache during execute: 1<br>Optimizer mode: ALL_ROWS<br>Parsing user id: SYS<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-small-font-size\">SQL ID: ahc9t761kxw30 Plan Hash: 1388734953<\/p>\n\n\n\n<p class=\"has-small-font-size\">select user<br>from<br>dual<\/p>\n\n\n\n<p class=\"has-small-font-size\">call count cpu elapsed disk query current rows<br>&#8212;&#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br>Parse 1 0.00 0.00 0 0 0 0<br>Execute 1 0.00 0.00 0 0 0 0<br>Fetch 2 0.00 0.00 0 0 0 1<br>&#8212;&#8212;- &#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br>total 4 0.00 0.00 0 0 0 1<\/p>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Eine wenig bekannte aber interessante Option des TKPROFs ist &#8222;pdbtrace&#8220;. tkprof kann so die formatierte Ausgabe erzeugen ohne direkt Zugriff auf die Trace-Files auf Fileebene des Datenbank-Servers zu haben. select value from v$diag_info where name=&#8217;Diag Trace&#8216;; &#8211;&gt; Trace-Directory ermittlen tkprof &hellip; <a href=\"https:\/\/jal-bs.de\/blog\/?p=478\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[18,39],"_links":{"self":[{"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/478"}],"collection":[{"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=478"}],"version-history":[{"count":4,"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/478\/revisions"}],"predecessor-version":[{"id":482,"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/478\/revisions\/482"}],"wp:attachment":[{"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jal-bs.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}