如何增加和减少TimesTen的PermSize和TempSize

TimesTen的内存分配主要是PermSize和TempSize两块,在sys.odbc.ini中定义,并可通过dssize或ttconfiguration查看

Command> dssize m;

  PERM_ALLOCATED_SIZE:      512
  PERM_IN_USE_SIZE:         29.6396484375
  PERM_IN_USE_HIGH_WATER:   63.2841796875
  TEMP_ALLOCATED_SIZE:      128
  TEMP_IN_USE_SIZE:         9.86328125
  TEMP_IN_USE_HIGH_WATER:   116.28515625
Command> call ttconfiguration('permsize');
< PermSize, 512 >
1 row found.
Command> call ttconfiguration('tempsize');
< TempSize, 128 >
1 row found.

TempSize的增加和减少比较简单,只需在DSN中修改数字,然后unload并load数据库即可。
PermSize的增加同上。
PermSize的减少相对复杂,例如我们在DSN定义中将
PermSize=512 改为 PermSize=256
在load数据库时,显示警告
Warning 6200: New value for permanent data partition size ignored since smaller than current value of 512 megabytes
PermSize仍保持不变

若你不需要其中的数据,你可以ttDestroy然后load数据库即可,若需要其中数据,则必须通过ttMigrate后,再ttDestroy,然后再load
前面我们看到PERM_IN_USE_SIZE为29M,因此缩小PermSize时,不能小于PERM_IN_USE_SIZE。以下为过程:

先修改DSN文件,将PermSize改小
然后使用ttMigrate备份
[oracle@localhost info]$ ttmigrate -c plsqldb plsqldb.ttm
ttMigrate: Warning 01000: [TimesTen][TimesTen 11.2.2.2.0 ODBC Driver][TimesTen]TT6200: New value for permanent data partition size ignored since smaller than current value of 512 megabytes -- file "db.c", lineno 10126, procedure "sbDbConnect" (TimesTen error code = 6200).

Saving user PUBLIC
User successfully saved.

Saving user PLS
User successfully saved.

Saving table PLS.EMP
  Saving rows...
  14/14 rows saved.
Table successfully saved.

Saving table PLS.FOO
  Saving rows...
  0/0 rows saved.
Table successfully saved.

Saving table PLS.TEMP
  Saving rows...
  1/1 row saved.
Table successfully saved.

Saving sequence PLS.SBTEST_SEQ
Sequence successfully saved.

Saving PL/SQL package PLS.TEST
PL/SQL package successfully saved.

Saving PL/SQL package PLS.WORKLOAD
PL/SQL package successfully saved.

Saving PL/SQL package body PLS.TEST
PL/SQL package body successfully saved.

Saving PL/SQL package body PLS.WORKLOAD
PL/SQL package body successfully saved.
删除数据库
[oracle@localhost info]$ ttdestroy plsqldb
恢复数据库
[oracle@localhost info]$ ttmigrate -r plsqldb plsqldb.ttm

Restoring user PLS
  Restoring privileges...
  Privileges restored.
User successfully restored.

Restoring table PLS.EMP
  Restoring rows...
  14/14 rows restored.
Table successfully restored.

Restoring table PLS.FOO
  Restoring rows...
  0/0 rows restored.
Table successfully restored.

Restoring table PLS.TEMP
  Restoring rows...
  1/1 row restored.
Table successfully restored.

Restoring sequence PLS.SBTEST_SEQ
Sequence successfully restored.

Restoring PL/SQL package PLS.TEST
PL/SQL package successfully restored.

Restoring PL/SQL package PLS.WORKLOAD
PL/SQL package successfully restored.

Restoring PL/SQL package body PLS.TEST
PL/SQL package body successfully restored.

Restoring PL/SQL package body PLS.WORKLOAD
  Note: PACKAGE BODY created with errors (matches saved object compile status)
PL/SQL package body successfully restored.
验证PermSize以及缩小
[oracle@localhost info]$ ttisql plsqldb

Copyright (c) 1996-2011, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.



connect "DSN=plsqldb";
Connection successful: DSN=plsqldb;UID=oracle;DataStore=/home/oracle/app/oracle/product/TimesTen/tt1122/info/DemoDataStore/plsqldb/plsqldb;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;LogFileSize=32;DRIVER=/home/oracle/app/oracle/product/TimesTen/tt1122/lib/libtten.so;PermSize=256;TempSize=128;TypeMode=0;PLSQL_MEMORY_SIZE=16;PLSQL_MEMORY_ADDRESS=0x16000000;OracleNetServiceName=ttorcl;LogBufMB=32;
(Default setting AutoCommit=1)
Command> dssize m;

  PERM_ALLOCATED_SIZE:      256
  PERM_IN_USE_SIZE:         6.94140625
  PERM_IN_USE_HIGH_WATER:   6.94140625
  TEMP_ALLOCATED_SIZE:      128
  TEMP_IN_USE_SIZE:         5.71484375
  TEMP_IN_USE_HIGH_WATER:   5.71484375

Command> 

本文参考了:
HOWTO : Understand Modifying TimesTen PermSize And TempSize First Connect Database Attributes (Doc ID 1081008.1)
HOWTO : Decrease Database PermSize For An Existing TimesTen Database (Doc ID 1081032.1)
HOWTO : Understand Moving or Copying A TimesTen Database Using Backup Utilities (Doc ID 974583.1)

你可能感兴趣的:(PermSize,timesten,tempsize,ttmigrate)