Linux下TimesTen主备搭建、重建cache group、重建备机操作[TimesTen基础]

Linux下TimesTen主备搭建、重建cache group、重建备机操作
整个过程都比较简单,这里也就都不加描述了,适合初学者做为参考。
useradd   timesten
passwd  timesten
usermod -G oinstall timesten
mkdir  -p  /Timesten/tt11/logs
mkdir  -p  /Timesten/tt11/info
mkdir  -p  /Timesten/ttcheck/DataStore
mkdir  -p  /Timesten/tt11/ttlog
chown -R  timesten:timesten   /etc/TimesTen  /Timesten
==》配置环境变量,这里直接采用$TT_HOME/bin下的setenv.sh获得即可。
export TT_HOME=/Timesten/tt11
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/timesten/TimesTen/tt1121/lib
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=/home/timesten/TimesTen/tt1121/bin:$ORACLE_HOME/bin:$LD_LIBRARY_PATH:$PATH
==》解压安装介质
[timesten@ty102g Timesten]$ tar -xvf timesten112180.linux8664.tar
linux8664/
linux8664/doc/
linux8664/doc/doc.zip
linux8664/3rdparty/
linux8664/3rdparty/ant-1.6.2-bin.tar.bz2
linux8664/3rdparty/jms-1_1-fr-apidocs.tar.bz2
linux8664/install.pl
linux8664/setup.sh
linux8664/uninst.sh
linux8664/README.html
linux8664/LINUX8664/
linux8664/LINUX8664/manifest
linux8664/LINUX8664/perl
linux8664/LINUX8664/bzip2
linux8664/LINUX8664/unzip
linux8664/LINUX8664/ttpatchinst
linux8664/LINUX8664/common.tar.bz2
linux8664/LINUX8664/ttserver.tar.bz2
linux8664/LINUX8664/timesten.tar.bz2
linux8664/LINUX8664/ttclient.tar.bz2
[timesten@ty102g linux8664]$ cd linux8664
[timesten@ty102g linux8664]$ ./setup.sh
NOTE: Each TimesTen installation is identified by a unique instance name.
      The instance name must be a non-null alphanumeric string, not longer than 255 characters.
Please choose an instance name for this installation? [ tt1121 ]
Instance name will be 'tt1121'.
Is this correct? [ yes ]
Of the three components:
  [1] Client/Server and Data Manager
  [2] Data Manager Only
  [3] Client Only
Which would you like to install? [ 1 ]
Of the following options :
  [1] /home/timesten
  [2] /Timesten
  [3] Specify a location
  [q] Quit the installation
Where would you like to install the tt1121 instance of TimesTen? [ 1 ]
Where would you like to create the daemon home directory? [ /home/timesten/TimesTen/tt1121/info ] /Timesten/tt11/info
The daemon logs will be located in /Timesten/tt11/info
Would you like to specify a different location for the daemon logs? [ no ] yes
Where would you like the daemon logs to be written? [ /Timesten/tt11/info ] /Timesten/tt11/logs
Are you sure you want the daemon logs to be written to /Timesten/tt11/logs? [ yes ]
Installing into /home/timesten/TimesTen/tt1121 ...
Creating /home/timesten/TimesTen/tt1121 ...
Uncompressing ...
NOTE: If you are configuring TimesTen for use with Oracle Clusterware, the  daemon port number must be the same across all TimesTen installations  managed within the same Oracle Clusterware cluster.
NOTE: All installations that replicate to each other must use the same daemon  port number that is set at installation time. The daemon port number can be verified by running 'ttVersion'.
The default port number is 53388.
Do you want to use the default port number for the TimesTen daemon? [ yes ]
The daemon will run on the default port number (53388).
NOTE: For security, we recommend that you restrict access to the
TimesTen installation to members of a single OS group. Only members of that OS group will be allowed to perform direct mode connections to TimesTen, and only members of that OS group will be allowed to perform operations that access TimesTen data stores, TimesTen files and shared memory. The OS group defaults to the primary group of the instance administrator. You can default to this group, choose another OS group or you can make this instance world-accessible. If you choose to make  this instance world-accessible, all database files and shared memory are readable and writable by all users.
Restrict access to the the TimesTen installation to the group 'timesten'? [ yes ]
NOTE: Enabling PL/SQL will increase the size of some TimesTen libraries.
Would you like to enable PL/SQL for this instance? [ yes ] no
PL/SQL will not be enabled. It can be enabled later by running
/home/timesten/TimesTen/tt1121/bin/ttmodinstall.
In order to use the 'In-Memory Database Cache' feature in any databases
created within this installation, you must set a value for the TNS_ADMIN
environment variable. It can be left blank, and a value can be supplied later
using <install_dir>/bin/ttModInstall.
Please enter a value for TNS_ADMIN (s=skip)? [  ] s
NOTE: It appears that you are running version 4.1 of the g++ compiler. TimesTen ships with multiple sets of client libraries and server  binaries : one built for compatibility with g++ 3.4.6 and one with  g++ 4.1.0. The installer has created links to the 4.1.0 library in the <install_dir>/lib directory and to the 4.1.0 server binary in the  <install_dir>/bin directory. If you want to use a different compiler, please modify the links to point to the desired library and server binary.
Installing server components ...
What is the TCP/IP port number that you want the TimesTen Server to listen on? [ 53389 ]
Do you want to install QuickStart and the TimesTen Documentation? [ no ]
Would you like to install the documentation (without QuickStart)? [ yes ] no
Installing client components ...
Would you like to use TimesTen Replication with Oracle Clusterware? [ no ]
NOTE: The TimesTen daemon startup/shutdown scripts have not been installed.
Run the 'setuproot' script :
 cd /home/timesten/TimesTen/tt1121/bin
 ./setuproot -install
