TimesTen 应用层数据库缓存学习:20. TimesTen异常时的缓存清理

当TimesTen数据库被异常删除时,存放在Oracle数据库的缓存信息需要清理,以下为清理过程:

# 删除数据库,提示有缓存组信息在Oracle中
$ ttdestroy sampledb_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 20825, procedure "sbDbDestroy"
# 强制删除
$ ttdestroy -force sampledb_1122

清理脚本位于 cd TT_HOME/oraclescripts目录下,@cacheInfo.sql可以查询残留的缓存组信息,并且输出可以作为cacheCleanUp.sql清理脚本的输入参数:

$ cd $TT_HOME/oraclescripts
$ sqlplus cacheadm/oracle@orcl
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> !ls
cacheCleanUp.sql  grantCacheAdminPrivileges.sql  initCacheGlobalSchema.sql  README.TXT      ttca_setupRepository.sql
cacheInfo.sql     initCacheAdminSchema.sql   initCacheGridSchema.sqlsupporting_scripts  ttca_setupTarget.sql

SQL> @cacheInfo.sql
*************Autorefresh Objects Information  ***************
Host name: ttlab
Timesten datastore name:
/home/timesten/TimesTen/tt1122/info/DemoDataStore/sampledb_1122
Cache table name: TTUSER.JOBS
Change log table name: tt_06_87397_L
Number of rows in change log table: 1
Maximum logseq on the change log table: 0
Timesten has autorefreshed updates upto logseq: -1
Number of updates waiting to be autorefreshed: 1
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.sql

Please enter the hostname
ttlab
The value chosen for the hostname is ttlab

Please enter the datastore
/home/timesten/TimesTen/tt1122/info/DemoDataStore/sampledb_1122
The value chosen for the datastore is /home/timesten/TimesTen/tt1122/info/DemoDataStore/sampledb_1122

*****************************OUTPUT**************************************
Performing cleanup for object_id: 87397 which belongs to table : JOBS
Executing: delete from tt_06_agent_status where LOWER(host) = ttlab and
LOWER(datastore) =
/home/timesten/timesten/tt1122/info/demodatastore/sampledb_1122 and object_id =
87397
Executing: drop trigger tt_06_87397_T
Executing: drop table tt_06_87397_L
Executing: delete from tt_06_user_count where object_id = object_id1
Executing: delete from tt_06_databases where LOWER(host) = ttlab and
LOWER(datastore) =
/home/timesten/timesten/tt1122/info/demodatastore/sampledb_1122
**************************************************************************

PL/SQL procedure successfully completed.

SQL> @cacheInfo.sql
*************No autorefresh objects are found*************
*************No DDL Tracking objects are found*************

PL/SQL procedure successfully completed.

参考文档

  • HOWTO : Manually Clean Up Cache Group Objects Orphaned In Oracle By Destroying A TimesTen Database Without Dropping Cache Groups (Doc ID 1474731.1)
  • Steps to remove Cache groups and Cache Grid from TimesTen and Oracle (Doc ID 836887.1)
  • A sequence of actions for setting up Cache Grid. (Doc ID 836375.1)

猜你喜欢

转载自blog.csdn.net/stevensxiao/article/details/78329695