码迷,mamicode.com
首页 > 数据库 > 详细

TimesTen 应用层数据库缓存学习:12. 管理缓存环境

时间:2016-04-26 22:16:43      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:

缓存和复制代理的启停和状态查看

cache agent的作用是将监控Oracle中数据的变化,并更新到TimesTen。因此,对于只读和AWT缓存组,cache agent都是必需的。

cache agent的启停

ttisql> call ttcachestart
ttisql> call ttcachestop
或者
$ ttadmin -cachestart DSN
$ ttadmin -cachestop DSN

replication agent的启停

ttisql> call ttrepstart
ttisql> call ttrepstop
或者
$ ttadmin -repstart DSN
$ ttadmin -repstop DSN

cache agent 和 replication agent的状态查看

法一,通过ttadmin

[oracle@timesten-hol ~]$ ttadmin -query cachedb1_1122
RAM Residence Policy            : inUse
Replication Agent Policy        : manual
Replication Manually Started    : False <- 未启动
Cache Agent Policy              : manual
Cache Agent Manually Started    : True <- 已启动

法二,通过ttstatus(见底部)

[oracle@timesten-hol ~]$ ttstatus cachedb1_1122
TimesTen status report as of Thu Apr 21 02:47:00 2016

Daemon pid 2705 port 53396 instance tt1122
TimesTen server pid 2714 started on port 53397
------------------------------------------------------------------------
Data store /home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1_1122
There are 25 connections to the data store
Shared Memory KEY 0x6300c874 ID 2392081
PL/SQL Memory KEY 0x6400c874 ID 2424850 Address 0x7fa0000000
Type            PID     Context             Connection Name              ConnID
Cache Agent     3938    0x00000000025b5b10  Handler                           2
Cache Agent     3938    0x000000000270d2b0  Timer                             3
Cache Agent     3938    0x00000000029c3930  LogSpaceMon(1093421376)           1
Cache Agent     3938    0x0000000002d66ed0  Marker(1101457728)                4
Process         5353    0x00000000020483a0  cachedb1                          7
Process         5353    0x00007f06e12e4c10  cachedb1                          6
Replication     5501    0x0000000003a1da60  LOGFORCE:0x4182b940             129
Replication     5501    0x0000000003a87570  REPHOLD:0x40c97940              130
Replication     5501    0x0000000003aac800  REPLISTENER:0x40f98940          131
Replication     5501    0x0000000003b13f10  TRANSMITTER(M):0x41f90940       128
Replication     5501    0x0000000003b87c00  RECEIVER:0x42291940             127
Replication     5501    0x0000000003e42320  AWT_SORTER:0x42592940           126
Replication     5501    0x0000000003e575a0  AWT_APPLIER:0x42893940          125
Replication     5501    0x0000000003e6c820  AWT_APPLIER:0x42b94940          124
Subdaemon       2709    0x00000000012ac360  Manager                         142
Subdaemon       2709    0x0000000001323ac0  Rollback                        141
Subdaemon       2709    0x00000000013ebe70  Flusher                         140
Subdaemon       2709    0x0000000001401210  Monitor                         139
Subdaemon       2709    0x0000000001416490  Deadlock Detector               138
Subdaemon       2709    0x000000000146b970  Aging                           135
Subdaemon       2709    0x00000000014c0f70  AsyncMV                         133
Subdaemon       2709    0x00000000014d61f0  HistGC                          132
Subdaemon       2709    0x00000000014eb470  IndexGC                         134
Subdaemon       2709    0x00007f9d58000b00  Checkpoint                      137
Subdaemon       2709    0x00007f9d58015ea0  Log Marker                      136
Replication policy  : Manual
Replication agent is running.
Cache Agent policy  : Manual
TimesTen‘s Cache agent is running for this data store
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group oracle
End of report

法三,再启动一次

ttisql>call ttrepstart;
12026: The agent is already running for the data store.
The command failed.

cache agent 和 replication agent连接Oracle的行为

cache agent: 会永远尝试重连

When a connection from the cache agent to the Oracle database fails, the cache agent attempts to connect every 10 seconds. If the cache agent cannot connect to the Oracle database, the cache agent restarts after 10 minutes. This behavior repeats forever.

replication agent: 重连超时后不再尝试连接
When a connection from the replication agent to the Oracle database fails, the replication agent attempts to reconnect to the Oracle database after 120 seconds. If it cannot reconnect after 120 seconds, the replication agent stops and does not restart.

监控 cache groups 和 cache grids

cachegroups命令

可以重点关注,Autorefresh的State, Interval,Cache Group Type,Where条件,Aging策略

Command> cachegroups;

Cache Group CACHEUSER.RECENT_SHIPPED_ORDERS:

  Cache Group Type: Read Only
  Autorefresh: Yes
  Autorefresh Mode: Incremental
  Autorefresh State: On
  Autorefresh Interval: 1440 Minutes
  Autorefresh Status: ok
  Aging: Timestamp based uses column WHEN_SHIPPED lifetime 30 days cycle 24 hours on

  Root Table: ORATT.ORDERS
  Table Type: Read Only

监控缓存组的autorefresh操作

详见 TimesTen 应用层数据库缓存学习:10. 监控缓存组的autorefresh操作

监控AWT缓存组

详见 TimesTen 应用层数据库缓存学习:11. AWT性能监控

为缓存组配置事务日志文件数阈值

复制agent使用事务日志来传递更新到Oracle端,如果传递失败,事务日志就会不断累积,而不会被删除。
可使用ttCacheAWTThresholdSet来指定最大可累积的事务日志文件数,缺省为0,如果超出,则TimesTen不再跟踪AWT的变化,后续需要手工与Oracle同步。

cacheadm>CALL ttCacheAWTThresholdGet;
< 0 >
1 row found.
cacheadm>CALL ttCacheAWTThresholdSet(5);
cacheadm>CALL ttCacheAWTThresholdGet;
< 5 >
1 row found.
cacheadm>CALL ttCacheAWTThresholdSet(0);

Obtaining information for a cache grid

使用ttGridInfo和ttGridNodeStatus

cachedb1> call ttGridInfo;
< SAMPLEGRID, CACHEADM, Linux x86-64, 64-bit, 11, 2, 2 >
cachedb2> call ttGridNodeStatus;
< SAMPLEGRID, 1, 1, T, localhost, SAMPLEGRID_cachedb1_1, 127.0.0.1, 9991, <NULL>, <NULL>, <NULL>, <NULL>, <NULL> >
< SAMPLEGRID, 2, 1, T, localhost, SAMPLEGRID_cachedb2_2, 127.0.0.1, 9992, <NULL>, <NULL>, <NULL>, <NULL>, <NULL> >

暂停/恢复全局缓存组(Cache Grid)的AWT操作

ttGridGlobalCGSuspend 和 ttGridGlobalCGResume
注意,ttGridGlobalCGSuspend与ttCachePropagateFlagSet不一样,ttGridGlobalCGSuspend是临时的,在Resume后仍会将数据传递到Oracle。
并且ttGridGlobalCGSuspend只适用于Global Cache Group,即Cache Grid,并只用于以下操作:
- Dynamic loading
- Deleting cache instances

跟踪Oracle端缓存表的DDL语句

缺省是不跟踪Oracle的DDL语句的,如果要跟踪,可以使用以下命令:

Command> CALL ttCacheDDLTrackingConfig(‘enable‘);

Oracle端建立的trigger会将DDL语句插入表TT_*version*_DDL_L中。

Oracle端的schema发生变化,会影响到相应的Cache Group。修改Oracle端schema过程如下

1. 删除cache group
2. 确认所有的更新已同步到Oracle
cacheadm>CALL ttRepSubscriberWait(‘_AWTREPSCHEME‘,‘TTREP‘,‘_ORACLE‘,‘TIMESTEN-HOL‘,-1);
< 00 >
1 row found.
3. 停止cache agent
4. 修改Oracle的schema
5. 重建cache group

管理缓存环境中Oracle数据库中的对象

对于autorefresh的缓存组,TimesTen会在Oracle库中为每一个表建立change log 表和触发器。被缓存表发生更改时,会将更改的主键存入change log表中。
下面这段描述对于理解cache grop的概念是相当的重要:

For an autorefresh cache group, TimesTen creates a change log table and trigger in the Oracle database for each cache table in the cache group. The trigger is fired for each committed insert, update, or delete operation on the cached Oracle Database table. The trigger records the primary key of the updated rows in the change log table. The cache agent periodically scans the change log table for updated keys and then joins this table with the cached Oracle Database table to get a snapshot of the latest updates.

在创建cache group时,这些对象会自动建立,你也可以通过如cachesqlget得到SQL脚本并执行来手工建立。
这些对象中,最重要的有两个:
change log table: TT_*version_object-ID*_L
Trigger: TT_*version_object-ID*_T

例如,在创建了readonly缓存组RO后,可以查看信息:

$ sqlplus cacheadm/oracle@ttorcl

SQL*Plus: Release 11.2.0.2.0 Production on Thu Apr 21 23:01:34 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @cacheInfo
*************Autorefresh Objects Information  ***************
Host name: timesten-hol
Timesten datastore name:
/home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1_1122
Cache table name: TTHR.ORDERS
Change log table name: tt_06_87144_L
Number of rows in change log table: 1
Maximum logseq on the change log table: 0
Timesten has autorefreshed updates upto logseq: 0
Number of updates waiting to be autorefreshed: 0
Number of updates that has not been marked with a valid logseq: 0
****************************
*************No DDL Tracking objects are found*************

PL/SQL procedure successfully completed.

其中change log table表名为tt_06_87144_L

SQL> select owner || ‘.‘ || object_name from all_objects where object_id = 87144;

OWNER||‘.‘||OBJECT_NAME
-------------------------------------------------------------
TTHR.ORDERS
SQL> select owner, object_name, object_type from all_objects where object_name like ‘%87144%‘;

OBJECT_NAME                    OBJECT_TYPE
------------------------------ -------------------
TT_06_87144_L                  TABLE
TT_06_87144_LL                 INDEX
TT_06_87144_T                  TRIGGER

# change log table中只记录了主键
SQL> desc TT_06_87144_L;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 LOGSEQ                                             NUMBER
 FT_CACHEGROUP                             NOT NULL NUMBER
 ORD_NUM                                            NUMBER
 XID                                                VARCHAR2(150)

trigger的定义为:

create or replace TRIGGER CACHEADM.TT_06_87144_t AFTER DELETE OR INSERT OR UPDATE ON "TTHR"."ORDERS" FOR EACH ROW DECLARE MAX_INT CONSTANT INT := 99999999999999999999999999999999999999; minReportTS DATE; minBookmark NUMBER; reqdEmptySpaces INT := 2; err_num NUMBER; dummy INT; dummyName CHAR(100); noRecovery INT := 0; BEGIN <<retry>> BEGIN IF (INSERTING) THEN INSERT INTO CACHEADM.TT_06_87144_l (logseq, ft_cachegroup, "ORD_NUM", xid) VALUES(MAX_INT, 0, :NEW."ORD_NUM", dbms_transaction.local_transaction_id); 
ELSE IF (UPDATING AND ((:OLD."ORD_NUM" <> :NEW."ORD_NUM"))) THEN INSERT INTO CACHEADM.TT_06_87144_l (logseq, ft_cachegroup, "ORD_NUM", xid) VALUES(MAX_INT, 0, :NEW."ORD_NUM", dbms_transaction.local_transaction_id); 
END IF; INSERT INTO CACHEADM.TT_06_87144_l (logseq, ft_cachegroup, "ORD_NUM", xid) VALUES(MAX_INT, 0, :OLD."ORD_NUM", dbms_transaction.local_transaction_id); END IF;
EXCEPTION WHEN OTHERS THEN err_num := SQLCODE; BEGIN execute immediate ‘select objectname from CACHEADM.TT_06_SYNC_OBJS where objectname = :objectName‘ into dummyName using ‘DONOTTRUNCATE‘; IF(SQL%ROWCOUNT > 0) THEN RAISE; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN dummy := 0; END; noRecovery := 0; IF(err_num = -1536 OR err_num = -1653 OR err_num = -1654 OR err_num = -1688 OR err_num = -3233) THEN BEGIN execute immediate ‘select value from CACHEADM.TT_06_ar_params where param = :paramName and value = :paramValue and upper(tblowner) = upper(:owner) and upper(tblname) = upper(:tbl)‘ into dummyName using ‘TblSpaceFullRecovery‘,‘reload‘ ,‘TTHR‘,‘ORDERS‘; IF(SQL%NOTFOUND OR SQL%ROWCOUNT <= 0) THEN noRecovery := 1; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN noRecovery := 1; END; IF (noRecovery = 1) THEN RAISE; END IF; execute immediate ‘select min(bookmark) from CACHEADM.TT_06_agent_status where object_id = 87144 and cgType = 0‘ into minBookmark; delete from CACHEADM.TT_06_87144_l where logseq <= minBookmark; IF(SQL%ROWCOUNT >= reqdEmptySpaces) THEN insert into CACHEADM.TT_06_87144_l(logseq, ft_cachegroup) values (minBookmark, 0); goto retry; ELSE execute immediate ‘select min(reportTS) from CACHEADM.TT_06_agent_status where object_id = 87144 and cgType = 0‘ into minReportTS; execute immediate ‘select bookmark from CACHEADM.TT_06_agent_status where object_id = 87144 and reportTS = :minReportTS  and cgType = 0‘ into minBookmark using minReportTS; delete from CACHEADM.TT_06_87144_l where logseq <= minBookmark; IF(SQL%ROWCOUNT >= reqdEmptySpaces) THEN insert into CACHEADM.TT_06_87144_l(logseq, ft_cachegroup) values (minBookmark, 0); goto retry; ELSE delete from CACHEADM.TT_06_87144_l; IF(SQL%ROWCOUNT < reqdEmptySpaces) THEN RAISE; END IF; goto retry; END IF; END IF; ELSE RAISE; END IF; END; END; 

SELECT DBMS_METADATA.GET_DDL(‘TRIGGER‘, ‘TT_06_87144_T‘, ‘CACHEADM‘ ) txt
FROM DUAL;

autorefresh操作失败带来的影响

例如由于cache agent没有启动,或TimesTen数据库宕机等导致autorefresh失败,会导致在Oracle端的change log table中数据堆积。
空间还是其次,最重要会影响autorefresh的性能。
特别是同一表被多个TimesTen缓存时,只有所有的autorefresh完成后,change log才能被删除。因此可以设置一个超时,以防止change log中的数据累积和不能删除。

cacheadm>CALL ttCacheConfig(‘AgentTimeout‘);
< AgentTimeout, <NULL>, <NULL>, 0 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AgentTimeout‘,,,‘900‘);
< AgentTimeout, <NULL>, <NULL>, 900 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AgentTimeout‘,,,‘0‘);
< AgentTimeout, <NULL>, <NULL>, 0 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AgentTimeout‘);
< AgentTimeout, <NULL>, <NULL>, 0 >
1 row found.

ttCacheDbCgStatus可以显示数据库和缓存组的autorefresh状态,第一列为数据库状态,第二列为缓存组状态

获取TimesTen数据库的autorefresh状态:
ok:change log表中删除的数据已加载到cache table
dead:change log表中的一些数据未加载到cache table,非同步状态,待恢复

获取缓存组的autorefresh状态:
alive:所有的缓存组autorefresh状态为ok
dead:所有的缓存组autorefresh状态为dead

cacheadm>CALL ttCacheDbCgStatus;
< alive, <NULL> >
1 row found.
cacheadm>CALL ttCacheDbCgStatus(‘cacheadm‘,‘RO‘);
< alive, ok >
1 row found.

清理 Oracle遗留的缓存组对象

如果TimesTen数据库被意外删除,Oracle数据库中就会遗留一些为autorefresh缓存组建立的对象,这时可以用TimesTen_install_dir/oraclescripts/cacheCleanUp.sql 来删除,这个脚本带的参数可以首先用cacheInfo.sql得到。

$ ttdestroy cachedb1_1122
Failed to destroy data store: TT10026: Some cache groups that hold triggers and other objects in Oracle may exist in the datastore, drop all the cache groups before destroying the datastore -- file "db.c", lineno 20679, procedure "sbDbDestroy"

$ ttdestroy -force cachedb1_1122

# TimesTen数据库被强行删除了,但这时还有对象遗留在Oracle中

$ sqlplus cacheadm/oracle@ttorcl

SQL*Plus: Release 11.2.0.2.0 Production on Fri Apr 22 02:15:28 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @cacheInfo
*************Autorefresh Objects Information  ***************
Host name: timesten-hol
Timesten datastore name:
/home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1_1122
Cache table name: TTHR.ORDERS
Change log table name: tt_06_87144_L
Number of rows in change log table: 1
Maximum logseq on the change log table: 0
Timesten has autorefreshed updates upto logseq: 0
Number of updates waiting to be autorefreshed: 0
Number of updates that has not been marked with a valid logseq: 0
****************************
*************No DDL Tracking objects are found*************

