Timesten新增Cache Groups到 Cache Database

jolly10發表於2012-03-27
Timesten新增Cache Groups到 Cache Database[@more@]

1.用cacheadmin使用者登入cache database,並啟動cache agent
[timesten@rhel132 ~]$ ttisql

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


Command> connect "dsn=ljg_tt1122;uid=cacheadm;pwd=cacheadm;oraclepwd=cacheadm";
Connection successful: DSN=ljg_tt1122;UID=cacheadm;DataStore=/home/timesten/TimesTen/tt1122/info/ljg;DatabaseCharacterSet=WE8MSWIN1252;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1122/lib/libtten.so;LogDir=/home/timesten/TimesTen/tt1122/info/ljg/logs;PermSize=64;TempSize=32;TypeMode=0;OracleNetServiceName=orcl131;
(Default setting AutoCommit=1)
Command>

如果cache agent沒有啟動,則需要執行:
Command> call ttcachestart;

2.定義兩個cache group

按是否共享可以分為兩種cache groups,local cache group和global cache group, local cache group 不被其它cache grid其它成員共享,global cache group可以被cache grid的其它成員共享。
按是否updatable可以分為asynchronous writethrough和readonly兩種 。

按照文件,建立一個可讀寫的global和一個read only的cache group

Command> @/home/timesten/TimesTen/tt1122/quickstart/sample_scripts/cachegrid/create_global_awt.sql

create dynamic asynchronous writethrough global cache group g_awt from
hr.employees ( employee_id number (6) not null,
first_name varchar2(20),
last_name varchar2(25) not null,
email varchar2(25) not null,
phone_number varchar2(20),
hire_date date not null,
job_id varchar2(10) not null,
salary number (8,2),
commission_pct number (2,2),
manager_id number (6),
department_id number(4),
primary key (employee_id)),
hr.job_history (employee_id number(6) not null,
start_date date not null,
end_date date not null,
job_id varchar2(10) not null,
department_id number(4),
primary key (employee_id,start_date),
foreign key (employee_id)
references hr.employees (employee_id));
Command> @/home/timesten/TimesTen/tt1122/quickstart/sample_scripts/cachegrid/create_local_ro.sql

create readonly cache group ro
autorefresh
interval 5 seconds
mode incremental
from
hr.departments (
department_id number(4) not null primary key,
department_name varchar2(30) not null,
manager_id number(6),
location_id number(4));
Command>

透過cachegroups命令來驗證一下:

Command> cachegroups;

Cache Group CACHEADM.G_AWT:

Cache Group Type: Asynchronous Writethrough global (Dynamic)
Autorefresh: No
Aging: LRU on

Root Table: HR.EMPLOYEES
Table Type: Propagate


Child Table: HR.JOB_HISTORY
Table Type: Propagate

Cache Group CACHEADM.RO:

Cache Group Type: Read Only
Autorefresh: Yes
Autorefresh Mode: Incremental
Autorefresh State: Paused
Autorefresh Interval: 5 Seconds
Autorefresh Status: ok
Aging: No aging defined

Root Table: HR.DEPARTMENTS
Table Type: Read Only

2 cache groups found.

3.如果有asynchronous writethrough (AWT) cache groups,則需要開啟Replication agent。
Command> call ttrepstart;

4.如果有global的 cache groups,則需要執行ttgridattach 將此cache grid和cache database進行關聯。
call ttgridattach (1, 'cachedb1', 'tthost1', 9991);
Note: tthost1 is the host name of the machine where the database cachedb1_1122 is located. The TCP/IP port number 9991 is arbitrary, but it should not conflict with other TCP ports (e.g. ftp, telnet etc.), specifically the hostname + port combination should be unique.

我的例項需要執行:
Command> call ttgridattach (1,'cachdb1','rhel132',9991);

透過ttgridnodestatus來驗證
Command> call ttgridnodestatus;
< SAMPLEGRID, 1, 1, T, rhel132, SAMPLEGRID_cachdb1_1, 172.17.61.132, 9991, , , , , >
1 row found.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271283/viewspace-1057742/,如需轉載,請註明出處,否則將追究法律責任。

相關文章