This will move the TimesTen startup script into its appropriate location.
The startup script is currently located here :
  '/home/timesten/TimesTen/tt1121/startup/tt_tt1121'.
The documentation was not installed.
To manually install the documentation, run the command 'setup.sh -installDoc'
The 11.2.1.8 Release Notes are located here :
  '/home/timesten/TimesTen/tt1121/README.html'
Starting the daemon ...
TimesTen Daemon startup OK.
End of TimesTen installation.
==》配置实例
vi sys.odbc.ini
[tytt]
Driver=/home/timesten/TimesTen/tt1121/lib/libtten.so
DataStore=/Timesten/ttcheck/DataStore/tytt
LogDir=/Timesten/tt11/logs
PermSize=100
TempSize=32
OracleNetServiceName=ora62a
DatabaseCharacterSet=ZHS16GBK
#UID=tt_ty
#PWD=tt_ty
==》启动/加载实例
[timesten@ty10dg info]$ ttisql tytt
Copyright (c) 1996-2011, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=tytt";
Connection successful: DSN=tytt;UID=ttty;DataStore=/Timesten/ttcheck/DataStore/tytt;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1121/lib/libtten.so;LogDir=/Timesten/tt11/logs;PermSize=100;TempSize=32;TypeMode=0;OracleNetServiceName=ora62a;
(Default setting AutoCommit=1)
[timesten@ty10dg info]$ ttadmin -ramPolicy manual tytt
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
[timesten@ty10dg info]$ ttisql "dsn=tytt;uid=ttty;pwd=ttty;oraclepwd=ttty"
Copyright (c) 1996-2011, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "dsn=tytt;uid=ttty;pwd=ttty;oraclepwd=ttty";
Connection successful: DSN=tytt;UID=ttty;DataStore=/Timesten/ttcheck/DataStore/tytt;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1121/lib/libtten.so;LogDir=/Timesten/tt11/logs;PermSize=100;TempSize=32;TypeMode=0;OracleNetServiceName=ora62a;
(Default setting AutoCommit=1)
Command> call ttcacheuidpwdset('ttty','ttty');
Command> call ttcachestart;
Command> call ttgridcreate('tygrid');
Command> call ttgridnameset('tygrid');
Command> create readonly cache group ty.tt_tyun_cache autorefresh interval 2 seconds from ty.tt_tyun (tid number not null primary key,tname varchar2(20),tpart number);
Command> create readonly cache group ty.tt_objects_cache autorefresh interval 1 seconds
       > from ty.tt_objects(object_id number not null primary key,owner varchar2(30),object_name varchar2(128),object_type varchar2(19),created date,last_ddl_time date,status varchar2(7));
Command> cachegroups;
Cache Group TY.TT_OBJECTS_CACHE:
  Cache Group Type: Read Only
  Autorefresh: Yes
  Autorefresh Mode: Incremental
  Autorefresh State: Paused
  Autorefresh Interval: 1 Second
  Autorefresh Status: ok
  Aging: No aging defined
  Root Table: TY.TT_OBJECTS
  Table Type: Read Only
Cache Group TY.TT_TYUN_CACHE:
  Cache Group Type: Read Only
  Autorefresh: Yes
  Autorefresh Mode: Incremental
  Autorefresh State: Paused
  Autorefresh Interval: 2 Seconds
  Autorefresh Status: ok
  Aging: No aging defined
  Root Table: TY.TT_TYUN
  Table Type: Read Only
2 cache groups found.
Command>
Command> load cache group ty.tt_tyun_cache commit every 100 rows;
4 cache instances affected.
Command> load cache group ty.tt_objects_cache commit every 200 rows parallel 2;
50072 cache instances affected.
Command> cachegroups;
Cache Group TY.TT_OBJECTS_CACHE:
  Cache Group Type: Read Only
  Autorefresh: Yes
  Autorefresh Mode: Incremental
  Autorefresh State: On
  Autorefresh Interval: 1 Second
  Autorefresh Status: ok
  Aging: No aging defined
  Root Table: TY.TT_OBJECTS
  Table Type: Read Only