PL/SQL procedure successfully completed.

SQL> @cacheCleanUp 

Please enter the hostname
timesten-hol
The value chosen for the hostname is timesten-hol

Please enter the datastore
/home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1_1122
The value chosen for the datastore is /home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1_1122

*****************************OUTPUT**************************************
Performing cleanup for object_id: 87144 which belongs to table : ORDERS
Executing: delete from tt_06_agent_status where LOWER(host) = timesten-hol and
LOWER(datastore) = /home/oracle/timesten/tt1122/info/demodatastore/cachedb1_1122
and object_id = 87144
Executing: drop trigger tt_06_87144_T
Executing: drop table tt_06_87144_L
Executing: delete from tt_06_user_count where object_id = object_id1
Executing: delete from tt_06_databases where LOWER(host) = timesten-hol and
LOWER(datastore) = /home/oracle/timesten/tt1122/info/demodatastore/cachedb1_1122
**************************************************************************

PL/SQL procedure successfully completed.


Monitoring the cache administration user’s tablespace

由于change log表频繁更新,可能会导致表空间碎片,因此可以设定碎片率的阈值,缺省为40%。

cacheadm>CALL ttCacheConfig(‘AutoRefreshLogFragmentationWarningPCT‘);
< AutoRefreshLogFragmentationWarningPCT, <NULL>, <NULL>, 40 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AutoRefreshLogFragmentationWarningPCT‘,,,‘50‘);
< AutoRefreshLogFragmentationWarningPCT, <NULL>, <NULL>, 50 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AutoRefreshLogFragmentationWarningPCT‘);
< AutoRefreshLogFragmentationWarningPCT, <NULL>, <NULL>, 50 >
1 row found.

可以设定当超过阈值时采取的动作,缺省无动作,可以设定Compact,Reclaim。

cacheadm>CALL ttCacheConfig(‘AutoRefreshLogDeFragmentAction‘);
< AutoRefreshLogDeFragmentAction, <NULL>, <NULL>, MANUAL >
1 row found.
cacheadm>CALL ttCacheConfig(‘AutoRefreshLogDeFragmentAction‘,,,‘CompactAndReclaim‘);
< AutoRefreshLogDeFragmentAction, <NULL>, <NULL>, compactandreclaim >
1 row found.

使用ttCacheAutorefreshStatsGet 可以得到表空间当前的碎片率,就是最后几列

cacheadm>call ttCacheAutorefreshStatsGet(‘cacheadm‘, ‘ro‘);
< 3766608, 2016-04-22 00:59:14.000000, 80457680, 1444, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Complete, 0, 0, 0, 2016-04-22 00:58:22.000000, 0 >
< 3766608, 2016-04-22 00:59:09.000000, 80452680, 1443, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Complete, 0, 0, 0, 2016-04-22 00:58:22.000000, 0 >
......

也可以直接对change log table执行defrag和reclaim.

CALL ttCacheAutoRefreshLogDeFrag(‘CompactAndReclaim‘);

除碎片外,另一个问题就是防止表空间满,缺省的警告阈值为50%

cacheadm>CALL ttCacheConfig(‘AutoRefreshLogTblSpaceUsagePCT‘);
< AutoRefreshLogTblSpaceUsagePCT, <NULL>, <NULL>, 50 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AutoRefreshLogTblSpaceUsagePCT‘,,,‘80‘);
< AutoRefreshLogTblSpaceUsagePCT, <NULL>, <NULL>, 80 >
1 row found.
cacheadm>CALL ttCacheConfig(‘AutoRefreshLogTblSpaceUsagePCT‘);
< AutoRefreshLogTblSpaceUsagePCT, <NULL>, <NULL>, 80 >
1 row found.

也可以设定表空间满时相应的操作

# 缺省无动作
cacheadm>CALL ttCacheConfig(‘TblSpaceFullRecovery‘,‘tthr‘,‘orders‘);
< TblSpaceFullRecovery, TTHR, ORDERS, none >
1 row found.
# 表空间满时,删除change log table,并reload
cacheadm>CALL ttCacheConfig(‘TblSpaceFullRecovery‘,‘tthr‘,‘orders‘, ‘reload‘);
< TblSpaceFullRecovery, TTHR, ORDERS, reload >
1 row found.

grid node的错误恢复

数据库从错误中恢复后,可以自动的加入cache grid。
正常的状态如下:

cacheadm>CALL ttRepStateGet;
< IDLE, AVAILABLE >
1 row found.

本例中没有cache grid,因此

cacheadm>CALL ttRepStateGet;
< IDLE, NO GRID >
1 row found.

带缓存组数据库的备份和恢复

带缓存组数据库可以用ttbackup和ttmigrate备份和恢复

tthr>select count(*) from orders;
< 2091 >
1 row found.
$ mkdir /tmp/dump
$ ttBackup -dir /tmp/dump -connstr "DSN=cachedb1_1122"
Backup started ...
Backup complete
$ ls -l /tmp/dump
total 84724
-rw------- 1 oracle oracle 61047272 Apr 22 01:29 cachedb1_1122.0.bac
-rw------- 1 oracle oracle 25604096 Apr 22 01:29 cachedb1_1122.0.bac19
-rw------- 1 oracle oracle      720 Apr 22 01:29 cachedb1_1122.sta
cacheadm>call ttcachestop;
cacheadm>drop cache group cacheadm.ro;
$ ttdestroy cachedb1_1122
$ ttRestore -dir /tmp/dump -connstr "DSN=cachedb1_1122"
Restore started ...
Restore complete
$ rm -fr /tmp/dump/

tthr>select count(*) from orders;
< 2091 >
1 row found.
cacheadm>call ttCacheUidGet();
< CACHEADM >
1 row found.
cacheadm>cachegroups;

Cache Group CACHEADM.RO:

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

  Root Table: TTHR.ORDERS
  Table Type: Read Only

1 cache group found.

# 本以为unload+load就可以恢复,但却出错了
cacheadm>call ttcachestart;
cacheadm>alter cache group ro set autorefresh state paused;
cacheadm>load cache group ro commit every 256 rows;
 5919: The log table TT_06_87144_L is different from when the cache was created or no longer exists.  The cache group definition is no longer valid.
The command failed.

# 看来只有删除重建
cacheadm>drop cache group ro;
cacheadm>CREATE READONLY CACHE GROUP "RO" 
       >  AUTOREFRESH MODE INCREMENTAL INTERVAL 5 SECONDS
       >  STATE ON
       >  FROM
       >   "TTHR"."ORDERS" (
       >     "ORD_NUM"   NUMBER(38)   NOT NULL,
       >     "SHIP_TIME" TIMESTAMP(6) NOT NULL,
       >     PRIMARY KEY("ORD_NUM")
       >   );

ttmigrate/ttrestore的操作大同小异,就不赘述了。

修改 cache用户的用户名和口令

cache用户有两个,在TimesTen中的叫cache manager,在Oracle中的叫cache admin。
修改用户名牵扯的东西太多了,不建议。用户名我们建议Oracle和TimesTen一样,cacheadm或cacheuser
修改cache manager的口令不会有什么影响。
修改cache admin的口令后,需要用ttCacheUidPwdSet 重新设置,如下:

cacheadm>passthrough 3
Passthrough command has set autocommit off.
cacheadm>alter user cacheadm identified by cacheadm;
cacheadm>passthrough 0;
cacheadm>alter cache group ro set autorefresh state paused; <- 改口令后,就连不上了
 5213: Bad Oracle login error in OCISessionBegin(): ORA-01017: invalid username/password; logon denied rc = -1
 5131: Cannot connect to backend database: OracleNetServiceName = "ttorcl", uid = "CACHEADM", pwd is hidden, TNS_ADMIN = "/u01/app/oracle/product/11.2.0/dbhome_1/network/admin", ORACLE_HOME= "/u01/app/oracle/product/11.2.0/dbhome_1"
 5109: Cache Connect general error: BDB connections not open.
The command failed.
cacheadm>rollback;
cacheadm>call ttCacheUidPwdSet(‘cacheadm‘, ‘cacheadm‘);
cacheadm>alter cache group ro set autorefresh state paused;

TimesTen 应用层数据库缓存学习:12. 管理缓存环境

标签:

原文地址:http://blog.csdn.net/stevensxiao/article/details/51222500

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!