TimesTen配置及使用.docx_第1页
TimesTen配置及使用.docx_第2页
TimesTen配置及使用.docx_第3页
TimesTen配置及使用.docx_第4页
TimesTen配置及使用.docx_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

目 录一.安装TimesTen1二.配置TT数据库(即DSN)11.配置过程12.查看TT状态43.创建TT用户5三.设置Cache Connect51.创建Oracle用户52.更新DSN配置63.创建测试表74.创建cache75.创建TimesTen表空间86.创建timesten 用户87.创建Grid88.创建Cache Group9四.用SQL Developer连接TT10五.异常处理121.connect test_tt报错122.执行call ttcacheuidpwdset(tt,tt)报错123.create readonly cache group报错12i一. 安装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. 配置数据库的大小。只需要设置Permanent Data 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 and SettingsAdministratorttstatusTimesTen status report as of Tue Sep 11 11:02:45 2012Daemon pid 696 port 53392 instance tt1122_32TimesTen server pid 1244 started on port 53393-Data store e:mydemotest_ttThere are 12 connections to the data storeShared Memory KEY Globaltest_tt.e|mydemo.SHM.10 HANDLE 0x288PL/SQL Memory KEY Globaltest_tt.e|mydemo.SHM.11 HANDLE 0x290 Address 0x5B8C0000Type PID Context Connection Name ConnIDProcess 3420 0x01030d78 test_tt 1Subdaemon 1172 0x00b7c398 Manager 2047Subdaemon 1172 0x00bcfb00 Rollback 2046Subdaemon 1172 0x01845470 Flusher 2045Subdaemon 1172 0x01857170 Monitor 2044Subdaemon 1172 0x018e8ef0 Deadlock Detector 2041Subdaemon 1172 0x0e339768 Checkpoint 2043Subdaemon 1172 0x0e38b4a8 Log Marker 2042Subdaemon 1172 0x0e3ed1f8 Aging 2040Subdaemon 1172 0x0e43ef38 HistGC 2039Subdaemon 1172 0x0e490c78 AsyncMV 2038Subdaemon 1172 0x0e4ea010 IndexGC 2037Replication policy : ManualCache Agent policy : ManualPL/SQL enabled.-Accessible by group WWW-B1818C3ACBBNoneEnd of report可以看到 DataStore e:mydemotest_tt 已经在运行了,且有一些后台的服务线程也已经启动。 且显示了相应的TimesTen监听端口号。比如主守护进程(Daemon)的端口号是17000;Server端的监听端口号是17002,这个端口号是当Client/Server配置的时候,远程Client端连接过来时,Server端这边的服务端口号;还有WebServer的端口号 17004,TimesTen自身带有一个自用的webserver的。 3. 创建TT用户在command窗口,执行如下命令创建TT用户tt:C:Documents and SettingsAdministratorttisql test_ttCopyright (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:TimesTenTT11221binttdv1122.dll;PermSize=64;TempSize=32;TypeMode=0;(Default setting AutoCommit=1)Command create user tt identified by tt;User created.Command grant all to tt;Command quit;三. 设置Cache Connect1. 创建Oracle用户由于Cache Connect访问Oracle的时候,必须有一个用户在TimesTen和Oracle中是一样的,通过这个用户登录TimesTen之后,然后 Cache Connect的底层通过这个用户去和Oracle通讯,来进行数据的两边同步。在前面我们已经创建了用户tt,那么现在在oracle中,我们也创建同样的用户tt,并授予相应的Oracle权限。以Oracle dba用户或系统用户登录Oracle,执行创建操作。C:Documents and SettingsAdministratorsqlplus system/testtestSQL create user tt identified by tt;用户已创建。SQL grant connect,resource,create any trigger to tt;授权成功。SQL grant dba to tt;授权成功。SQL commit;提交完成。2. 更新DSN配置在“控制面板 管理工具 - 数据源(ODBC)”的“系统DSN”页签,找到之前配置的数据源test_tt,执行如下步骤更新配置:1. 在“General Connection”页签,填上新建的TT访问Oracle的用户tt.2. 在“IMDB Cache”页签,填上tt用户的密码,及本地配置的要访问的Oracle的服务名。3. 配置完成后,依次点击“OK”、“确定”,保存设置。3. 创建测试表以tt用户登录Oracle,创建cache测试表。SQL connect tt/ttorcl 已连接。 SQL create table test(a int primary key, b char(10);表已创建。 SQL insert into test values(1,aaa);已创建 1 行。 SQL insert into test values(2,bbb);已创建 1 行。 SQL commit;提交完成。 SQL 4. 创建cacheC:Documents and SettingsAdministratorttisql test_ttCommand call ttcacheuidpwdset(tt,tt);Command call ttcachestart;5. 创建TimesTen表空间在此之后要创建一个cache grid,只cache grid的第一个数据库成员需要执行这个操作。注意,只有cache manager user能创建和管理cache grid,一个cache database只能属于一个cache grid,然后可以使用过程ttgridinfo来检查是否创建成功。在创建cache grid前,要先创建表空间,然后建timesten用户,操作创建grid才不会报错。创建一个单独的表空间来管理缓存到timesten 的对象 SQLcreate tablespace timesten datafile D:oracleproduct10.2.0oradataorcltimesten.dbf size 50m;6. 创建timesten 用户运行initCacheGlobalSchema.sql脚本来创建用户,这用户拥有存储cache grid 和grid member信息的表。这个脚本在%TimesTen_install_dir%/oraclescripts 目录下。在创建之前,请切换到脚本所在目录,再以oracle dba或system用户登录:C:TimesTentt1122_32oraclescriptsC:TimesTentt1122_32oraclescriptssqlplus system/Younuoda2006orclSQL initCacheGlobalSchema timesten;Please enter the tablespace where TIMESTEN user is to be createdThe value chosen for tablespace is timesten* Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE starts *1. Creating TIMESTEN schema2. Creating TIMESTEN.TT_GRIDID table3. Creating TIMESTEN.TT_GRIDINFO table4. Creating TT_CACHE_ADMIN_ROLE role5. Granting privileges to TT_CACHE_ADMIN_ROLE* Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE done successfully *PL/SQL 过程已成功完成。7. 创建Grid执行ttisql test_dsn连接内存库,创建Grid。C:Documents and SettingsAdministratorttisql test_ttCommand call ttGridCreate(myGrid);Command call ttGridNameSet(myGrid);8. 创建Cache Group1. 创建Cache Group。Command create readonly cache group test_cg autorefresh interval 5 seconds from test (a int primary key,b char(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 aging defined Root Table: TT.TEST Table Type: Read Only1 cache group found.在未装载前,cache group的自动刷新状态是Paused。3. 装载cache group。Command load cache group read commit every 10 rows; 4. 检查cache group是否装载成功。Command select * from test; 2 rows found.此后,在Oracle数据库中插入到test表的数据,5秒钟之后都会被刷新到TimesTen中来,Cache Connect正常运转了。5. 通过ttstatus命令可以看到cache agent已经启动:C:Documents and SettingsAdministratorttstatus test_ttTimesTen status report as of Thu Sep 13 16:18:14 2012Daemon pid 2812 port 53392 instance tt1122_32TimesTen server pid 2640 started on port 53393-Data store e:mydemotest_ttThere are 16 connections to the data storeShared Memory KEY Globaltest_tt.e|mydemo.SHM.10 HANDLE 0x294PL/SQL Memory KEY Globaltest_tt.e|mydemo.SHM.11 HANDLE 0x298 Address 0x5B8C0000Type PID Context Connection Name ConnIDCache Agent 1448 0x00df9ff0 Handler 2Cache Agent 1448 0x0c60ce30 Timer 3Cache Agent 1448 0x0d310540 Aging 4Cache Agent 1448 0x0d3ccd70 BMReporter(1976) 6Cache Agent 1448 0x0d600d10 Refresher(S,5000) 7Subdaemon 2924 0x00b7c398 Manager 2047Subdaemon 2924 0x00bcfb00 Rollback 2046Subdaemon 2924 0x01804dc0 Flusher 2044Subdaemon 2924 0x01816ac0 Monitor 2045Subdaemon 2924 0x018acce0 Deadlock Detector 2043Subdaemon 2924 0x0da60048 Aging 2042Subdaemon 2924 0x0dac1038 AsyncMV 2041Subdaemon 2924 0x0db44260 Checkpoint 2040Subdaemon 2924 0x0db95fa0 Log Marker 2039Subdaemon 2924 0x0dbe7ce0 HistGC 2038Subdaemon 2924 0x0dc6e588 IndexGC 2037Replication policy : ManualCache Agent policy : ManualTimesTens Cache agent is running for this data storePL/SQL enabled.-Accessible by group WWW-B1818C3ACBBNoneEnd of report四. 用SQL Developer连接TT在使用SQL Developer前,要确保本机上已经安装jdk。建议安装jdk1.5或jdk1.6版本。1. 打开SQL Developer。在第一次打开的时候,需要在java的安装路径下选择javaw.exe。2. 新建连接。选择“+”图标,或是在“连接”上右键选择“新建”。3. 设置连接属性。选择“TimesTen”页签,连接类型为“直接驱动程序”,连接字符串的形式为“DSN=test_conn;DATASTORE=E:MyDemotest_tt;ORACLENETSERVICENAME=orcl;”其中,dsn、datastore、oraclenetservicename均已在系统DSN下配置。4. 配置完成后,点击“测试”,如果状态为成功,则表明连接成功;否则,请根据错误提示进行修改。5. 测试后,选择“连接”。连接成功后,在数据库的图标上,会有个电源样式的小图标。表明该数据库是当前正在使用的数据库。五. 异常处理1. connect test_tt报错Command connect test_tt; 836: Cannot create data store shared-memory segment, error 3The command failed.检查之后,发现是在ODBC中设置DataStore的路径时出现错误,MyDemo目录是在E盘下而不是D盘。改了之后就能连接了。2. 执行call ttcacheuidpwdset(tt,tt)报错场景一:Command call ttcacheuidpwdset(tt,tt); 5010: No OracleNetServiceName specified in DSNThe command failed.在testtt数据源中,要在General Connection页,在User Id这一栏填上tt,再点击Cache Connect页

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论