passthrough特性实验(TimesTen)

所谓passthrough是指,TT中可以设定,当SQL语句检索的表在TT实例中不存在,那么将自动去后台的Oracle数据库中查询,并将查询的结果返回到TT中。这也是我们可以通过只读Cache Group来更新Oracle数据的方法。

0:PASSTHROUGH 0意味着关闭PASSTHROUGH功能。
1:设置了PASSTHROUGH等于1,则对于Timesten中不存在的表,会将SQL传到Oracle去执行。
2:PASSTHROUGH等于2就是在PASSTHROUGH 1的基础上增加了只读表的判断。
3:如果设置了PASSTHROUGH等于3,则不管是DDL还是DML,甚至是查询,都会将SQL发到Oracle中执行。
   即使访问的对象在timesten数据库中存在,而在Oracle中不存在。
  
  
1.insert record on readonly table and query table no exist in tt

Command> autocommit 0 ;
Command> passthrough 0;
Command>
Command> insert into readtable values(1,sysdate);
8225: Table READTABLE is read only
The command failed.

Command> select * from v$session;
2206: Table ABM2.V$SESSION not found
The command failed.

--->passthrough=0,需要先设置autocommit=0。


2.passthrough = 1

Command> tables abm2.%;
ABM2.AWTTABLE
ABM2.READTAB
ABM2.READTABLE
ABM2.REPTABLE
ABM2.SWTTABLE
ABM2.T1
6 tables found.

Command> passthrough 1;
Command>
Command> select * from tab;
< AWTTABLE, TABLE, <NULL> >
< PASSTH, TABLE, <NULL> >
< READTAB, TABLE, <NULL> >
< READTABLE, TABLE, <NULL> >
< READTABLE1, TABLE, <NULL> >
< SWTTABLE, TABLE, <NULL> >
< TT_03_1418946_L, TABLE, <NULL> >
< TT_03_1495041_L, TABLE, <NULL> >
< TT_03_AGENT_STATUS, TABLE, <NULL> >
< TT_03_REPACTIVESTANDBY, TABLE, <NULL> >
< TT_03_REPPEERS, TABLE, <NULL> >
< TT_03_SYNC_OBJS, TABLE, <NULL> >
< TT_03_USER_COUNT, TABLE, <NULL> >
13 rows found.
Command>
Command> select * from passth;
< 1, sss >
< 2, ddd >
2 rows found.

----》在tt里面不存在的表,如果passthrough=1,则会把sql语句传到oracle端执行。

Command> insert into passth values(3,'ddd');
1 row inserted.
Command> commit;
Command> select * from passth;
2206: Table ABM2.PASSTH not found
The command failed.

Command> passthrough 1;
Command> select * from passth;
< 1, sss >
< 2, ddd >
< 3, ddd >
3 rows found.

---》如果在会话中设置passthrough属性值,一旦进行了commit操作,则passthrough属性值则失效,如果需要保持长期
有效,则需要在dsn配置中设置。


3.passthrough = 2

Command> passthrough 2;
Command>
Command> select * from passth;
< 1, sss >
< 2, ddd >
< 3, ddd >
3 rows found.
Command>
Command> insert into readtable values(10,sysdate);
1 row inserted.
Command> commit;
Command> select * from readtable;
< 2, AAA >
< 3, eee >
< 5, eee >
< 10, 2009-08-13 11:03:11.000000 >
4 rows found.

---》从步骤1中可以看出,如果没有设置passthrough=2,则对readonly的表是不能进行dml操作。


4.passthrough = 3

Command> passthrough 3;
Command>
Command> insert into t1 values(12,12);
5221: Oracle syntax error in OCIStmtExecute(): ORA-00942: table or view does not exist rc = -1
The command failed.

Command> insert into awttable values(10,'fff');
1 row inserted.
Command> commit;
Command> passthrough 3;
Command> select * from awttable;
< 1, BBBBB >
< 8, BBBBB >
< 10, fff >
< 9, fff >
4 rows found.
Command>
Command> passthrough 0;
Command> select * from awttable;
< 1, AAAA >
< 2, bbbb >
< 3, cccc >
< 4, DDD >
< 5, dddddd >
< 6, dddddd >
< 7, dddddd >
< 8, BBBBB >
< 9, fff >
9 rows found.

-----》如果设置了PASSTHROUGH等于3,则不管是DDL还是DML,甚至是查询,都会将SQL发到Oracle中执行。
   即使访问的对象在timesten数据库中存在,而在Oracle中不存在。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值