---
title: "TimesTen学习笔记4(timesten 中个各种命令)"
author: "dreambyheart"
date: "2008-12-23T16:19:23Z"
tags: ["Access", "Blog", "Cache", "Oracle"]
slug: "timesten-4-timesten"
draft: false
lastmod: "2008-12-23T16:20:08Z"
id: 299885
url: "https://menglh.iteye.com/blog/299885"
---

原文地址：http://ifindit.blog.sohu.com/77367977.html

1.ttAdmin（命令)

功能：
指定内存加载策略
指定replication agent策略
启动或停止cache agent

如：
[timesten@rh44server ~]$ ttadmin -query tt_eservice;
RAM Residence Policy : inUse
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False

[timesten@rh44server ~]$ ttadmin -rampolicy always tt_eservice;
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False

[timesten@rh44server ~]$ ttadmin -cachePolicy always tt_eservice;

2.ttDaemonAdmin(命令)
功能：启动/停止TimesTen main daemon, Server and Webserver.
语法：
ttDaemonAdmin [-force] {-start | -stop | -restart}
ttDaemonAdmin -startserver
ttDaemonAdmin [-force] -stopserver
ttDaemonAdmin [-startwebserver | -stopwebserver]


3.ttBackup(命令)
功能：
备份data store。

例如：
[timesten@rh44server ~]$ ttbackup -type filefullenable -dir /home/timesten/ -fname logzhou tt_eservice;
Backup started ...
Backup complete

恢复
ttRestore -dir /home/timesten/ -fname logzhou restoredDSN;

备到带库
ttBackup -type streamFull tt_eservice | dd bs=64k of=/dev/rmt0


4.ttBulkCp(命令)
功能：
在内存表和文件之间转换数据。
两种模式：
• In copy-in mode, rows are copied into an existing TimesTen table from one or more ASCII files (or stdin).
• In copy-out mode, an entire TimesTen table is copied to a single ASCII output file (or stdout).

例如：
[timesten@rh44server ~]$ ttBulkCp -o dsn=tt_eservice tracelog tracelog.dump
1/1 row copied



5.ttBlockinfo (存储过程)
功能：显示perm内存中block的利用信息和碎片信息。
用法：CALL ttBlockInfo;

6.ttBookmark(存储过程)
功能： 显示日志文件信息。
用法： Call ttBookmark;

7.ttCachePolicySet (存储过程)
功能：指定cache agent的策略。
用法：call ttCachePolicySet('always');

8.ttCachePropagateFlagSet
功能： 允许临时停止把更新推向oracle db
用法： Call ttCachePropagateFlagSet(0); 该标志在每次事务提交或回滚段后都被重置，所以如果需要关闭的话，要将autocommit设为0.
如果设为1的话，则update会推向oracle。

9.ttCacheStart/ttCacheStop
功能：启动/关闭cache agent
用法： Call ttCacheStart();

10.ttCkpt
功能：手动做non-blocking checkpoint
用法：CALL ttCkpt();
CALL ttCkpt(1,10);

11.ttCkptBlocking
功能：手动做一个blocking checkpoint
用法: Call ttCkptBlocking();
Call ttCkptBlocking(1,10);

12.ttCkptConfig
功能： 设置后台checkpoint的频率，速率
用法： Call ttCkptConfig (ckptFrequency, ckptLogVolume, ckptRate)

13.ttCompact
功能： 整合perm和temp内存的碎片，类似于oracle里面的coalescs。
用法：CALL ttCompact;

14.ttConfiguration
功能： 查询参数设定。
用法: Call ttConfiguration();

15.ttDataStoreStatus
功能: 查看data store的状态。
用法：call ttdatastorestatus('/home/timesten/TimesTen/eservice/info/TT_eservice');

16.ttLockLevel
功能：设置lock level.
用法：Call ttLockLevel (lockLevel);
lockLevel取值为Row和DS

17.ttLogBufPrint
功能： 查看log buffer里面的内容
用法： ttLogBufPrint (verbose, maxLen)
CALL ttLogBufPrint(1,0);
CALL ttLogBufPrint(2,0);

18.ttOptClearStats
功能：清除表格上面的统计信息。
用法：ttOptClearStats (tblName, invalidate)
invalidate取0 (no) or 1 (yes). 0表示即使清掉了统计信息后，也不会影响现有的command。

19.ttOptEstimateStats
功能： 收集表格上面的统计信息。
用法：ttOptEstimateStats (tblName, invalidate, sampleStr)
其中sampleStr取值为'n ROWS’或‘p PERCENT’,


20.ttRepDeactivate
功能：将active状态的data store改为active standby状态
用法：CALL ttRepDeactivate();


21.ttRepStart/ttRepStop
功能：启动/关闭replication agent.


22.ttRepStateGet()
功能： 获取data store的状态
用法:CALL ttRepStateGet();
< STANDBY >

23.ttRepStateSet
功能： 将active standby状态的data store改为Active状态，即master。
用法：CALL ttRepStateSet('ACTIVE');

24.ttSize
功能： 预估表格的大小
用法：ttSize(tblName, nRows, frac)
其中nRows表示预估表格会有多少条记录。frac表示预估表中varbinary或varchar类型字段的碎片，该参数可选。
如：
Command> call ttsize('tracelog',10000000,null);
< 3041157861.00000 >


25.ttDestory(命令)
功能：删除一个data store，包括checkpoint文件，logfile。用它能够安全完整地删除data store.
语法：ttDestroy [[-wait] [-timeout secs]] [-force] {-connStr connection_string | DSN | dspath}

26.ttmodinstall(命令)
功能：修改端口或者enable/disable access control.
语法：
ttmodinstall -port portNumber
ttmodinstall -enableAccessControl
ttmodinstall -changeOracleSettings

27.ttuser(命令)
功能：输入一个密码，产生加密密码。
语法：ttuser -pwdcrypt

28.ttStatus(命令)
功能：显示data store的状态

29.ttSchema(命令)
功能：打印出对象的ddl语句
语法：ttSchema [-l] [-c] [ -list {all | tables | views | sequences |cachegroups | repschemas } [,...] ] 
[-st | -systemTables] [-u TT_instance] [-connStr connection_string | DSN ] [[owner.]name][...]


30.ttRepAdmin(命令)
功能：显示replicatioin的定义，监控replication的状态
