- 在ORACLE 中创建 timesten用户及内部表
#Timesten端运行
[timesten@XAG816 setup]$ cd $TT_HOME/oraclescripts
[timesten@XAG816 oraclescripts]$ pwd
/home/timesten/TimesTen/tt1122/oraclescripts
[timesten@XAG816 oraclescripts]$ sqlplus sys/123456@DG as sysdba
SQL> select FILE_NAME from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u02/oradata/DG/users01.dbf
/u02/oradata/DG/undotbs01.dbf
/u02/oradata/DG/sysaux01.dbf
/u02/oradata/DG/system01.dbf
SQL>
create tablespace cachetblsp datafile
'/u02/oradata/DG/cachetblsp_1.dbf' size 64M AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED,
'/u02/oradata/DG/cachetblsp_2.dbf' size 64M AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED
default storage (initial 128K next 2M pctincrease 0);
SQL> @initCacheGlobalSchema "cachetblsp"
Please enter the tablespace where TIMESTEN user is to be created
The value chosen for tablespace is cachetblsp
******* Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE starts *******
1. Creating TIMESTEN schema
2. Creating TIMESTEN.TT_GRIDID table
3. Creating TIMESTEN.TT_GRIDINFO table
4. Creating TT_CACHE_ADMIN_ROLE role
5. Granting privileges to TT_CACHE_ADMIN_ROLE
** Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE done successfully **
PL/SQL procedure successfully completed.
- 将oracle 下的ttuser 用户作为缓存表的宿主&创建测试用表
#Timesten端运行
[timesten@XAG816 hrschema]$ cd $TT_HOME/quickstart/sample_scripts/hrschema
[timesten@XAG816 hrschema]$ pwd
/home/timesten/TimesTen/tt1122/quickstart/sample_scripts/hrschema
[timesten@XAG816 hrschema]$ ls
hr_cre_tt.sql hr_idx_tt.sql hr_popul_tt.sql README.TXT
[timesten@XAG816 hrschema]$ sqlplus ttuser/oracle@DG
SQL> @hr_cre_tt.sql
SQL> @hr_idx_tt.sql
SQL> @hr_popul_tt.sql
- Oracle 中创建缓存管理用户cacheadm 并赋权
#Timesten端运行
[timesten@XAG816 hrschema]$ cd $TT_HOME/oraclescripts
[timesten@XAG816 oraclescripts]$ pwd
/home/timesten/TimesTen/tt1122/oraclescripts
[timesten@XAG816 oraclescripts]$ ls
cacheCleanUp.sql cacheInfo.sql grantCacheAdminPrivileges.sql initCacheAdminSchema.sql
initCacheGlobalSchema.sql initCacheGridSchema.sql README.TXT supporting_scripts
ttca_setupRepository.sql ttca_setupTarget.sql
[timesten@XAG816 oraclescripts]$ sqlplus sys/123456@DG as sysdba
SQL> create user cacheadm identified by oracle default tablespace cachetblsp quota unlimited on cachetblsp;
SQL> @grantCacheAdminPrivileges "cacheadm"
Please enter the administrator user id
The value chosen for administrator user id is cacheadm
***************** Initialization for cache admin begins ******************
0. Granting the CREATE SESSION privilege to CACHEADM
1. Granting the TT_CACHE_ADMIN_ROLE to CACHEADM
2. Granting the DBMS_LOCK package privilege to CACHEADM
3. Granting the DBMS_DDL package privilege to CACHEADM
4. Granting the CREATE SEQUENCE privilege to CACHEADM
5. Granting the CREATE CLUSTER privilege to CACHEADM
6. Granting the CREATE OPERATOR privilege to CACHEADM
7. Granting the CREATE INDEXTYPE privilege to CACHEADM
8. Granting the CREATE TABLE privilege to CACHEADM
9. Granting the CREATE PROCEDURE privilege to CACHEADM
10. Granting the CREATE ANY TRIGGER privilege to CACHEADM
11. Granting the GRANT UNLIMITED TABLESPACE privilege to CACHEADM
12. Granting the DBMS_LOB package privilege to CACHEADM
13. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEADM
14. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEADM
15. Granting the SELECT ANY TRANSACTION privilege to CACHEADM
16. Granting the EXECUTE DBMS_FLASHBACK privilege to CACHEADM
17. Checking if the cache administrator user has permissions on the default
tablespace
Permission exists
19. Granting the CREATE TYPE privilege to CACHEADM
20. Granting the SELECT on SYS.GV$LOCK privilege to CACHEADM (optional)
21. Granting the SELECT on SYS.GV$SESSION privilege to CACHEADM (optional)
22. Granting the SELECT on SYS.DBA_DATA_FILES privilege to CACHEADM (optional)
23. Granting the SELECT on SYS.USER_USERS privilege to CACHEADM (optional)
24. Granting the SELECT on SYS.USER_FREE_SPACE privilege to CACHEADM (optional)
25. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to CACHEADM (optional)
26. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to CACHEADM (optional)
********* Initialization for cache admin user done successfully *********
- 配置Timesten 缓存数据库的DSN
[timesten@XAG816 admin]$ sqlplus sys/123456@DG as sysdba
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
--------------------------------------------------------------------------------
AL32UTF8
[timesten@XAG816 network]$ cd $TT_HOME/info
[timesten@XAG816 info]$ pwd
/home/timesten/TimesTen/tt1122/info
[timesten@XAG816 info]$ sed -n '/\[cachedb1_1122\]/,/^$/p' sys.odbc.ini
[cachedb1_1122]
Driver=/home/timesten/TimesTen/tt1122/lib/libtten.so
DataStore=/etc/TimesTen/DemoDataStore/cachedb1_1122
PermSize=40
TempSize=32
PLSQL=1
DatabaseCharacterSet=AL32UTF8
OracleNetServiceName=DG
[timesten@XAG816 oraclescripts]$ ttisql cachedb1_1122
Command> call ttconfiguration('DataBaseCharacterSet');
< DataBaseCharacterSet, AL32UTF8 >
- 在TimesTen 数据库中创建用户(缓存管理用户cacheadm,缓存用户ttuser【已创建】)
[timesten@XAG816 oraclescripts]$ ttisql cachedb1_1122
Command> create user cacheadm identified by timesten;
Command> grant create session, cache_manager, create any table, drop any table to cacheadm;
- 在TimesTen 数据库中设置缓存管理员账户
#将oracle 数据库中缓存管理员的用户名和密码存储在timesten中
[timesten@XAG816 oraclescripts]$ ttisql "DSN=cachedb1_1122; uid = cacheadm; pwd = timesten"
Command> call ttCacheUidPwdSet('cacheadm','oracle');
Command> call ttCacheUidGet();
< CACHEADM >
- 初始化TimesTen缓存框架
[timesten@XAG816 oraclescripts]$ ttisql "DSN=cachedb1_1122; uid = cacheadm; pwd = timesten; oraclepwd = oracle"
Command> call ttGridCreate('samplegrid');
Command> call ttGridNameSet('samplegrid');
#查看设置的网格信息
Command> call ttGridInfo;
< SAMPLEGRID, CACHEADM, Linux x86-64, 64-bit, 11, 2, 2 >
Command> call ttGridNameGet;
< SAMPLEGRID >
- 缓存与复制代理管理
# 查询代理运行状态
[timesten@XAG816 ~]$ ttAdmin -query cachedb1_1122 | grep Started
Replication Manually Started : False
Cache Agent Manually Started : False
#启动缓存代理
[timesten@XAG816 ~]$ ttAdmin -cacheStart cachedb1_1122
RAM Residence Policy : inUse
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : True
#停缓存代理
[timesten@XAG816 ~]$ ttAdmin -cacheStop cachedb1_1122
RAM Residence Policy : inUse
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
#启动复制代理 (未定义和复制相关的缓存组,所以本次启动报错)
[timesten@XAG816 ~]$ ttAdmin -repStart cachedb1_1122
*** [TimesTen][TimesTen 11.2.2.8.47 ODBC Driver][TimesTen]TT8191:
This store (CACHEDB1_1122 on XAG816.COM) is not involved in a replication scheme
-- file "eeMisc.c", lineno 2768, procedure "sbEeGridErrorProc"
*** ODBC Error = S1000, TimesTen Error = 8191
#停复制代理
[timesten@XAG816 ~]$ ttAdmin -repStop cachedb1_1122
*** [TimesTen][TimesTen 11.2.2.8.47 ODBC Driver][TimesTen]TT12027:
The agent is already stopped for the data store.
*** ODBC Error = S1000, TimesTen Error = 12027