ORACLE 11GR2 新特性CACHE表與以前的區別
alter system set db_keep_cache_size=80M --設定keep值大小
alter table TBL_AIRCOMPANY storage(buffer_pool keep)--把表TBL_AIRCOMPANY設定成keep在pool池中
ALTER TABLE TBL_AIRCOMPANY cache --讓TBL_AIRCOMPANY可以快取
SELECT OBJECT_NAME, A.STATUS, COUNT(*)
FROM V$BH A, USER_OBJECTS B
WHERE A.OBJD = B.OBJECT_ID
--AND OBJECT_NAME IN ('TBL_AIRCOMPANY')
GROUP BY OBJECT_NAME, A.STATUS; --檢視是否在快取keep中
--各個buffer的空間資訊
select p.name,sum(a.cnum_repl) "total buffers",sum(a.anum_repl) "free buffers" from x$kcbwds a, v$buffer_pool p
where a.set_id>=p.LO_SETID and
a.set_id<=p.HI_SETID
group by p.name;
--指令碼用來定位哪些object在buffer cache中存在,佔用的buffer cache的量是多少以及佔用的是什麼型別的buffer cache。
select decode(pd.bp_id,1,'KEEP',2,'RECYCLE',3,'DEFAULT',
4,'2K SUBCACHE',5,'4K SUBCACHE',6,'8K SUBCACHE',
7,'16K SUBCACHE',8,'32KSUBCACHE','UNKNOWN') subcache,
bh.object_name,bh.blocks
from x$kcbwds ds,x$kcbwbpd pd,(select set_ds,
o.name object_name,count(*) BLOCKS
from obj$ o, x$bh x where o.dataobj# = x.obj
and x.state !=0 and o.owner# !=0
group by set_ds,o.name) bh
where ds.set_id >= pd.bp_lo_sid
and ds.set_id <= pd.bp_hi_sid
and pd.bp_size != 0
and ds.addr=bh.set_ds
order by decode(pd.bp_id,1,'KEEP',2,'RECYCLE',3,'DEFAULT',
4,'2K SUBCACHE',5,'4K SUBCACHE',6,'8K SUBCACHE',
7,'16K SUBCACHE',8,'32KSUBCACHE','UNKNOWN'),bh.blocks;
select
(select value from V$SYSSTAT where name='physical write total bytes')/
(select value from V$SYSSTAT where name='physical read total bytes')*100||'%' 寫讀比例
from dual
一、對於普通表的cache方法:
SQL> conn test/test 已連線。
SQL> alter table t1 storage (buffer_pool keep) cache;
表已更改。
查詢普通表是否已經被cache:
SQL> select table_name,cache,buffer_pool from user_TABLES;
TABLE_NAME CACHE BUFFER_
------------------------------ ---------- -------
T1 Y KEEP
二、對於普通LOB型別的segment的cache方法
SQL> desc t2
名稱 是否為空? 型別
---------------------------------------- -------- ----------------------------
ID NUMBER
C2 CLOB
SQL> alter table t2 modify lob(c2) (storage (buffer_pool keep) cache);
表已更改。
三、對基於CLOB型別的物件的cache方法
SQL> desc lob1
名稱 是否為空? 型別
----------------------------------------- -------- --------------- ID NUMBER
C1 XMLTYPE
SQL> alter table lob1 modify lob(c1.xmldata) (storage (buffer_pool keep) cache);
表已更改。
那麼,怎麼測試lob segment是否被cache了呢?
來看看oracle給我的回覆:
Hi Frank,
To verify which buffer pool is used by a lob segment query dba_segments,
See below test case
SQL> create table test(name varchar2(10), address clob);
Table created.
SQL> select table_name,cache,buffer_pool from user_TABLES;
TABLE_NAME CACHE BUFFER_
------------------------------ ----- -------
TEST N DEFAULT
SQL> alter table test modify lob(address) (storage (buffer_pool keep) nocache);
Table altered.
SQL> select table_name,cache,buffer_pool from user_TABLES;
TABLE_NAME CACHE BUFFER_
------------------------------ ----- -------
TEST N DEFAULT
SQL> select segment_name,segment_type,buffer_pool from user_segments;
SEGMENT_NAME
--------------------------------------------------------------------------------
SEGMENT_TYPE BUFFER_
------------------ -------
TEST
TABLE DEFAULT
SYS_IL0000123006C00002$$
LOBINDEX KEEP
SYS_LOB0000123006C00002$$
LOBSEGMENT KEEP
SQL> select column_name,segment_name from user_lobs;
COLUMN_NAME
--------------------------------------------------------------------------------
SEGMENT_NAME
------------------------------
ADDRESS
SYS_LOB0000123006C00002$$
SQL>
Thus you can see the lob segment SYS_LOB0000123006C00002$$ is mapped to clob column ad
dress and is using
keep buffer pool as expected.
User_objects will display results for object as a whole not for individual columns.
See below, we need to alter the complete table to use keep buffer_pool and user_tables will then
display results as expected.
SQL> alter table test storage (buffer_pool keep);
Table altered.
SQL> select table_name,cache,buffer_pool from user_TABLES;
TABLE_NAME CACHE BUFFER_
------------------------------ ----- -------
TEST N KEEP
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28894640/viewspace-1196073/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【11gR2新特性】result cache 的三種模式模式
- Oracle 11gR2 Result Cache特性文章收集Oracle
- oracle 11GR2 新特性Oracle
- 11gR2新特性之二 - Flash Cache 的SSD支援
- buffer與cache的區別
- Buffer 與 Cache 的區別
- Oracle 11g新特性:Result CacheOracle
- buffer 與cache 的區別2
- BLE5.0與BLE4.2的區別與新特性
- Oracle 11gr2 的新特性-延遲段建立Oracle
- 【11gR2新特性】DBMS_RESULT_CACHE管理結果快取的包快取
- Oracle 11gR2 ASM磁碟組管理與新特性實踐[1]OracleASM
- linux cache與buffer的區別Linux
- oracle 11gR2 新特性 diskgroup 重新命名Oracle
- 【11gR2新特性】密碼區分大小寫密碼
- Oracle11g新特性:SQL Result Cache [zt]OracleSQL
- oracle 11GR2新特性 Cluster Time Synchronization Service 配置Oracle
- 11GR2新特性(轉)
- Oracle 18c新特性詳解 - 表和表空間相關的新特性Oracle
- Oracle RAC 和OPS 區別 - Cache FusionOracle
- SQL Query Result Cache的使用和配置--Oracle 11G新特性SQLOracle
- Service Worker Cache 和 HTTP Cache 的區別HTTP
- Linux free中buffer與cache區別Linux
- Buffer和Cache的區別
- Cache 和 Buffer的區別
- 【RAC】11gR2 新特性:Oracle Cluster Health Monitor(CHM)簡介Oracle
- mysql與Oracle的區別MySqlOracle
- Oracle - @和@@、&與&& 的區別Oracle
- oracle in與exists 的區別Oracle
- 【RAC】11gR2 新特性: Rebootless RestartbootREST
- 轉貼_大牛_tolywang_Buffer 與 Cache 的區別
- Oracle11.2表分割槽新特性Oracle
- Oracle 10G 新特性——閃回表Oracle 10g
- oracle 11g 新特性 表壓縮Oracle
- oracle 11gR2 新特性 orc和vote盤可以放在ASM中OracleASM
- Oracle 11gR2版本區別明細Oracle
- Linux Buffer/Cache 的區別Linux
- oracle restore與recover的區別OracleREST