ITPUB??ì3
新一届的微软MVP评选已经开始,欢迎各位推荐!
ITPUB论坛 » 内存数据库 » Step by Step TimesTen --- 创建Data Stores

标题: [原创] Step by Step TimesTen --- 创建Data Stores
离线 feng_xin
guoguo mama


精华贴数 7
个人空间 675
技术积分 2100 (755)
社区积分 3506 (384)
注册日期 2001-9-24
论坛徽章:14
现任管理团队成员ITPUB元老玉石琵琶授权会员生肖徽章2007版:鼠2008北京奥运纪念徽章:跳水
2008北京奥运纪念徽章:柔道生肖徽章2007版:羊生肖徽章2007版:蛇生肖徽章2007版:鼠生肖徽章2007版:鸡ITPUB新首页上线纪念徽章

发表于 2008-3-6 17:25 
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 0x0400efd5 ID 3080
Type            PID     Context             Connection Name              ConnID
Subdaemon       302     0x000000010015b870  Worker                         2042
Subdaemon       302     0x00000001002336f0  Checkpoint                     2047
Subdaemon       302     0x0000000100244b60  Aging                          2043
Subdaemon       302     0x0000000100255fd0  Flusher                        2046
Subdaemon       302     0x0000000100267440  HistGC                         2044
Subdaemon       302     0x00000001002788b0  Monitor                        2045
RAM residence policy: Always
Replication policy  : Manual
Cache agent policy  : Manual
------------------------------------------------------------------------
End of report

[ 本帖最后由 feng_xin 于 2008-3-6 17:28 编辑 ]


__________________

信心并不止是相信,而是看不见证据,仍然相信。

此之谓:大信!


¤ ╱◥█◣^^  ╭⌒╮     
  ︱田︱田︱ぃ╭ ╭ ⌒╮   
⿶⿶⿶⿶⿶ い⿶⿶⿶⿶⿶⿶⿶ 
╪╪╪╪╪╪╪╪╪╪╪
⿶⿶⿶⿶
只看该作者    顶部
离线 liyongdong
版主


精华贴数 5
个人空间 0
技术积分 4764 (282)
社区积分 132 (2969)
注册日期 2001-11-25
论坛徽章:23
现任管理团队成员ITPUB元老会员2006贡献徽章授权会员2008年新春纪念徽章生肖徽章2007版:龙
生肖徽章2007版:鸡ITPUB新首页上线纪念徽章生肖徽章:虎生肖徽章:猪生肖徽章:狗生肖徽章:鸡

发表于 2008-3-11 16:26 
不错,加油!


__________________
***人与人之间最大的信任是精诚相见人生没有停靠站,***
***自我本身永远是一个出发点。无论何时何地,只要创***
***造就有收获,只有不息的奋进,才能证明生命的存在。**
只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问