Step by Step TimesTen — 创建Data Stores
Step 1: 配置DSN
DSN有两种system DSN 和 user DSN. (参见 Step by Step TimesTen — DSN). 可以选择使用user 或者是 system DSN.
System DSN缺省的ODBC.ini文件是install_dir/info/sys.odbc.ini
User DSN 缺省的ODBC.ini文件是$HOME/.odbc.ini
也可以通过环境变量指定ODBC.ini文件,例如:
export ODBCINI=/tmp/private.odbc.ini
export SYSODBCINI=/tmp/shared.odbc.ini
修改ODBC.ini文件,添加如下说明
[fxdsn]
DataStore=/ora/TimesTen/datastore/fxdsn
DatabaseCharacterSet=US7ASCII
PermSize=10
TempSize=10
在这一步我们定义的DSN是 “fxdsn” , 数据库的字符集是US7ASCII, 10M的空间存放永久数据(rows, indexes…)10M的空间存放临时数据(sorts, locks….)
Step 2: 连接到Data Store
TimesTen使用工具ttIsql 去连接Data Store.
在使用工具之前,先要确认环境变量是否正确设置。
$ PATH=/ora/TimesTen/tt70/TimesTen/tt70/bin:$PATH
$ export PATH
$ LD_LIBRARY_PATH=/ora/TimesTen/tt70/TimesTen/tt70/lib:$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH
确认目录/ora/TimesTen/datastore存在,并且TimesTen用户有读写的权限
启动ttIsql
$ ttIsql fxdsn
输出入下
Copyright (c) 1996-2007, Oracle. All rights reserved.
Type ? or “help” for help, type “exit” to quit ttIsql.
All commands must end with a semicolon character.
connect “DSN=fxdsn”;
Connection successful: DSN=fxdsn;UID=times;DataStore=/ora/TimesTen/datastore/fxdsn;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;PermSize=8;TempSize=8;TypeMode=0;
(Default setting AutoCommit=1)
Command> exit
Disconnecting…
Done.
输入exit退出ttIsql. Data store创建成功。
在/ora/TimesTen/datastore目录下生成6个文件
$ ls -l /ora/TimesTen/datastore
total 452416
-rw-rw-rw- 1 times timesten 14701696 Mar 6 16:58 fxdsn.ds0
-rw-rw-rw- 1 times timesten 14701696 Mar 6 16:58 fxdsn.ds1
-rw-rw-rw- 1 times timesten 753664 Mar 6 16:58 fxdsn.log0
-rw-rw-rw- 1 times timesten 67108864 Mar 6 16:58 fxdsn.res0
-rw-rw-rw- 1 times timesten 67108864 Mar 6 16:58 fxdsn.res1
-rw-rw-rw- 1 times timesten 67108864 Mar 6 16:58 fxdsn.res2
Step 3: 定义Data Store启动/关闭策略
缺生情况下,仅仅当一个用户连接到Data store时,Data Store 才open.
使用ttStatus可以查看Data store的状态
$ ttstatus
TimesTen status report as of Thu Mar 6 17:04:58 2008
Daemon pid 300 port 17001 instance tt70
TimesTen server pid 306 started on port 17003
No TimesTen webserver running
————————————————————————
Data store /ora/TimesTen/datastore/fxdsn
There are no connections to the data store
Replication policy : Manual
Cache agent policy : Manual
————————————————————————
End of report
使用如下命令,设置data store为一直open状态
$ ttAdmin -ramPolicy always fxdsn
RAM Residence Policy : always
Replication Agent Policy : manual
Replication Manually Started : False
Cache Agent Policy : manual
Cache Agent Manually Started : False
使用ttstatus命令查看data store的状态可以看到
$ ttstatus
TimesTen status report as of Thu Mar 6 17:09:41 2008
Daemon pid 300 port 17001 instance tt70
TimesTen server pid 306 started on port 17003
No TimesTen webserver running
————————————————————————
Data store /ora/TimesTen/datastore/fxdsn
There are 6 connections to the data store
Data store is in shared mode
Shared Memory KEY 0×0400efd5 ID 3080
Type PID Context Connection Name ConnID
Subdaemon 302 0×000000010015b870 Worker 2042
Subdaemon 302 0×00000001002336f0 Checkpoint 2047
Subdaemon 302 0×0000000100244b60 Aging 2043
Subdaemon 302 0×0000000100255fd0 Flusher 2046
Subdaemon 302 0×0000000100267440 HistGC 2044
Subdaemon 302 0×00000001002788b0 Monitor 2045
RAM residence policy: Always
Replication policy : Manual
Cache agent policy : Manual
————————————————————————
End of report








