TimesTen In-Memory Database Cache 配置整理

TimesTen In-Memory Database Cache 配置其实在在TimesTen Quick Start有详细说明,在这里用自已的语言整理总结一下,方便查阅。这里使用TimesTen 11.2.2在widnows平台下操作(http://www.cnblogs.com/mlog/)

一,oracle配置

(以:sqlplus sys@orcl as sysdba)
1,在oracle创建一个专用表空间用于管理缓存到timesten 的对象
  create tablespace ttusers datafile 'ttusers.dbf' SIZE 40M;
2,创建timesten用户:运行initCacheGlobalSchema.sql脚本来创建用户
  @D:\TimesTen\tt1122_32\oraclescripts\initCacheGlobalSchema.sql 'ttusers'
3,创建一个cache管理用户,这个用户负责追踪oracle database和cache database之间数据的改变
  create user cacheadm identified by cacheadm
  default tablespace ttusers
  quota unlimited on ttusers
  temporary tablespace temp;
4,授予系统管理权限给cache管理用户,即3,创建的cacheadm用户 运行grantCacheAdminPrivileges.sql即可
  @D:\TimesTen\tt1122_32\oraclescripts\grantCacheAdminPrivileges.sql
5,授予数据访问权限给cache管理用户,即对表的select, insert, update, delete之类的权限
如:conn scott/tiger
  grant select on scott.dept to cacheadm;
  grant select,insert,update,delete on scott.emp to cacheadm;
  grant select,insert,update,delete on scott.bonus to cacheadm;

二, TimesTen配置

1,创建一个DSN实例: OracleNetServiceName为oracle数据库实例名。DatabaseCharacterSet与oracle数据库一致。User ID:为与oracle一致的Cache Administration 用户(创建时先不写,等一下写)
ttisql;
  connect my_ttdb;
2,创建一个Cache Manager 用户,授予admin或者cache_manager权限,此用户负责设置和管理cache grid 和cache group 操作,授与oracle配置3中用户名一致.
  create user cacheadm identified by cacheadm;
  grant admin to cacheadm;
3,创建Cache Table 用户,与oracle实际用户一致.
  create user scott identified by scott;
  grant create session to scott;
4,将oracle cache管理用户与timesten关联
  call ttcacheuidpwdset ('cacheadm','cacheadm');
  call ttcacheuidget;
5,创建一个cache grid.
  call ttcacheuidpwdset ('cacheadm','cacheadm');
  call ttcacheuidget;查看创建信息
6,将cache database 和cache grid关联
  call ttgridnameset ('samplegrid');

  1. 三,添加缓存组到内存数据库

1,启动cache agent高速缓存代理,cache agent进程负责cache database之间的够沟通,同时也负责oracle database 到cache database之间的数据流。
  connect XX;
  call ttcachestart;
2, 根据需要创建CREATE CACHE GROUP,如:
  create readonly cache group ro autorefresh
  interval 5 seconds mode incremental
  from scott.dept(
  deptno number(2) not null primary key,
  dname varchar2(14),
  loc varchar2(13));

3,启动复制代理,如果数据库中有asynchronous writethrough cache groups就必须要启动这个agent,这个进程负责TT数据库之间,TT和oracle之间的数据复制。
  call ttrepstart;
4,将高速缓存数据库高速缓存网格(只有当当前数据库包含global cache groups或者需要进行global cache grid操作时才需要这一步骤,注:windows不支持)
  call ttgridattach(1,'my_ttdb','liyanwei',9991);
  call ttgridnodestatus;//
5,使用LOAD CACHE GROUP语句来预加载数据。如下
  load cache group RO commit every 1 rows;

完成!

  靓点博客在0与1之间的博客

 

posted @ 2012-11-27 10:24  靓点博客  阅读(1818)  评论(0编辑  收藏  举报