Example:
--------
Let us take an example:
Step 1:
-------
Create table EMP. Its description is as follows
SQL> desc emp
SQL> select count(*) from emp;
COUNT(*)
----------
14
SQL> select * from user_tab_modifications;
no rows selected
Initially there are 14 rows in EMP.
Step 2:
-------
Set parameter STATISTICS_LEVEL='TYPICAL'
SQL> alter system set STATISTICS_LEVEL='TYPICAL';
System altered.
Step 3:
-------
Insert additional 14 rows. This will increase the data in EMP by 50% and
therefore the statistics in EMP will be regarded as stale by Oracle.
SQL> insert into emp select * from emp;
14 rows created.
SQL>commit;
Step 5:
-------
If a monitored table has been modified more than 10%, then these
statistics are considered stale
Analyze the tables whose statistics have become stale using the following command:
execute DBMS_STATS.GATHER_SCHEMA_STATS ('RAJIV',
NULL,
FALSE,
'FOR ALL COLUMNS SIZE 1',
NULL,
'DEFAULT',
TRUE,
NULL,
NULL,
'GATHER STALE',
'LIST' );
Step 6:
-------
Query dba_tab_modifications to check whether the table has been analyzed
or not?
SQL> select * from user_tab_modifications;
no rows selected
No rows in dba_tab_modifications indicates that the table is analyzed.