Friday, May 12, 2017

Running SQLTXPLAIN for a sql script

This method is based on the EXPLAIN PLAN FOR command.
To use this XPLAIN method, be sure SQLT has been installed first, if not please ask your DBA team to install. (Installation Instructions: Metalink Doc ID 215187.1)

> Get the directory details of the SQLT installed and SQLTXPLAIN password from the DBA team.
> Now save your required SQL script in .txt/.sql format replacing all input parameters  as bind variables.
   >> File should have one and only one valid SQL Statement
   >> Should not have empty lines (blank lines)
   >> The SQL Statement should not have a semicolon ';' at the end
   >> For example please refer sqlt/input/sample/sql1.sql
   >> For multiple scripts please create separate files.
> Now go to SQLT directory and connect to SQL*Plus
> Run SQL> START [path]sqltxplain.sql [path]filename [sqltxplain_password] 
   Ex: START /oracle/orauat/sqlt/run/sqltxplain.sql /oracle/orauat/sqlt/run/SqlScript1.txt sqltxplain_password

You may get below error

ERROR at line 1:
ORA-20106: SQLT parameter connect_identifier must be set when running SQLT from a remote client
ORA-06512: at line 10


> Execute below to overcome this error
EXEC sqltxadmin.sqlt$a.set_sess_param('connect_identifier', '@SID');  

 >> SID - Service Identifier of your DB instance

> You can Monitor progress from other session:
select *
  from SQLTXADMIN.sqlt$_log_v


> Log Directory
select *
  from dba_directories
 where directory_name like 'SQLT%UDUMP%'


** If the only output file is a log file similar to : sqlt_s50605_log.zip
Then it may be that the SQLT did not complete successfully please examine the log for errors.



Ref: My Experience/Oracle Metalink/User Guides/Different other blogs available/Colleagues

No comments:

Post a Comment