在Oracle数据库上创建一张CUSTOMER表。
CREATE TABLE CUSTOMER (CUSTID INT NOT NULL,
NAME CHAR(100) NOT NULL,
ADDR CHAR(100),
ZIP INT,
REGION CHAR(10),
PRIMARY KEY(CUSTID));
插入若干数据。
SWT cache group:
创建一个SYNCHROUS WRITETHROUGH cache group:
CREATE SYNCHRONOUS WRITETHROUGH cache group Customers
FROM
CUSTOMER (CUSTID INT NOT NULL,
NAME CHAR(100) NOT NULL,
ADDR CHAR(100),
ZIP INT,
PRIMARY KEY(CUSTID));
如果之前创建的cache group已经在Timesten里建立了表CUSTOMER,再创建时会报错:
2207: Table CUSTOMER already exists
可以删除之前的cache group之后再创建,由于是cache table,所以不能只删除表,需要删除整个cache group。
8228: Cannot drop cache group table CUSTOMER; please use DROP CACHE GROUP instead
删除命令:
drop cache group
创建之后同样需要LOAD一次。
系统管理的cache group中,除了READONLY之外都不允许自动刷新。
SYNCHROUS WRITETHROUGH cache group是不会自动刷新的,在Oracle的变化需要,Timesten手动刷新才能更新。
同步写入需要等待Oracle端commit之后才在Timesten端commit。传递的过程是同步的。
Timesten端:
Command> insert into customer values(147,'Buker','ZhaoXie Road',16);
Oracle端:
SQL> select * from customer;
CUSTID NAME ADDR ZIP REGION
---------- ---------- --------------- ---------- ----------
105 Deph ShenNan Road 21 LuoHu
106 Kaka ShenNan Road 22 LuoHu
234 Obma CaiTian Road 19
129 Jornde CaiTian Road 23
221 Adex CaiTian Road 21
100 Harry DongBing Road 10 NanShan
107 Grde BaiShi Road 77
101 Polo KeYuan Road 7 NanShan
147 Buker ZhaoXie Road 16
已选择9行。
同步写的特性:
在Oracle端插入一个custid=150的记录。
SQL> insert into customer values(150,'Linda','ZhaoShang Road',88,'SheKou');
不提交的情况下,在Timesten端插入同样custid的记录,但是其余内容不同。
插入时hang住了,等待Oracle端的commit或rollback。
Command> insert into customer values(150,'Wendy','NanHai Road',13);
如果Oracle端提交,Timesten返回一个唯一性约束的错误:
5210: Oracle unique constraint violation error in OCIStmtExecute(): ORA-00001: unique constraint (TT.SYS_C005415) violated rc = -1
5055: Cannot synchronize Oracle with TimesTen. The TimesTen transaction must be rolled back.
5025: Commit failure in Oracle. Transaction must be rolled back in TimesTen.
The command failed.
如果Oracle端rollback,Timesten将数据插入到Oracle中。
如果数据库关闭,无法再对表进行DML操作,Timesten被告知与数据库断开了连接。
Command> insert into customer values(151,'Wendy','NanHai Road',13);
5212: No longer connected to Oracle error in OCIStmtExecute(): ORA-03113: end-of-file on communication channel rc = -1
5055: Cannot synchronize Oracle with TimesTen. The TimesTen transaction must be rolled back.
5025: Commit failure in Oracle. Transaction must be rolled back in TimesTen.
5054: Detect loss of Oracle Connection (no error code) during rollback. Oracle rollback will be implicit
The command failed.
阅读(1532) | 评论(0) | 转发(0) |