Share the content if you found it is useful (You can share using 300 community websites) click "share" at the end of the post.

You are encouraged to leave a comment.








Friday, August 05, 2011

Trace Level 8 and SQLTXPLAIN

One of my Service Request needs to be updated with Trace Level 8 and SQLTXPLAIN:

I got the sql which took longer wait event through enabling the trace at the forms level.

Enabling Trace level 8 at backend:

ALTER SESSION SET EVENTS '10046 trace name context forever, level 8';

Session Altered

Run the query.

SQL> ALTER SESSION SET EVENTS '10046 trace name context off';

Session altered.


To obtain the trace file use the following SQL

SET LINESIZE 100
COLUMN trace_file FORMAT A60

SELECT s.sid,
s.serial#,
pa.value || '/' || LOWER(SYS_CONTEXT('userenv','instance_name')) ||
'_ora_' || p.spid || '.trc' AS trace_file
FROM v$session s,
v$process p,
v$parameter pa
WHERE pa.name = 'user_dump_dest'
AND s.paddr = p.addr
AND s.audsid = SYS_CONTEXT('USERENV', 'SESSIONID');
This will provide you the trace file location.


SQLTXPLAIN:

  1. Download the file sqlt.zip file from Note 215187.1 and unzip it to an empty local or server directory. This will create the "sqlt" directory and a number of subdirectories.
  2. In the sqlt/install directory run the script "sqcreate.sql"
    • Navigate to the sqlt/install directory
    • Start SQL*Plus connecting INTERNAL (SYS) as SYSDBA
    • Execute script sqcreate.sql and respond to values requested
EXAMPLE:
$ sqlplus / as sysdba
SQL> start sqcreate.sql


During the run, it will ask for the Connect Descriptor like @PROD, give your SID with @symbol.
It will ask for the sqltxplain Tablespace (Provide the tablespace name other than SYSTEM and SYSAUX). Later provide the schema password for the sqltxplain. It will create views and tables related with SQLTXPLAIN.

Create the sql to be analyzed as txt file. (eg. sqltxt.txt)

and move to the directory $ORACLE_HOME/sqlt/run

connect as apps and with apps password.

Run
@sqltxplain sqltxt.txt

It will run for a moment and asks you the password for SQLTXPLAIN schema password. Providing that will enable the script to export the output files to a dmp file and later it will zip them as a single file.

Move the zip file to your local computer and upload to SR.

Now, you will be having the sql with trace level 8 and SQLTXPLAIN.

Cheers!!!

No comments:

Related Posts Plugin for WordPress, Blogger...

Let us be Friends...

Share |

Popular Posts

Recent Comments