4、停掉 Daemon
启动反之。
二、启动实战。
1、起tt主守护进程:
ocs1节点:
ttdaemonadmin -start
tt@ocs1[/tt]$ttdaemonadmin -start
TimesTen Daemon startup OK.
ocs2节点:
tt@ocs2[/tt]$ttdaemonadmin -start
TimesTen Daemon startup OK.
此时查看tt状态:
tt@ocs1[/tt]$ttstatus
TimesTen status report as of Tue Jun 5 11:00:51 2018
Daemon pid 3384 port 53396 instance tt11
TimesTen server pid 3393 started on port 53397
------------------------------------------------------------------------
Data store /tt/DS/ocs
There are no connections to the data store
RAM residence policy: Manual
Data store is manually unloaded from RAM
Replication policy : Manual
Cache Agent policy : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group tt
End of report
没有任何进程信息,可以看到,daemon进程会自动启动tt server进程。
2、装载DS到内存:
ttadmin -ramload ocs
ocs1执行:
tt@ocs1[/tt]$ttadmin -ramload ocs
RAM Residence Policy : manual
Manually Loaded In RAM : True
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
ocs2执行:
tt@ocs2[/tt]$ttadmin -ramload ocs
RAM Residence Policy : manual
Manually Loaded In RAM : True
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
3、更改加载内存策略为always:
ttadmin -rampolicy always ocs
ocs1执行
tt@ocs1[/tt]$ttadmin -rampolicy always ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
ocs2执行:
tt@ocs2[/tt]$ttadmin -rampolicy always ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
4、启动replication复制进程:
ttadmin -repstart ocs
ocs1执行:
tt@ocs1[/tt]$ttadmin -repstart ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : True
Cache Agent Policy : manual
Cache Agent Manually Started : False
ocs2执行:
tt@ocs2[/tt]$ttadmin -repstart ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : True
Cache Agent Policy : manual
Cache Agent Manually Started : False
5、更改复制进程策略为always:
ttadmin -reppolicy always ocs
ocs1节点执行:
tt@ocs1[/tt]$ttadmin -reppolicy always ocs
RAM Residence Policy : always
Replication Agent Policy : always
Cache Agent Policy : manual
Cache Agent Manually Started : False
ocs2节点执行:
tt@ocs2[/tt]$ttadmin -reppolicy always ocs
RAM Residence Policy : always
Replication Agent Policy : always
Cache Agent Policy : manual
Cache Agent Manually Started : False
5、验证复制是否正常:
ocs1执行:
tt@ocs1[/tt]$ttisql ocs
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=ocs";
Connection successful: DSN=ocs;UID=tt;DataStore=/tt/DS/ocs;DatabaseCharacterSet=TIMESTEN8;ConnectionCharacterSet=TIMESTEN8;AutoCreate=0;LogFileSize=40;DRIVER=/tt/TimesTen/tt11/lib/libtten.so;PermSize=32;TempSize=37;LockWait=1;CkptRate=40;CkptFrequency=300;CkptLogVolume=0;PrivateCommands=1;RecoveryThreads=3;TypeMode=0;LogBufMB=40;LogBufParallelism=5;
(Default setting AutoCommit=1)
Command> select * from test01 ;
< 1 >
< 2 >
< 3 >
3 rows found.
Command> insert into test01 values(4) ;
1 row inserted.
Command> select * from test01 ;
< 1 >
< 2 >
< 3 >
< 4 >
4 rows found.
Command>
在ocs2上查看是否已经复制:
tt@ocs2[/tt]$ttisql ocs
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=ocs";
Connection successful: DSN=ocs;UID=tt;DataStore=/tt/DS/ocs;DatabaseCharacterSet=TIMESTEN8;ConnectionCharacterSet=TIMESTEN8;AutoCreate=0;LogFileSize=40;DRIVER=/tt/TimesTen/tt11/lib/libtten.so;PermSize=32;TempSize=37;LockWait=1;CkptRate=40;CkptFrequency=300;CkptLogVolume=0;PrivateCommands=1;RecoveryThreads=3;TypeMode=0;LogBufMB=40;LogBufParallelism=5;
(Default setting AutoCommit=1)
Command> select * from test01 ;
< 1 >
< 2 >
< 3 >
< 4 >
4 rows found.
Command>
复制正常,可以在ocs2插入看ocs1是否正常同步:
tt@ocs2[/tt]$ttisql ocs
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=ocs";
Connection successful: DSN=ocs;UID=tt;DataStore=/tt/DS/ocs;DatabaseCharacterSet=TIMESTEN8;ConnectionCharacterSet=TIMESTEN8;AutoCreate=0;LogFileSize=40;DRIVER=/tt/TimesTen/tt11/lib/libtten.so;PermSize=32;TempSize=37;LockWait=1;CkptRate=40;CkptFrequency=300;CkptLogVolume=0;PrivateCommands=1;RecoveryThreads=3;TypeMode=0;LogBufMB=40;LogBufParallelism=5;
(Default setting AutoCommit=1)
Command> select * from test01 ;
< 1 >
< 2 >
< 3 >
< 4 >
4 rows found.
Command> insert into test01 values(5);
1 row inserted.
Command> select * from test01 ;
< 1 >
< 2 >
< 3 >
< 4 >
< 5 >
5 rows found.
Command>
在ocs1上查看是否同步:
tt@ocs1[/tt]$ttisql ocs
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=ocs";
Connection successful: DSN=ocs;UID=tt;DataStore=/tt/DS/ocs;DatabaseCharacterSet=TIMESTEN8;ConnectionCharacterSet=TIMESTEN8;AutoCreate=0;LogFileSize=40;DRIVER=/tt/TimesTen/tt11/lib/libtten.so;PermSize=32;TempSize=37;LockWait=1;CkptRate=40;CkptFrequency=300;CkptLogVolume=0;PrivateCommands=1;RecoveryThreads=3;TypeMode=0;LogBufMB=40;LogBufParallelism=5;
(Default setting AutoCommit=1)
Command> select * from test01 ;
< 1 >
< 2 >
< 3 >
< 4 >
< 5 >
5 rows found.
Command>
ok。双向复制都正常。
三、停tt实战。
1、停replication代理。
在使用ttamdin -repstop ocs停代理进程之前,需要先把复制策略改为手动manual,否则直接停会报错:
tt@ocs1[/tt]$ttadmin -repstop ocs
*** [TimesTen][TimesTen 11.2.2.8.0 ODBC Driver][TimesTen]TT10016: Replication Agent was not stopped due to repPolicy setting.
*** ODBC Error = S1000, TimesTen Error = 10016
咱们可以看下错误码10016是什么意思。
10016 Replication Agent was not
stopped due to repPolicy
setting
An attempt has been made to stop a
replication agent for a database, but the
replication policy is set to "always." See
"Starting and stopping the replication
agents" in the Oracle TimesTen In-Memory
Database Replication Guide for information on
setting the replication policy.
意思就是复制策略是always的情况下,不允许停复制进程。
咱们先改为manual后在停:
ttadmin -reppolicy manual ocs
ocs1节点执行:
tt@ocs1[/tt]$ttadmin -reppolicy manual ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : True
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs1[/tt]$
然后在停replication进程:
ttadmin -repstop ocs
tt@ocs1[/tt]$ttadmin -repstop ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs1[/tt]$
然后在节点ocs2上执行一遍:
tt@ocs2[/tt]$ttadmin -reppolicy manual ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : True
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs2[/tt]$ttadmin -repstop ocs
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs2[/tt]$
2、停掉server进程
ocs1上执行:
ttdaemonadmin -stopserver
tt@ocs1[/tt]$ttdaemonadmin -stopserver
TimesTen Server stopped.
tt@ocs1[/tt]$
ocs2上执行:
tt@ocs2[/tt]$ttdaemonadmin -stopserver
TimesTen Server stopped.
tt@ocs2[/tt]$
3、卸载内存:
ttadmin -ramUnload ocs
tt@ocs1[/tt]$ttadmin -ramUnload ocs
ttAdmin: TimesTen Error: 10010; RAM unload ignored due to ramPolicy setting
tt@ocs1[/tt]$
看看官方文档怎么说:
意思就是你不能在设置了内存管理策略是always的情况下去卸载内存。要设置成manual。
按他说的来。
ttadmin -ramPolicy manual ocs
ocs1执行内存策略为manual。
tt@ocs1[/tt]$ttadmin -ramPolicy manual ocs
RAM Residence Policy : manual
Manually Loaded In RAM : True
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs1[/tt]$
ocs2执行:
tt@ocs2[/tt]$ttadmin -ramPolicy manual ocs
RAM Residence Policy : manual
Manually Loaded In RAM : True
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs2[/tt]$
然后卸载内存:
ttadmin -ramunload ocs
ocs1执行:
tt@ocs1[/tt]$ttadmin -ramunload ocs
RAM Residence Policy : manual
Manually Loaded In RAM : False
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs1[/tt]$
ocs1执行:
tt@ocs2[/tt]$ttadmin -ramunload ocs
RAM Residence Policy : manual
Manually Loaded In RAM : False
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
tt@ocs2[/tt]$
4、停daemon主进程。
ttdaemonadmin -stop
ocs1执行:
tt@ocs1[/tt]$ttdaemonadmin -stop
TimesTen Daemon stopped.
tt@ocs1[/tt]$
ocs2执行:
tt@ocs2[/tt]$ttdaemonadmin -stop
TimesTen Daemon stopped.
tt@ocs2[/tt]$
到此tt的启停就都演示完了。