Cache Group TY.TT_TYUN_CACHE:
  Cache Group Type: Read Only
  Autorefresh: Yes
  Autorefresh Mode: Incremental
  Autorefresh State: On
  Autorefresh Interval: 2 Seconds
  Autorefresh Status: ok
  Aging: No aging defined
  Root Table: TY.TT_TYUN
  Table Type: Read Only
2 cache groups found.
Command>
==》以上操作已经正常完成,下面重建cachegroup TY.TT_OBJECTS_CACHE;
Command> select count(*) from ty.tt_objects;
< 50072 >
1 row found.
Command> alter cache group ty.tt_objects_cache set autorefresh state paused;
Command> alter active standby pair exclude cache group ty.tt_objects_cache;
 8123: An ACTIVE STANDBY PAIR scheme does not exist
The command failed.
==》这里报错是因为没有建备机
Command> drop cache group ty.tt_objects_cache;
==》oracle端装载数据
SQL> truncate table tt_objects;
Table truncated.
SQL> insert into tt_objects(owner,object_name,object_id,object_type,created,last_ddl_time,status) select owner,object_name,object_id,object_type,created,last_ddl_time,status from dba_objects;
50104 rows created.
SQL> commit;
Commit complete.
Command> create readonly cache group ty.tt_objects_cache autorefresh interval 1 seconds
       > from ty.tt_objects(object_id number not null primary key,owner varchar2(30),object_name varchar2(128),object_type varchar2(19),created date,last_ddl_time date,status varchar2(7));
Command> load cache group ty.tt_objects_cache commit every 200 rows parallel 2;   
50104 cache instances affected.
Command> alter cache group ty.tt_objects_cache set autorefresh state paused;
Command> alter cache group ty.tt_tyun_cache set autorefresh state paused;
Command> create active standby pair tytt on ty10dg ,tytt on ty102g include cache group ty.tt_tyun_cache,ty.tt_objects_cache;
Command> repschemes;
Replication Scheme Active Standby:
  Master Store: TYTT on TY10DG
  Master Store: TYTT on TY102G
  Excluded Tables:
    None
  Excluded Cache Groups:
    None
  Excluded sequences:
    None
  Store: TYTT on TY10DG
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled
  Store: TYTT on TY102G
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled
1 replication scheme found.
Command> call ttrepstart;
Command> call ttrepstateset('ACTIVE');
Command> alter cache group ty.tt_tyun_cache set autorefresh state on;
Command> alter cache group ty.tt_objects_cache autorefresh state on;
==》重建备机
vi sys.odbc.ini
[tytt]
Driver=/home/timesten/TimesTen/tt1121/lib/libtten.so
DataStore=/Timesten/ttcheck/DataStore/tytt
LogDir=/Timesten/tt11/logs
PermSize=100
TempSize=32
OracleNetServiceName=ora62a
DatabaseCharacterSet=ZHS16GBK
#UID=ttty
#PWD=ttty
"sys.odbc.ini" 274L, 11369C written
[timesten@ty102g info]$ ttRepAdmin -duplicate -from tytt -host ty10dg -uid ttty -pwd ttty -setMasterRepStart  -ramLoad -compression 0 -verbosity 2  -keepCG -cacheUid ttty -cachePwd ttty -localhost ty102g -connStr "dsn=tytt"
11:13:06 Contacting remote main daemon at 192.168.64.62 port 53388
11:13:06 Contacting the replication agent for TYTT ON TY10DG (192.168.64.62) port 11141
11:13:07 Beginning transfer from TYTT ON TY10DG to TYTT ON TY102G
11:15:36 Checkpoint transfer 10 percent complete
11:15:37 Checkpoint transfer 100 percent complete
11:15:37 Checkpoint transfer phase complete
11:15:40 Log transfer 100 percent complete
11:15:40 Log transfer phase complete
11:15:41 Transfer complete
11:16:11 Duplicate Operation Ends
[timesten@ty102g info]$ ttisql tytt

Copyright (c) 1996-2011, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.

connect "DSN=tytt";
Connection successful: DSN=tytt;UID=timesten;DataStore=/Timesten/ttcheck/DataStore/tytt;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1121/lib/libtten.so;LogDir=/Timesten/tt11/logs;PermSize=100;TempSize=32;TypeMode=0;OracleNetServiceName=ora62a;
(Default setting AutoCommit=1)
Command> call ttrepstart;
Command> select count(*) from ty.tt_tyun;
< 5 >
1 row found.
Command>
==》oracle端
SQL> insert into tt_tyun values(6,'tangyun',2);
1 row created.
SQL> commit;
Commit complete.
==》主节点
Command> select count(*) from ty.tt_tyun;
< 6 >
1 row found.
==》备节点
Command> select count(*) from ty.tt_tyun;
< 6 >
1 row found.
--------------------------end--------------------------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值