熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

OracleTimesten7.0內存數據庫:(3)創建一個只讀的CacheGroup

2022-06-13   來源: Oracle 

   先在sysodbcini配置一個DSN

   #######################################################
[ttdemo]
Driver=/opt/TimesTen/tt/lib/libttenso
DataStore=/var/TimesTen/tmp/ttdemo
DatabaseCharacterSet=WEISOP
TempSize=
PermSize=
Authenticate=
UID=test
OracleID=shacola
OraclePwd=
Logging=
Isolation=
PassThrough=
LockLevel=
TypeMode=
#######################################################

   創建Oracle測試表並准備數據

   sqlplus test/

CREATE TABLE readtab (a NUMBER NOT NULL PRIMARY KEY b VARCHAR());

INSERT INTO readtab VALUES ( hello);
INSERT INTO readtab VALUES ( world);
COMMIT;

   創建 cache group

   ttisql ttdemo
call ttCacheUidPwdSet(test);
call ttCacheStart;

CREATE READONLY CACHE GROUP readcache
AUTOREFRESH INTERVAL SECONDS
FROM readtab
(a NUMBER NOT NULL PRIMARY KEY b VARCHAR());

   裝載數據

   LOAD CACHE GROUP readcache COMMIT EVERY ROWS;

SELECT * FROM readtab;

   在源表裡插入新的數據

   sqlplus test/
INSERT INTO readtab VALUES ( Hello);
INSERT INTO readtab VALUES ( Again);
COMMIT;

   檢查cache是否刷新

  需要等待AUTOREFRESH INTERVAL 指定的時間本例中是

   測試完畢 打掃一下

   DROP CACHE GROUP readcache;

call ttCacheStop;


From:http://tw.wingwit.com/Article/program/Oracle/201311/17553.html
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.