You can check the SQL's execution plan for a given old hash value by
@?/rdbms/admin/sprepsql
You may want to compare SQL Statistics section such as buffer gets, disk reads and rows processed as well.
select * from stats$sql_summary where old_hash_value='4249085830';
You would need to have gathered snapshots at level 6 or 7, then you could see all the plans for a statement. Did you do that? Level 5 isn't good enough.
http://www.dba-oracle.com/t_sprepsql_sql.htm
To fix the good PHV or plan, you can use :
1) COE CUSTOM PROFILE
Refer Correcting Optimizer Cost Estimates to Encourage Good Execution Plans Using the COE XFR SQL Profile Script ( Doc ID 1955195.1 )
/*NO NEED OF ANY SQLT INSTALLATION. WE JUST NEED THAT ZIP FILE*/
OR
2) How to Load SQL Plans into SQL Plan Management (SPM) from the Automatic Workload Repository (AWR) ( Doc ID 789888.1 )
Adding hints to a SQL statement require more than just a copy of the statement.
Please upload SQLTXPLAIN report for the SQL using Method 2 (XTRACT).
SQLTXPLAIN reports provide a great deal of supporting information including schema definitions, statistics, parameters, an optimizer 10053 trace, and much more that are essential to the diagnostic process.
Please do the following:
(i) Please read Note SQLT (SQLTXPLAIN) - Tool that helps to diagnose a SQL statement performing poorly ( Doc ID 1614107.1 )
and Note FAQ: SQLT (SQLTXPLAIN) Frequently Asked Questions ( Doc ID 1454160.1 ) carefully.
(ii) Download and unzip file sqlt.zip provided on Note
Please download the latest version.
(iii) Install SQLTXPLAIN under direction of INSTRUCTIONS.TXT file
(iv) Run SQLTXPLAIN (use XTRACT method) for the SQL statements that we are focus under direction of INSTRUCTIONS.TXT
(v) SQLTXPLAIN normally generates a *.zip file for upload. If it does not, please upload all files generated.
For SQL Hints, https://docs.oracle.com/database/121/SQLRF/sql_elements006.htm#SQLRF51101
For Statistics, Support Note: How to Restore Oracle Optimizer Statistics ( Doc ID 452011.1 )
I could not find if this feature is available in SR, but you can try.
Unfortunately SQL Plan Management (SPM) is not available in Standard Edition (SE) Oracle.
Additionally, there is no history of old execution plans available because they are stored in the Oracle Diagnostic Pack (AWR) which is also not available on SE Oracle. Your options are: 1. Manual tuning of the SQL statement. 2. Using hints to force a specific execution plan. 3. Possible restore old statistics from before the plan changed (May not be available on SE Oracle) 4. Change the way statistics are gathered. |