SQL> create table t as select * from dba_objects;
Table created.
SQL> analyze table t compute statistics;
Table analyzed.
SQL> select blocks,empty_blocks from dba_tables
2 where table_name='T' and owner='SYS';
BLOCKS EMPTY_BLOCKS---------- ------------
78 1
表T共有79个Block.
(2)x$bh
SQL> select count(*) from x$bh;
COUNT(*)
----------
14375SQL>
select count(*) from x$bh where state=0;
-- state =0 is free
COUNT(*)
----------
13960SQL>
alter system set events = 'immediate trace name flush_cache';
System altered.
SQL> select count(*) from x$bh where state=0;
COUNT(*)
----------
14375
在这里你可以发现flush_cache以后,所有的Buffer都被标记为free。
(3)最后请留意flush_cache对于查询的影响
SQL> set autotrace trace stat
SQL> select count(*) from t;
Statistics
----------------------------------
0 recursive calls
0 db block gets
81 consistent gets
79 physical reads
0 redo size
....
SQL>
SQL> select count(*) from t;
Statistics-----------------------
0 recursive calls
0 db block gets
81 consistent gets
0 physical reads
0 redo size
....
SQL> alter system set events = 'immediate trace name flush_cache';
System altered.SQL> select count(*) from t;
Statistics
---------------------------------- 0 recursive calls
0 db block gets
81 consistent gets
79 physical reads
0 redo size
....
SQL>