windows下TimesTen的配置及使用
来源:互联网 发布:映射网络驱动器 本机 编辑:程序博客网 时间:2024/06/08 15:42
在摸索了好几天之后,终于把怎样在windows下配置TimesTen的DSN、CacheGroup和使用SQL Developer给弄明白了。以下是写的总结,留作以后参考。
一.安装TimesTen
TimesTen的安装很简单,直接执行安装程序,选择默认设置即可。在安装前,需要确认如下两点:
1.
2.
二.配置TT数据库(即DSN)
TT数据库中,一个DSN即是一个TT实例。
1. 配置过程
在安装TT软件后,可通过如下步骤配置DSN:
1.
2.
3.
在选择DataSource Path时,要确保该目录已经存在。
且此处Database Character Set必须与Oracle的字符集相同,如果不同,后面还需要重新配置数据源。
4.
5.
6.
7.
正常情况下应如下图所示:
2. 查看TT状态
在cmd窗口,执行ttstatus检查tt状态:
C:Documents andSettingsAdministrator>ttstatus
TimesTen status report as of Tue Sep11 11:02:45 2012
Daemon pid 696 port 53392 instancett1122_32
TimesTen server pid 1244 started onport 53393
------------------------------------------------------------------------
Data storee:mydemotest_tt
There are 12 connections to the datastore
Shared Memory KEYGlobaltest_tt.e||mydemo.SHM.10 HANDLE 0x288
PL/SQL Memory KEYGlobaltest_tt.e||mydemo.SHM.11 HANDLE 0x290 Address0x5B8C000
0
Type
Process
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Replication policy
Cache Agent policy
PL/SQL enabled.
---------------------------------------------------------------------
Accessible by groupWWW-B1818C3ACBBNone
End of report
可以看到 DataStoree:mydemotest_tt 已经在运行了,且有一些后台的服务线程也已经启动。且显示了相应的TimesTen监听端口号。比如主守护进程(Daemon)的端口号是17000;Server端的监听端口号是17002,这个端口号是当Client/Server配置的时候,远程Client端连接过来时,Server端这边的服务端口号;还有WebServer的端口号 17004,TimesTen自身带有一个自用的webserver的。
3. 创建TT用户
在command窗口,执行如下命令创建TT用户tt:
C:Documents andSettingsAdministrator>ttisql test_tt
Copyright (c) 1996-2011,Oracle.
Type ? or "help" for help, type"exit" to quit ttIsql.
connect "DSN=test_tt";
Connection successful:DSN=test_tt;UID=Administrator;DataStore=E:MyDemotest_tt
;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;DRIVER=C:TimesTe
nTT1122~1binttdv1122.dll;PermSize=64;TempSize=32;TypeMode=0;
(Default settingAutoCommit=1)
Command> create user tt identified bytt;
User created.
Command> grant all to tt;
Command> quit;
三.设置Cache Connect
1. 创建Oracle用户
由于Cache Connect访问Oracle的时候,必须有一个用户在TimesTen和Oracle中是一样的,通过这个用户登录TimesTen之后,然后Cache Connect的底层通过这个用户去和Oracle通讯,来进行数据的两边同步。在前面我们已经创建了用户tt,那么现在在oracle中,我们也创建同样的用户tt,并授予相应的Oracle权限。
以Oracle dba用户或系统用户登录Oracle,执行创建操作。
C:Documents andSettingsAdministrator>sqlplussystem/test@test
SQL> create user tt identified by tt;
用户已创建。
SQL> grant connect,resource,create any trigger tott;
授权成功。
SQL> grant dba to tt;
授权成功。
SQL> commit;
提交完成。
2. 更新DSN配置
在“控制面板 –>管理工具 ->数据源(ODBC)”的“系统DSN”页签,找到之前配置的数据源test_tt,执行如下步骤更新配置:
1.
2.
3.
3. 创建测试表
以tt用户登录Oracle,创建cache测试表。
SQL> connect tt/tt@orcl
已连接。
SQL> create table test(a int primary key, bchar(10));
表已创建。
SQL> insert into testvalues(1,’aaa’);
已创建 1 行。
SQL> insert into testvalues(2,’bbb’);
已创建 1 行。
SQL> commit;
提交完成。
SQL>
4. 创建cache
C:Documents andSettingsAdministrator>ttisqltest_tt
Command> call ttcacheuidpwdset(’tt’,'tt’);
Command> call ttcachestart;
5. 创建TimesTen表空间
在此之后要创建一个cachegrid,只cachegrid的第一个数据库成员需要执行这个操作。注意,只有cache manager user能创建和管理cache grid,一个cache database只能属于一个cache grid,然后可以使用过程ttgridinfo来检查是否创建成功。
在创建cachegrid前,要先创建表空间,然后建timesten用户,操作创建grid才不会报错。
创建一个单独的表空间来管理缓存到timesten的对象
SQL>create tablespace timesten datafile'D:oracleproduct10.2.0oradataorcltimesten.dbf' size50m;
6. 创建timesten 用户
运行initCacheGlobalSchema.sql脚本来创建用户,这用户拥有存储cache grid 和grid member信息的表。这个脚本在%TimesTen_install_dir%/oraclescripts目录下。
在创建之前,请切换到脚本所在目录,再以oracledba或system用户登录:
C:TimesTentt1122_32oraclescripts>
C:TimesTentt1122_32oraclescripts>sqlplus system/Younuoda2006@orcl
SQL> @initCacheGlobalSchema"timesten";
Please enter the tablespace whereTIMESTEN user is to be created
The value chosen for tablespace istimesten
******* Creation of TIMESTEN schemaand TT_CACHE_ADMIN_ROLE starts *******
1. Creating TIMESTENschema
2. Creating TIMESTEN.TT_GRIDIDtable
3. Creating TIMESTEN.TT_GRIDINFOtable
4. Creating TT_CACHE_ADMIN_ROLErole
5. Granting privileges toTT_CACHE_ADMIN_ROLE
** Creation of TIMESTEN schema andTT_CACHE_ADMIN_ROLE done successfully **
PL/SQL 过程已成功完成。
7. 创建Grid
执行ttisqltest_dsn连接内存库,创建Grid。
C:Documents andSettingsAdministrator>ttisqltest_tt
Command> call ttGridCreate('myGrid');
Command> call ttGridNameSet('myGrid');
8. 创建CacheGroup
1.
Command> create readonly cache grouptest_cg
其中,test_cg为Cache Group的名,test为前面在Oracle中创建的测试表。
2.
Command> cachegroups ;
Cache Group TT.TEST_CG:
1 cache group found.
在未装载前,cachegroup的自动刷新状态是Paused。
3.
Command> load cache group read commit every 10rows;
4.
Command> select * fromtest;
< 1, aaa
< 2, bbb
2 rows found.
此后,在Oracle数据库中插入到test表的数据,5秒钟之后都会被刷新到TimesTen中来,CacheConnect正常运转了。
5.
C:Documents andSettingsAdministrator>ttstatustest_tt
TimesTen status report as of Thu Sep13 16:18:14 2012
Daemon pid 2812 port 53392 instancett1122_32
TimesTen server pid 2640 started onport 53393
------------------------------------------------------------------------
Data storee:mydemotest_tt
There are 16 connections to the datastore
Shared Memory KEYGlobaltest_tt.e||mydemo.SHM.10 HANDLE 0x294
PL/SQL Memory KEYGlobaltest_tt.e||mydemo.SHM.11 HANDLE 0x298 Address0x5B8C0000
Type
Cache Agent
Cache Agent
Cache Agent
Cache Agent
Cache Agent
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Subdaemon
Replication policy
Cache Agent policy
TimesTen's Cache agent is running forthis data store
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by groupWWW-B1818C3ACBBNone
End of report
四.用SQL Developer连接TT
在使用SQLDeveloper前,要确保本机上已经安装jdk。建议安装jdk1.5或jdk1.6版本。
1.
2.
选择“+”图标,或是在“连接”上右键选择“新建”。
3.
其中,dsn、datastore、oraclenetservicename均已在系统DSN下配置。
4.
5.
五.异常处理
1. connecttest_tt报错
Command> connecttest_tt;
The command failed.
检查之后,发现是在ODBC中设置DataStore的路径时出现错误,MyDemo目录是在E盘下而不是D盘。改了之后就能连接了。
2. 执行callttcacheuidpwdset(’tt’,'tt’)报错
场景一:
Command> callttcacheuidpwdset('tt','tt');
The command failed.
在testtt数据源中,要在General Connection页,在User Id这一栏填上tt,再点击CacheConnect页,看到Oracle UserID已经填上了tt。在OracleID一栏填上Oracle的ServiceName,在OraclePassword一栏填上对应的密码。
场景二:
Command> callttcacheuidpwdset('tt','tt');
Warning
be called.
Warning
be called.
Warning
to support caching LOBS fromOracle.
该错误是由于tt用户没有dba权限引起的。
需要在Oracle中,执行
SQL> grant dba to tt;
SQL> grant create any table tott;
3. create readonly cache group报错
Command> create readonly cachegroup read
>
>
> (a int primary key, bchar(10));
报错:
Warning
agent status
Warning
可通过重启cache解决:
Command> callttcachestop;
Command> callttcachestart;
- windows下TimesTen的配置及使用
- Windows下配置TimesTen的Cache Group
- 【转载】Linux下配置TimesTen使用HugePage
- 在Windows下配置Timesten内存数据库(一)
- Timesten for windows 配置流程
- Ngnix在Windows下的环境配置及使用 - 引言
- PHPUnit 在 Windows 下的配置及使用教程
- QtXlsx在Windows x64下的编译配置及使用
- Windows下msysGit使用及相关配置
- Windows下Git 安装、配置及使用
- Linux下TimesTen的安装
- Timesten数据库安装及配置体验
- Windows下MongoDB的安装及配置
- windows下MongoDB的安装及配置
- Windows下的NetBeans安装及配置
- windows下MongoDB的安装及配置
- windows下MongoDB的安装及配置
- Windows下的maven安装及配置
- 如何做到每天写代码?
- android switch语句中报出case expressions must be constant expressions
- highcharts动态刷新数据,得先清空上一个数据,不然会出现前一个图形和新数据的图形重合
- Nosql 8种Nosql数据库系统对比
- linux 书籍
- windows下TimesTen的配置及使用
- 二叉树的实现(2)链表
- MATLAB中将彩色的图像转化为灰度图像
- 访问者电脑的分辨率
- ASP.NET发送ICQ消息DIY
- Microsoft.Net中数字签名技术
- 采用python批量统计分析Excel表格数据
- iMatrix平台新版本6.0.0Dev功能更新说明
- Android Gson 解析