Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Renaming Oracle Instance Name Oracle
  • Debugging Shell FIles Linux/Unix
  • v$event_name Oracle
  • Implementing Listener Security Oracle
  • cur_sql.sql Oracle
  • CTAS with LONG Column for 7.x and 8 and 8i Oracle
  • Error Handling in Proc Oracle
  • scp with ssh2 Linux/Unix
  • cp_filesystem.sql Oracle
  • How To Resolve Stranded DBA_2PC_PENDING Entries ID 401302.1 (Very Good prooven) Oracle
  • .profile Linux/Unix
  • Multiple listeners Oracle
  • good note for shared pool tunnig Oracle
  • Configure ssh authentications for RAC Oracle
  • Very Good Oralce Internal Tuning Book Oracle

Explain Plan Doesn’T Change For Sql After New Statistics Generated

Posted on 06-May-2008 By Admin No Comments on Explain Plan Doesn’T Change For Sql After New Statistics Generated

If you use dbms_stats in 10g it will not automatically invalidate dependant

cursors. This is the default behaviour as of 10.

To revert to older previous behaviour you will have to set the parameter

no_invalidate to false.

.

no_invalidate

Does not invalidate the dependent cursors if set to TRUE.

The procedure invalidates the dependent cursors immediately if set to FALSE.

This is the default.

Begin

dbms_stats.gather_table_stats(……., no_invalidate => false);

End;

/

or you can set defaultparameters DBMS_STATS.SET_PARAM:

This procedure sets default values for parameters of DBMS_STATS procedures.

You can use the GET_PARAM Function to get the current default value of a parameter.

Syntax

DBMS_STATS.SET_PARAM (

pname IN VARCHAR2,

pval IN VARCHAR2);

Solution

Testcase/Examples

==============

alter system flush shared_pool;

drop table t;

create table t( c1 number);

Begin

For i In 1..1000 Loop

Insert Into t

values (I);

End Loop;

End;

/

select * from t where c1=10;

select sql_text, invalidations from v$sql

where sql_text like ‘%select * from t%’

/

–==> invalidations 0

Begin

dbms_stats.gather_table_stats(‘SYSTEM’,’t’,estimate_percent => 100,

cascade => True);

End;

/

select * from t where c1=10;

select sql_text, invalidations from v$sql

where sql_text like ‘%select * from t%’

;

— ==> invalidations 0

Begin

dbms_stats.gather_table_stats(‘SYSTEM’,’t’,estimate_percent => 100,

cascade => True, no_invalidate => false);

End;

/

select * from t where c1=10;

select sql_text, invalidations from v$sql

where sql_text like ‘%select * from t%’

;

— ==> invalidations 1

RESULT:

11 INVALIDATIONS is always 0 and 1 if no_invalidate => false

10.2.0.3 INVALIDATIONS is always 0 and 1 if no_invalidate => false

9.2.0.8 INVALIDATIONS is always 1 after the gather stats

.

Oracle, SQL scripts

Post navigation

Previous Post: alter database backup controlfile to trace
Next Post: send email from unix mailx with attachment.

Related Posts

  • Drop tempfiles from database Oracle
  • find_open_cur.sql Find open cursorts per session Oracle
  • Nice notes on wait events Oracle
  • On solaris 10, “S” link is not part of $ORACLE_HOME/bin/oracle as default. ( For 9.2.0.8) Oracle
  • Jai Shree Ram Oracle
  • How to stop OCSSD Daemon Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (387)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (336)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024
  • Add new columns in dataframe30-Sep-2023

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Oracle Statspack survival Guide Oracle
  • SYSOPER Mystery Oracle
  • eplan.sql Oracle
  • V$ROLLSTAT status is Full Oracle
  • Single character replacement in Unix Linux/Unix
  • currwait.sql Oracle
  • Optimizer_Index init.ora parameter explaination. Oracle
  • handling filenname with space Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme