时间:2021-07-01 10:21:17 帮助过:7人阅读
call ttcacheuidpwdset(‘cacheadm’, ‘oracle’);
call ttcachestart;
call ttgriddestroy(‘samplegrid’,1); <- 此命令很好用
call ttgridnodestatus(‘samplegrid’);
call ttgridcreate(‘samplegrid’); <- 在任意一个TimesTen数据库中执行一次即可
call ttgridinfo(‘samplegrid’);
call ttgridnameset(‘samplegrid’);
call ttgridinfo(‘samplegrid’);
call ttgridnodestatus(‘samplegrid’);
三个表分布对应regular, dynamic, dynamic global缓存组
create asynchronous writethrough cache group t1_awt
from t1 (c1 number(22) not null primary key, c2 date, c3 varchar(40));
create dynamic asynchronous writethrough cache group t2_awt_dyn
from t2 (c1 number(22) not null primary key, c2 date, c3 varchar(40));
create dynamic asynchronous writethrough global cache group t3_awt_dyn_gbl
from t3 (c1 number(22) not null primary key, c2 date, c3 varchar(40));
cachedb1>
call ttgridattach(1,’member1’,’127.0.0.1’,5001);
call ttgridnodestatus(‘samplegrid’);
call ttrepstart;
cachedb2>
call ttgridattach(1,’member2’,’127.0.0.1’,5002); <- 使用不同的端口是因为两个TimesTen数据库在同一主机上
call ttgridnodestatus(‘samplegrid’);
call ttrepstart;
cachedb1>
insert into t1 values (1, sysdate, ‘t1 data’);
insert into t2 values (1, sysdate, ‘t2 data’);
insert into t3 values (1, sysdate, ‘t3 data’);
unload cache group t1_awt;
unload cache group t2_awt_dyn;
unload cache group t3_awt_dyn_gbl; <- unload后在TimesTen中看不到缓存数据
cachedb2>
insert into t1 values (2, sysdate, ‘t1 data’);
insert into t2 values (2, sysdate, ‘t2 data’);
insert into t3 values (2, sysdate, ‘t3 data’);
unload cache group t1_awt;
unload cache group t2_awt_dyn;
unload cache group t3_awt_dyn_gbl; <- unload后在TimesTen中看不到缓存数据
cachedb1>
load cache group t1_awt where c1 = 1 commit every 10 rows parallel 10;
load cache group t2_awt_dyn where c1 = 1 commit every 10 rows parallel 10;
load cache group t3_awt_dyn_gbl where c1 = 1 commit every 10 rows parallel 10;
select * from t1;
select * from t2;
select * from t3;
unload cache group t1_awt;
unload cache group t2_awt_dyn;
unload cache group t3_awt_dyn_gbl;
cachedb2>
load cache group t1_awt where c1 = 2 commit every 10 rows parallel 10;
load cache group t2_awt_dyn where c1 = 2 commit every 10 rows parallel 10;
load cache group t3_awt_dyn_gbl where c1 = 2 commit every 10 rows parallel 10;
select * from t1;
select * from t2;
select * from t3;
unload cache group t1_awt;
unload cache group t2_awt_dyn;
unload cache group t3_awt_dyn_gbl;
cachedb1>
select * from t1 where c1 = 1;
select * from t2 where c1 = 1;
select * from t3 where c1 = 1;
select * from t1;
select * from t2;
select * from t3;
输出:
cachedb1> select * from t1; <- 没有输出,因为需要手工load
cachedb1> select * from t2; <- 有输出因为满足dynamic load条件
< 1, 2016-06-19 22:41:56, t2 data >
cachedb1> select * from t3; <- 有输出因为满足dynamic load条件
< 1, 2016-06-19 22:41:57, t3 data >
cachedb2>
select * from t1 where c1 = 2;
select * from t2 where c1 = 2;
select * from t3 where c1 = 2;
select * from t1;
select * from t2;
select * from t3;
输出:
cachedb2> select * from t1; <- 没有输出,因为需要手工load
cachedb2> select * from t2; <- 有输出因为满足dynamic load条件
< 2, 2016-06-19 22:45:12, t2 data >
cachedb2> select * from t3; <- 有输出因为满足dynamic load条件
< 2, 2016-06-19 22:46:07, t3 data >
cachedb1>
select * from t1 where c1 = 2;
select * from t2 where c1 = 2;
select * from t3 where c1 = 2;
select * from t1;
select * from t2;
select * from t3;
输出:
cachedb1> select * from t1;
cachedb1> select * from t2;
< 1, 2016-06-19 22:41:56, t2 data >
< 2, 2016-06-19 22:45:12, t2 data > <- 这条数据是从Oracle中dynamic load而来
cachedb1> select * from t3;
< 1, 2016-06-19 22:41:57, t3 data >
< 2, 2016-06-19 22:46:07, t3 data > <- 这条数据是从Cache Grid的另一个member: cachedb2中load而来
cachedb2>
select * from t1 where c1 = 1;
select * from t2 where c1 = 1;
select * from t3 where c1 = 1;
select * from t1;
select * from t2;
select * from t3;
输出:
cachedb2> select * from t1;
cachedb2> select * from t2;
< 1, 2016-06-19 22:41:56, t2 data > <- 对于普通的dynamic AWT,由于互不知情,因此这两条数据在两个TimesTen数据库中都存在
< 2, 2016-06-19 22:45:12, t2 data > <- 这条数据是从Oracle中dynamic load而来
cachedb2> select * from t3;
< 1, 2016-06-19 22:41:57, t3 data > <- 这条数据是从Cache Grid的另一个member: cachedb1中load而来
cachedb1> select * from t3;
< 2, 2016-06-19 22:46:07, t3 data > <- 对于global awt, cache instance只会在一个TimesTen中出现
cachedb1>
call ttrepstop;
call ttgriddetach;
drop cache group t1_awt;
drop cache group t2_awt_dyn;
drop cache group t3_awt_dyn_gbl;
call ttcachestop;
cachedb2>
call ttrepstop;
call ttgriddetach;
drop cache group t1_awt;
drop cache group t2_awt_dyn;
drop cache group t3_awt_dyn_gbl;
call ttcachestop;
call ttgriddestroy(‘samplegrid’,1);
HOWTO : Understand The Three Fundamental Types Of TimesTen Asynchronous (AWT) Cache Groups (Doc ID 1471954.1)
TimesTen 应用层数据库缓存学习:19. 理解AWT缓存组的三种模式
标签: