denrepo

OracleSQL tuning

Execution plan from the cursor cache

Prompts for a SQL_ID and prints every cached child plan. For actual row counts, run the statement with the GATHER_PLAN_STATISTICS hint and change TYPICAL to ALLSTATS LAST.

Prompts for input

Not yet verified. How scripts are tested

ora-plan-cursor.sql
1CLEAR COLUMNS2SET LINESIZE 200 PAGESIZE 0 TRIMOUT ON TAB OFF VERIFY OFF LONG 1000003 4SELECT *5FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('&sql_id', NULL, 'TYPICAL'));6 7SET PAGESIZE 100

Save it as ora-plan-cursor.sql and run it with SQL> @ora-plan-cursor.

Open in denrepo

More Oracle scripts: SQL tuning