Instructions to perform the following:
Steps:
sqlt_s53242_driver.zip
in order to get sqlt_s53242_export_parfile.txt
.sqlt_s53242_export_parfile.txt
to SOURCE server (TEXT).exp sqltxplain parfile=sqlt_s53242_export_parfile.txt
Steps:
sqlt_s53242_tc.zip
in order to get sqlt_s53242_expdp.dmp
.sqlt_s53242_exp.dmp
to the server (BINARY).imp sqltxplain FILE=sqlt_s53242_exp.dmp TABLES=sqlt% IGNORE=Y
You can execute sqlt_s53242_import.sh
instead.
You need to have a set of SQLT files (sqlt_sNNNNN_method.zip) from two executions of the SQLT tool. They can be from any method (XTRACT, XECUTE or XPLAIN) and they can be from the same or different systems. They do not have to be from same release or platform. For example, a SQLT from 10g on Linux and a SQLT from 11g on Unix can be compared.
To use the COMPARE method you need 3 systems: SOURCE1, SOURCE2 and COMPARE. The 3 could all be different, or all the same. For example, SOURCE1 could be PROD, SOURCE2 DEV and COMPARE DEV. In other words, you could do the COMPARE in one of the sources. Or the COMPARE could be done on a 3rd and remote system.
Basically you need to restore the SQLT repository from both SOURCES into the COMPARE system. In most cases it means "restoring" the SQLT repository from at least one SOURCE into the COMPARE. Once you have both SQLT repositories into the COMPARE system, then you can execute this method.
Steps:
sqlt_s53242_tc.zip
from this SOURCE in order to get sqlt_s53242_expdp.dmp
.sqlt_s53242_exp.dmp
to the server (BINARY).imp sqltxplain FILE=sqlt_s53242_exp.dmp TABLES=sqlt% IGNORE=Y
START sqlt/run/sqltcompare.sql
CBO schema object statistics can be restored from the local SQLT repository, or from an imported repository. Restoring CBO statistics associates them to existing and compatible schema objects. These objects can be owned by the original schema owner or by a different one. For example, table T is owned by user U in SOURCE and by user TC53242 in TARGET.
When using restore script below, the second parameter allows to remap the schema object statistics to a different user. Be aware that target user and schema objects must exist before executing this script. To restore CBO schema object statistics into the original schema owner(s) pass "null" (or just hit the "Enter" key) when the second parameter is requested.
Steps:
START sqlt/utl/sqltimp.sql s53242_v1123_host01 TC53242
Steps:
START sqlt_s53242_system_stats.sql
SOURCE and TARGET systems should be similar. Proceed with Preparation followed by Express or Custom mode.
sqlt_s53242_tc.zip
in server and navigate to TC directory.unzip sqlt_s53242_tc.zip -d TC53242
cd TC53242
xpress.sh
from OS or xpress.sql
from sqlplus.Option 1: ./xpress.sh
Option 2: sqlplus / as sysdba @xpress.sql
sqlplus / as sysdba
START sqlt_s53242_metadata.sql
START sqlt_s53242_purge.sql
HOS imp sqltxplain FILE=sqlt_s53242_exp.dmp LOG=sqlt_s53242_imp.log TABLES=sqlt% IGNORE=Y
START sqlt_s53242_restore.sql
START sqlt_s53242_system_stats.sql
CONN TC53242/TC53242
START sqlt_s53242_set_cbo_env.sql
START tc.sql
After creating a local test case using SQLT files, you can create a stand-alone TC with no dependencies on SQLT.
Steps:
DELETE TC53242.CBO_STAT_TAB_4TC;
EXEC SYS.DBMS_STATS.EXPORT_SCHEMA_STATS(ownname => 'TC53242', stattab => 'CBO_STAT_TAB_4TC');
HOS exp TC53242/TC53242 FILE=cbo_stat_tab_4tc.dmp LOG=cbo_stat_tab_4tc.log TABLES=cbo_stat_tab_4tc STATISTICS=NONE
setup.sql
script and adjust if needed.readme.txt
file and adjust if needed.CBO schema object statistics dump: cbo_stat_tab_4tc.dmp Plan script: plan.sql Query script: q.sql Instructions: readme.txt Setup script: setup.sql Metadata script: sqlt_s53242_metadata.sql OPatch (if needed): sqlt_s53242_opatch.zip Set CBO env script (if needed): sqlt_s53242_set_cbo_env.sql System statistics setup: sqlt_s53242_system_stats.sql Test case script: tc.sql
readme.txt
in another system.Note: You may want to use tc_pkg.sql to execute commands above.
Use commands below to generate a fresh set of CBO statistics for the schema objects accessed by your SQL. Histograms will be dropped.
BEGIN -- generated by SQLT SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"CUSTOMER"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"CUSTOMER"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE 1', cascade => TRUE, no_invalidate => FALSE ); SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"ORDER_LINE"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"ORDER_LINE"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE 1', cascade => TRUE, no_invalidate => FALSE ); SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"PART"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"PART"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE 1', cascade => TRUE, no_invalidate => FALSE ); SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"SALES_ORDER"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"SALES_ORDER"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE 1', cascade => TRUE, no_invalidate => FALSE ); END; /
Use commands below to generate a fresh set of CBO statistics for the schema objects accessed by your SQL. Histograms will be generated for some columns.
BEGIN -- generated by SQLT SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"CUSTOMER"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"CUSTOMER"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE, no_invalidate => FALSE ); SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"ORDER_LINE"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"ORDER_LINE"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE, no_invalidate => FALSE ); SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"PART"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"PART"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE, no_invalidate => FALSE ); SYS.DBMS_STATS.UNLOCK_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"SALES_ORDER"' ); SYS.DBMS_STATS.GATHER_TABLE_STATS ( ownname => '"QTUNE"', tabname => '"SALES_ORDER"', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade => TRUE, no_invalidate => FALSE ); END; /
Files generated under current SQL*Plus directory.
Not all files may be available.
sqlt_s53242_main.html sqlt_s53242_metadata.sql sqlt_s53242_metadata1.sql sqlt_s53242_metadata2.sql sqlt_s53242_system_stats.sql sqlt_s53242_schema_stats.sql sqlt_s53242_set_cbo_env.sql sqlt_s53242_lite.html sqlt_s53242_readme.html sqlt_s53242_readme.txt sqlt_s53242_tcb_driver.sql sqlt_s53242_tcb.zip sqlt_s53242_remote_driver.sql sqlt_s53242_tkprof_px_driver.sql sqlt_s53242_export_parfile.txt sqlt_s53242_export_parfile2.txt sqlt_s53242_export_driver.sql sqlt_s53242_import.sh sqlt_s53242_export.zip sqlt_s53242_tc.zip sqlt_s53242_log.zip sqlt_s53242_opatch.zip sqlt_s53242_remote.zip sqlt_s53242_sql_detail_active.html sqlt_s53242_10053_explain.trc sqlt_s53242_xplain.log sqltxplain.log input/sample/sql2.sql sqltxhost.log plan.sql 10053.sql flush.sql purge.sql restore.sql del_hgrm.sql tc.sql tc_pkg.sql xpress.sql xpress.sh setup.sql q.sql sel.sql sel_aux.sql install.sql install.sh tcx_pkg.sql
Files generated under SQLT$UDUMP directory.
To locate SQLT$UDUMP: SELECT directory_path FROM sys.dba_directories WHERE directory_name = 'SQLT$UDUMP';
Not all files may be available.
V1123_ora_4966_s53242_10053.trc
Files generated under SQLT$BDUMP directory.
To locate SQLT$BDUMP: SELECT directory_path FROM sys.dba_directories WHERE directory_name = 'SQLT$BDUMP';
Not all files may be available.
*_s53242_*.trc
Files generated under SQLT$STAGE directory.
To locate SQLT$STAGE: SELECT directory_path FROM sys.dba_directories WHERE directory_name = 'SQLT$STAGE';
Not all files may be available.
sqlt_s53242_tcb_* README.txt