27: active ip 26:standby ip
datastore 27 a(active), 26 a (standby)
=================setup==================
1. create the datastore on 27
[a]
Driver=/home/abm/TimesTen/abm/lib/libtten.a
DataStore=/abm2data/datastore/a
LogDir=/abm2data/log/a
ConnectionCharacterSet=ZHS16GBK
DatabaseCharacterSet=ZHS16GBK
PermSize=128
TempSize=20
LogBuffSize=131072
LogFileSize=128
PrivateCommands=1
CkptLogVolume=0
CkptFrequency=300
RecoveryThreads=16
OracleID=oragc
PassThrough=0
WaitForConnect=0
Connections=100
Authenticate=1
DurableCommits=0
UID=abm2
PWD=abm2
ORACLEPWD=abm2
2. create user on 27
$ ttisql TT_ABM
Copyright (c) 1996-2008, 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_ABM";
Connection successful: DSN=TT_abm;UID=abm;DataStore=/home/abm/TimesTen/abm/info/TT_abm;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/abm/TimesTen/abm/lib/libtten.a;TypeMode=0;
(Default setting AutoCommit=1)
Command> create user abm2 identified by 'abm2';
Command> grant all to abm2;
3. create datastore on 26
[a]
Driver=/home/abm/TimesTen/abm/lib/libtten.a
DataStore=/home/abm/TimesTen/abm/test/a
LogDir=/home/abm/TimesTen/abm/test
ConnectionCharacterSet=ZHS16GBK
DatabaseCharacterSet=ZHS16GBK
PermSize=128
TempSize=20
LogBuffSize=131072
LogFileSize=128
PrivateCommands=1
CkptLogVolume=0
CkptFrequency=300
RecoveryThreads=16
OracleID=oragc
PassThrough=0
WaitForConnect=0
Connections=100
Authenticate=0
DurableCommits=0
UID=abm2
PWD=abm2
ORACLEPWD=abm2
4. create user on 26
$ ttisql TT_ABM
Copyright (c) 1996-2008, 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_ABM";
Connection successful: DSN=TT_abm;UID=abm;DataStore=/home/abm/TimesTen/abm/info/TT_abm;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/abm/TimesTen/abm/lib/libtten.a;TypeMode=0;
(Default setting AutoCommit=1)
Command> create user abm2 identified by 'abm2';
Command> grant all to abm2;
5. create cached table on oracle
create table readtab(a number not null primary key, b varchar2(31));
insert into readtab values(1,'hello');
insert into readtab values(2,'world');
6. create table on tt at 27 for replication
create table test(a int, primary key (a));
insert into test values(1);
commit;
7. create cache group at 27 on tt
call ttCacheUidPwdSet('abm2','abm2');
call ttCacheStart;
create readonly cache group readcache autorefresh interval 1 seconds from readtab(a number not null primary key, b varchar2(31));
load cache group readcache commit every 256 rows;
select * from readtab;
8. set cache group autorefresh state paused for create active-standby pair at 27 on tt
alter cache group readcache set autorefresh state paused;
9. create active-standby pair on tt at 27
CREATE ACTIVE STANDBY PAIR dsn2 ON "abm_app2", dsn2 ON "abm_app1"
RETURN TWOSAFE
STORE dsn2 ON "abm_app2" TIMEOUT 30
STORE dsn2 ON "abm_app1" TIMEOUT 30
Exclude CACHE GROUP ABM2.READCACHE;
10. start replication agent & set 27 tt as the active role on tt
call ttrepstart;
call ttrepstateset('ACTIVE');
11. at 26, duplicate the datastore from 27
ttrepadmin -duplicate -from abmdsn -host "abm_app2" -compression 1 -nokeepCG -UID "abmbill" -PWD "bill" -localhost "abm_app1" abmdsn
12. at 26, on tt
call ttrepstart;
call ttrepstateget;
< STANDBY >
13. on 27, insert
insert into test values(3);
commit;
14. on 26, verify the result
Command> select * from test;
< 1 >
< 2 >
15. at 27, on tt
alter cache group readcache set autorefresh state on;
16. create cache group at 26
drop table ABM2.READTAB;
call ttrepstop;
call ttCacheUidPwdSet('abm2','abm2');
call ttCacheStart;
create readonly cache group readcache autorefresh interval 1 seconds from readtab(a number not null primary key, b varchar2(31));
load cache group readcache commit every 256 rows;
select * from readtab;
17. at 26, start replication on tt
call ttrepstart;
18. on oracle, insert for test cache group;
SQL> insert into readtab values(19,'t');
1 row created.
SQL> commit;
Commit complete.
19. verify cache table on 26, 27
select * from readtab;
20. test replication, insert from 27, verify from 26
Command> insert into test values(4);
1 row inserted.
Command> commit;