Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How to analyze statspack or AWR report. Oracle
  • process id based files and processes Linux/Unix
  • Error Handling in Proc Oracle
  • load SPM baseline from cursor cache Oracle
  • Set Role explaination. Oracle
  • Good link for LIO in Oracle ( Logical IOs) Oracle
  • How to find who is using which Rollback segment and how many rows or blocks in that rollback segments, Oracle
  • JSON/XML Types in Oracle Oracle
  • CPU speed on Linux Linux/Unix
  • MYSQL for Oracle DBA MYSQL
  • Zip and unzip with tar Linux/Unix
  • sid_wise_sql.sql Oracle
  • Query to Generate aggregate on every 30 mins. Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • Oracle Data Direct to TAPE 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

  • crtgr.sql /* For creating trigger from data dictionary */ Oracle
  • oracle fast start failover best practice Oracle
  • _B_TREE_BITMAP_PLANS issue during 8.1.7 to 9.2.0.8 upgrade Oracle
  • Key Management in Oracle: The Core Issue: Missing Master Key Oracle
  • shr1.sql for MTS or Shared server configuration Oracle
  • How to calculate PROCESSES parameter Oracle

Leave a Reply Cancel reply

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

Categories

  • AMC10 (0)
  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (150)
  • MYSQL (5)
  • Oracle (403)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (151)
  • SQL scripts (349)
  • SQL Server (6)
  • Uncategorized (6)
  • Videos (0)

Recent Posts

  • AMC1020-Sep-2026
  • Key Management in Oracle: The Core Issue: Missing Master Key12-May-2026
  • SAT Mathematics 10 questions and answer at the end.30-Apr-2026
  • top 10 AI news today30-Apr-2026
  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sh23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • get_vmstat.ksh Linux/Unix
  • How to Make Trace Files Created by Oracle Readable by All Users ? Oracle
  • Committing distributed transaction using commit force Oracle
  • Adding or Dropping Online Redo Log Files When Physical Standby in place Oracle
  • Oracle vs MYSQL Architecture differences (For DBAs) MYSQL
  • How to find who is using which Rollback segment and how many rows or blocks in that rollback segments, Oracle
  • Postgres DB user and OS user. POSTGRESQL
  • 339939.1 Running Cluster Verification Utility to Diagnose Install Problems Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme