ITPub博客

首页 > 数据库 > 数据库开发技术 > Timesten添加Cache Groups到 Cache Database

Timesten添加Cache Groups到 Cache Database

原创 数据库开发技术 作者:jolly10 时间:2012-03-27 17:02:53 0 删除 编辑
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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-20

  • 博文量
    263
  • 访问量
    768069