1)软件安装
安装TimesTen
安装Oracle client[@more@]
一、准备工作
1)软件安装
安装TimesTen
安装Oracle client
2)在Oracle中创建一个让TimesTen访问的帐户
SQL> conn /as sysdba;
已连接。
SQL> create user tt_toms identified by tt_toms;
用户已创建。
SQL> grant connect,resource,create any trigger ,create session to tt_toms;
授权成功。
SQL>
3)create 一个dsn
我在这里创建了一个system dsn,命名为tt_study
4)create 一个帐户在dsn上
E:>ttisql tt_study
Copyright (c) 1996-2006, Oracle. All rights reserved.
Type or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.
connect "DSN=tt_study";
Connection successful: DSN=tt_study;UID=46192;DataStore=E:tt_dbdatatt_study;
DRIVER=C:WINDOWSsystem32ttdv60.dll;LogDir=e:tt_dbdatalog;PermSize=20;
(Default setting AutoCommit=1)
Command> create user tt_toms identified by 'tt_toms';
Command> grant ddl,admin to tt_toms;
Command> exit
Disconnecting...
Done.
5)修改DSN tt_study增加
User ID:tt_toms
Oracle ID:ora10
Oracle Password: tt_toms
保存退出,重新用ttisql 访问tt_study,你会发现:
E:>ttisql tt_study
Copyright (c) 1996-2006, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.
connect "DSN=tt_study";
Enter password for 'tt_toms':
Connection successful: DSN=tt_study;UID=tt_toms;DataStore=E:tt_dbdatatt_study
;DRIVER=C:WINDOWSsystem32ttdv60.dll;OracleId=ora10;LogDir=e:tt_dbdatalog;
PermSize=20;
(Default setting AutoCommit=1)
Command>
二、创建一个read only cache group
1)在Oracle上用tt_toms用户创建一个测试用的表
SQL> conn tt_toms/tt_toms@ora10
已连接。
SQL> create table tt_test (a int primary key);
表已创建。
SQL> insert into tt_test values(1);
已创建 1 行。
SQL> insert into tt_test values(2);
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from tt_test;
NO
----------
1
2
SQL>
2)创建一个cache group
E:>ttisql tt_study
Copyright (c) 1996-2006, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.
connect "DSN=tt_study";
Enter password for 'tt_toms':
Connection successful: DSN=tt_study;UID=tt_toms;DataStore=E:tt_dbdatatt_study
;DRIVER=C:WINDOWSsystem32ttdv60.dll;OracleId=ora10;LogDir=e:tt_dbdatalog;
PermSize=20;
(Default setting AutoCommit=1)
Command> call ttcacheuidpwdset('tt_toms','tt_toms');
Command> call ttcachestart();
Command> create readonly cache group tt_cache autorefresh interval 2 seconds from tt_test(a int primary key);
Command>
3)Load Cache Group
Command> load cache group tt_cache commit every 2 rows;
2 rows affected.
Command> select *from tt_test;
< 1 >
< 2 >
2 rows found.
Command> cachegroups;
Cache Group TT_TOMS.TT_CACHE:
Cache Group Type: Read Only
Autorefresh: Yes
Autorefresh Mode: Incremental
Autorefresh State: On
Autorefresh Interval: 2 Seconds
Autorefresh Limit: 10000
Root Table: TT_TOMS.TT_TEST
Table Type: Read Only
1 cache group found.
Command>
4)测试
在oracle上在插入一行数据
SQL> insert into tt_test values(3);
已创建 1 行。
SQL> commit;
提交完成。
SQL>
到TimesTen上验证一下
Command> select *from tt_test;
< 1 >
< 2 >
< 3 >
3 rows found.
5)删除Cache Group
drop cache group tt_cache;
6)stop cache group agent
call ttcachestop();
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9099175/viewspace-905063/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9099175/viewspace-905063/