1、设置keep池大小
SYS@jzh>alter system set db_keep_cache_size=60m;
System altered.
2、创建测试表
JZH@jzh>create table t as select * from dba_objects;
Table created.
3、查看执行计划
JZH@jzh>select * from t;
74756 rows selected.
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
5985 consistent gets
1065 physical reads
0 redo size
8574342 bytes sent via SQL*Net to client
55336 bytes received via SQL*Net from client
4985 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
74756 rows processed
4、将表存放keep池中
JZH@jzh>alter table t storage (buffer_pool keep);
Table altered.
5、查询表是否在keep池中
JZH@jzh>select table_name,buffer_pool from user_tables;
TABLE_NAME BUFFER_POOL
------------------------------ --------------------
T KEEP
6、查询表是否被cache
JZH@jzh>select table_name,buffer_pool,cache from user_tables;
TABLE_NAME BUFFER_POOL CACHE
------------------------------ -------------------- --------------------
T KEEP N
7、缓存表
JZH@jzh>alter table t cache;
Table altered.
JZH@jzh>select table_name,buffer_pool,cache from user_tables;
TABLE_NAME BUFFER_POOL CACHE
------------------------------ -------------------- --------------------
T KEEP Y
8、查看执行计划
JZH@jzh>select * from t;
74756 rows selected.
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
5987 consistent gets
0 physical reads
0 redo size
8574342 bytes sent via SQL*Net to client
55336 bytes received via SQL*Net from client
4985 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
74756 rows processed
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10271187/viewspace-2130063/
,如需转载,请注明出处,否则将追究法律责任。