How To Install SQLT
How To Install SQLT
2. Install SQLT: If you have already installed SQLT on system and wants to uninstall:
Command to uninstall SQLT.
# cd sqlt/install
# sqlplus / as sysdba
SQL> START sqdrop.sql
# cd sqlt/install
# sqlplus / as sysdba
SQL> START sqcreate.sql
2. SQLTXPLAIN password.
Case sensitive in most systems.
After providing these inputs DBA can find SQLT installed. SO, Now SQLTXPLAIN is ready to use.
1. XTRACT Method: DBA can use this method to find sql query expecution detail. If you
know sql id or Hash value for sql query. Remote DBA can find sql id from v$sqltext or from
dba_hist_sqltext views.
Database administrator has to provide SQL ID/Hash value and SQLTEXPLAIN password as input for this
method.
# cd sqlt/run
Connect to the user for which sql you want to get sqltxplain. Here I am using scott user
# sqlplus scott
SQL> START sqltxtract.sql [SQL_ID]|[HASH_VALUE] [sqltxplain_password]
SQL> START sqltxtract.sql 0w6uydn5xtzse sqltxplain_password
SQL> START sqltxtract.sql 2524212345 sqltxplain_password
Here is the output when I execute this query for having sql id dr97nyf16pkhv and Password
SQLTEXPLAIN
SQL> start sqltxtract.sql dr97nyf16pkhv SQLTEXPLAIN
Parameter 1:
SQL_ID or HASH_VALUE of the SQL to be extracted (required)
Paremeter 2:
SQLTXPLAIN password (required)
Value passed:
SQL_ID_OR_HASH_VALUE: "dr97nyf16pkhv"
----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
Archive: sqlt_s16027_xtract_dr97nyf16pkhv.zip
Length Date Time Name
--------- ---------- ----- ----
175896 06-17-2013 01:30 sqlt_s16027_10053_explain.trc
106950 06-17-2013 01:30 sqlt_s16027_10053_i1_c0_extract.trc
5521 06-17-2013 01:30 sqlt_s16027_driver.zip
24477 06-17-2013 01:30 sqlt_s16027_lite.html
37027 06-17-2013 01:31 sqlt_s16027_log.zip
783005 06-17-2013 01:30 sqlt_s16027_main.html
544718 06-17-2013 01:30 sqlt_s16027_opatch.zip
16607 06-17-2013 01:30 sqlt_s16027_readme.html
40968 06-17-2013 01:30 sqlt_s16027_sql_detail_active.html
168449 06-17-2013 01:31 sqlt_s16027_sqldx.zip
8078 06-17-2013 01:30 sqlt_s16027_sta_report_mem.txt
1172 06-17-2013 01:30 sqlt_s16027_tc_script.sql
352 06-17-2013 01:30 sqlt_s16027_tc_sql.sql
584912 06-17-2013 01:30 sqlt_s16027_tc.zip
27037 06-17-2013 01:30 sqlt_s16027_tcb.zip
36356 06-17-2013 01:30 sqlt_s16027_tcx.zip
149477 06-17-2013 01:30 sqlt_s16027_trc.zip
--------- -------
2711002 17 files
SQLTXTRACT completed.
SQL>! ls sqlt_s16027_xtract_dr97nyf16pkhv.zip
sqlt_s16027_xtract_dr97nyf16pkhv.zip
Database Administrator can download this file and start analyzing this.
2. XECUTE Method: This method provides more detailed analysis to DBA than
XTRACT. As the name XECUTE means, it executes the SQL being analyzed, then it produces a set of
diagnostics files. Its major drawback is that if the SQL being analyzed takes long to execute, this method
will also take long.
As a rule of thumb, use this method only if the SQL takes less than 1hr to execute, else use XTRACT. If
your SQL requires binds with data types not allowed by SQL*Plus, or if it uses collections, you may be
restricted to embed your SQL into an anonymous PL/SQL block. In such case use
sqlt/input/sample/plsql1.sql as an input example to this method.
It is mandatory to user .sql script to execute this method. This doesn't take sql ID or Hash value as an
input.
Syntax:
# cd sqlt
# sqlplus user_name
SQL> START [path]sqltxecute.sql [path]scriptname [sqltxplain_password]
SQL> START run/sqltxecute.sql input/sample/script1.sql sqltxplain_password
$ cat dba_objects.sql
Paremeter 2:
SQLTXPLAIN password (required)
Archive: sqlt_s16030_xecute.zip
Length Date Time Name
--------- ---------- ----- ----
30 06-17-2013 02:29 dba_objects.sql
1575114 06-17-2013 02:31 sqlt_s16030_10046_10053_execute.trc
1079054 06-17-2013 02:31 sqlt_s16030_10046_execute.trc
470784 06-17-2013 02:31 sqlt_s16030_10053_execute.trc
302376 06-17-2013 02:31 sqlt_s16030_10053_explain.trc
182766 06-17-2013 02:32 sqlt_s16030_cell_state.zip
6279 06-17-2013 02:31 sqlt_s16030_driver.zip
54314 06-17-2013 02:31 sqlt_s16030_lite.html
42545 06-17-2013 02:32 sqlt_s16030_log.zip
1861315 06-17-2013 02:31 sqlt_s16030_main.html
544718 06-17-2013 02:31 sqlt_s16030_opatch.zip
18273 06-17-2013 02:31 sqlt_s16030_readme.html
53284 06-17-2013 02:31 sqlt_s16030_sql_detail_active.html
255836 06-17-2013 02:32 sqlt_s16030_sqldx.zip
10240 06-17-2013 02:31 sqlt_s16030_sta_report_mem.txt
10316 06-17-2013 02:31 sqlt_s16030_sta_report_txt.txt
584456 06-17-2013 02:31 sqlt_s16030_tc.zip
28377 06-17-2013 02:31 sqlt_s16030_tcb.zip
35822 06-17-2013 02:31 sqlt_s16030_tcx.zip
2179888 06-17-2013 02:31 sqlt_s16030_trc.zip
715458 06-17-2013 02:31 sqlt_s16030_trca_e85520.html
18850 06-17-2013 02:31 sqlt_s16030_trca_e85520.log
388182 06-17-2013 02:31 sqlt_s16030_trca_e85520.txt
--------- -------
10418277 23 files
Now, Remote DBA can download sqlt_s16030_xecute.zip and analyze the output.
3 XTRXEC Method: This method combines the features of XTRACT and XECUTE for
DBA. Actually, XTRXEC executes both methods serially. The XTRACT phase generates a script that
contains the extracted SQL together with the binds declaration and assignment for an expensive plan
found for the requested SQL statement. XTRXEC then executes the XECUTE phase using the script
created by the first.
The selection of the values of the bind variables used by XTRACT to create the script is based on the
peeked values at the moment the most expensive plans in memory were generated. Expensive plans are
selected according to their average elapsed time.
Again, This method only need sql Id/Hash Value and sqltxplain_password. This method is most
commonly and recommended method for SQL Performance related tuning issues.
Syntax:
# cd sqlt/run
# sqlplus scott
SQL> START sqltxtrxec.sql [SQL_ID]|[HASH_VALUE] [sqltxplain_password]
SQL> START sqltxtrxec.sql 0w6uydn50g8cx sqltxplain_password
SQL> START sqltxtrxec.sql 2524255098 sqltxplain_password
SQLTXECUTE completed.
SQLTXTRXEC completed.