或者
问答详情页顶部banner图
您的位置:首页 >推广 > 其他 > 其他 > 如何配置timesten data manager

如何配置timesten data manager

提问者:lis1314  |   分类:其他  |   浏览306次  |   悬赏分:3积分 2017-03-26 09:54:12

我要回答

提 交

匿名

  • mayjun

    在摸索了好几天之后,终于把怎样在windows下配置TimesTen的DSN、CacheGroup和使用SQL Developer给弄明白了。以下是写的总结,留作以后参考。 一.安装TimesTen TimesTen的安装很简单,直接执行安装程序,选择默认设置即可。在安装前,需要确认如下两点: 1. 确认安装TimesTen的服务器上已经有jdk,且jdk的版本为1.5或1.6。 2. 确认服务器访问Oracle的配置文件tnsnames.ora的路径,该路径是TimesTen安装时,需要指定的TNS_ADMIN的值。如“F:oracleproduct10.2.0client_1NETWORKADMIN”。 二.配置TT数据库(即DSN) TT数据库中,一个DSN即是一个TT实例。 1. 配置过程 在安装TT软件后,可通过如下步骤配置DSN: 1. 进入“控制面板 –>管理工具 ->数据源(ODBC)”,在“系统DSN”页签,选择“添加”。 2. 选择数据库驱动程序,TimesTen相关的驱动程序有2个,"TimesTen Client 11.2.2"是用于访问非本机数据库用的,由于我们要在本机建立数据库,所以选择"TimesTen Data Manager 11.2.2”。 3. 配置DSN基本属性。 在选择DataSource Path时,要确保该目录已经存在。 且此处Database Character Set必须与Oracle的字符集相同,如果不同,后面还需要重新配置数据源。 4. 配置数据库的大小。只需要设置PermanentData Size和Temporary Data Size的大小,单位均是M。 5. 配置字符集。这里的字符集也是必须与Oracle保持一致。 6. 配置完成后,依次点击“OK”、“确定”,保存设置。 7. 在cmd窗口,执行ttisql test_tt,检查DSN是否创建成功。或是在ttisql下,执行connect test_tt。 正常情况下应如下图所示: 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 PID Context Connection Name ConnID Process 3420 0x01030d78 test_tt 1 Subdaemon 1172 0x00b7c398 Manager 2047 Subdaemon 1172 0x00bcfb00 Rollback 2046 Subdaemon 1172 0x018****0 Flusher 2045 Subdaemon 1172 0x018****0 Monitor 2044 Subdaemon 1172 0x018e8ef0 Deadlock Detector 2041 Subdaemon 1172 0x0e339768 Checkpoint 2043 Subdaemon 1172 0x0e38b4a8 Log Marker 2042 Subdaemon 1172 0x0e3ed1f8 Aging 2040 Subdaemon 1172 0x0e43ef38 HistGC 2039 Subdaemon 1172 0x0e490c78 AsyncMV 2038 Subdaemon 1172 0x0e4ea010 IndexGC 2037 Replication policy : Manual Cache Agent policy : Manual 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. All rights reserved. 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. 在“GeneralConnection”页签,填上新建的TT访问Oracle的用户tt. 2. 在“IMDBCache”页签,填上tt用户的密码,及本地配置的要访问的Oracle的服务名。 3. 配置完成后,依次点击“OK”、“确定”,保存设置。 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. 创建CacheGroup。 Command> create readonly cache grouptest_cg >autorefresh interval 5seconds >from test >(a int primary key,bchar(10)); 其中,test_cg为Cache Group的名,test为前面在Oracle中创建的测试表。 2. 创建完后,执行cachegroups检查是否创建成功: Command> cachegroups ; Cache Group TT.TEST_CG: Cache Group Type:Read Only Autorefresh:Yes Autorefresh Mode:Incremental Autorefresh State:Paused Autorefresh Interval:5 Seconds Autorefresh Status:ok Aging: No agingdefined Root Table:TT.TEST Table Type: ReadOnly 1 cache group found. 在未装载前,cachegroup的自动刷新状态是Paused。 3. 装载cachegroup。 Command> load cache group read commit every 10rows; 4. 检查cache group是否装载成功。 Command> select * fromtest; < 1, aaa > < 2, bbb > 2 rows found. 此后,在Oracle数据库中插入到test表的数据,5秒钟之后都会被刷新到TimesTen中来,CacheConnect正常运转了。 5. 通过ttstatus命令可以看到cache agent已经启动: 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 PID Context Connection Name ConnID Cache Agent 1448 0x00df9ff0 Handler 2 Cache Agent 1448 0x0c60ce30 Timer 3 Cache Agent 1448 0x0d310540 Aging 4 Cache Agent 1448 0x0d3ccd70 BMReporter(1976) 6 Cache Agent 1448 0x0d600d10 Refresher(S,5000) 7 Subdaemon 2924 0x00b7c398 Manager 2047 Subdaemon 2924 0x00bcfb00 Rollback 2046 Subdaemon 2924 0x01804dc0 Flusher 2044 Subdaemon 2924 0x01816ac0 Monitor 2045 Subdaemon 2924 0x018acce0 Deadlock Detector 2043 Subdaemon 2924 0x0da60048 Aging 2042 Subdaemon 2924 0x0dac1038 AsyncMV 2041 Subdaemon 2924 0x0db44260 Checkpoint 2040 Subdaemon 2924 0x0db95fa0 Log Marker 2039 Subdaemon 2924 0x0dbe7ce0 HistGC 2038 Subdaemon 2924 0x0dc6e588 IndexGC 2037 Replication policy : Manual Cache Agent policy : Manual 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. 打开SQLDeveloper。在第一次打开的时候,需要在Java的安装路径下选择javaw.exe。 2. 新建连接。 选择“+”图标,或是在“连接”上右键选择“新建”。 3. 设置连接属性。选择“TimesTen”页签,连接类型为“直接驱动程序”,连接字符串的形式为“DSN=test_conn;DATASTORE=E:MyDemotest_tt;ORACLENETSERVICENAME=orcl;” 其中,dsn、datastore、oraclenetservicename均已在系统DSN下配置。 4. 配置完成后,点击“测试”,如果状态为成功,则表明连接成功;否则,请根据错误提示进行修改。 5. 测试后,选择“连接”。连接成功后,在数据库的图标上,会有个电源样式的小图标。表明该数据库是当前正在使用的数据库。 五.异常处理 1. connecttest_tt报错 Command> connecttest_tt; 836: Cannot createdata store shared-memory segment, error 3 The command failed. 检查之后,发现是在ODBC中设置DataStore的路径时出现错误,MyDemo目录是在E盘下而不是D盘。改了之后就能连接了。 2. 执行callttcacheuidpwdset(’tt’,'tt’)报错 场景一: Command> callttcacheuidpwdset('tt','tt'); 5010: NoOracleNetServiceName specified in DSN The command failed. 在testtt数据源中,要在General Connection页,在User Id这一栏填上tt,再点击CacheConnect页,看到Oracle UserID已经填上了tt。在OracleID一栏填上Oracle的ServiceName,在OraclePassword一栏填上对应的密码。 场景二: Command> callttcacheuidpwdset('tt','tt'); Warning 5183: Functionkollglid2 was not in the library. The function will not be called. Warning 5183: Functionkollgsnp2 was not in the library. The function will not be called. Warning 5186: The OCI clientlibrary in use does not contain required routines 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 > autorefreshinterval 5 seconds > fromtest > (a int primary key, bchar(10)); 报错: Warning 5002: Unable toconnect to the cache agent for e:mydemotesttt; check agent status Warning 5051: Commit messageto cache agent failed. Cache agent must be restarted 可通过重启cache解决: Command> callttcachestop; Command> callttcachestart;

    2017-06-07 15:35:59
    评论0  |   0
问答详情中间banner