Windows环境下安装TimesTen

一、Windows安装TimesTen

1.环境:

TimesTen 11.2.2.8.0 for Windows 64

Jdk 1.8

Oracle11gR2 64

Windows Server 2012R2 64

2.安装:

1)管理员身份运行setup、选择安装到的目录Next

 

2)勾选示例数据库Next

 

3)设置示例数据库存放目录Next

 

4)设置Tns,为Cache Group 链接Oracle数据库使用,这里默认先不填。Next

 

5)创建程序文件夹名。Next

 

6)一路默认Next

 

  

  

7)选择JDK版本,这里没有我们安装的版本选NONENext

 

8)显示安装信息,Next

 

9)进入安装环节

 

10)安装完毕,Finish

 

二、创建 TimesTen 11g 2 版数据库

1检查

  1. 定义一个数据源名称(DSN)
  2. 指定数据源名称、数据存储路径和名称、数据库的大小以及数据库字符集。
  3. 验证数据库守护进程是否正在运行
  4. 使用ttisql/连接并创建数据库

2、开始创建:

  1. 定义一个数据源名称(DSN)

转到“控制面板->管理工具->ODBC数据源(64位)”以创建数据源名称。DSN(数据源名称)定义了数据库的配置,在创建数据库之前必须定义DSN

1)添加系统数据源

 

2)选择TimesTen数据管理驱动

 

3)填写DSN信息

1)Data Store

 

字段:

Data Source Name:数据源名称

Description:数据源描述

Data Store Path + Name:数据库文件存放位置和名称,名称要和数据源名称一致

Transaction Log Directory:事务日志目录

Database Character Set:数据库字符集,和源数据库字符集一致

Oracle数据库服务端执行SQL

Select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

 

2) First Connection

 

3) TimesTen Cache

Oracle Net Service Name:要连接的oracle数据库的服务名

 

Ok,信息配置完成

4Cmd->ttstatus,注ttstatus命令只能在设置TimesTen环境变量的情况下运行,如果没有设置的话。您需要运行位于TimesTen安装文件夹的bin目录中的ttenv.bat脚本。

 

链接创建好的DSN,用ttisql命令

因为这是第一个连接,所以正在创建数据库yl_cachedb,然后将其加载到内存中

 

现在已经创建了数据库并将其加载到内存中,使用dssize命令检查这个数据库的大小

 

此参数值与先前创建DSN参数相匹配。

执行host ttstatus命令查看数据库连接状态

 

 这里显示了到yl_cachedb数据库当前的ttlsql连接其他连接是用于管理数据库的TimesTen系统进程

2.创建用户

创建一个数据库用户,并授予他Create ESSIONCreate TABLE特权

执行语句:

建用户:create user ttadmin identified by ttadmin;

 

授权:grant create session,create view,admin,cache_manager,create table to ttadmin;

 

 注意:这里不能直接授予dba权限。

链接用户:connect “dsn=yl_cachedb;uid=ttadmin”; 注意:是英文引号

 

  

创建表

语句:create table test(

Id integer not null primary key,

Name Nvarchar2(50) not null,

PassWord Nvarchar2(50) not null,

Count number(3),

AddTime Date default sysdate

);

创建索引

语句:create index testidx on test(Name);

查询用户下所有表:tables

查询用户下所有的索引:indexes;

断开链接:exit

 

 4.检查数据存储和事务日志目录的内容。应该创建数据库检查点和事务日志文件

TimesTen获取磁盘上数据库内容的两个完整映像。这些映像称为检查点文件

 

 事务日志被持久化到磁盘。它们用于数据库恢复和复制

 

三、创建 TimesTen 缓存数据库

一、检查

  1. 配置到Oracle数据库的网络连接
  2. 定义一个数据源名称(DSN)
  3. 指定数据源名称、数据存储路径和名称、数据库的大小、数据库字符集和Oracle net服务名称
  4. 使用ttisql/连接并创建缓存数据库
  5. 使用Passthrough验证到Oracle数据库的连接

二、开始

  1. 检查环境变量,运行安装目录下的ttenv.bat,这里主要检查TNS ADMIN是否配置正确,先前没有安装没有配置,现在用ttmodinstall来配置一下。

注:TNS ADMIN值确定TNSNAMES.ORA文件的的位置。TimesTen连接Oracle数据库要读取这个文件。

 

 

 配置TNSNAMES.ORA文件,把C:\TimesTen\tt1122_64\network\admin\samples目录下的tnsnames.ora文件copytns_admin值的目录下,修改成要远程的oracle数据库。

 

 

 Sqlplus登陆数据库,报错:could not resolve the connect identifier specified,由于本测试机没有安装Oracle服务端,于是安装了odac,安装完成后,把odac目录中的bin目录添加到path环境变量中,再用sqlplus登陆成功。

 

 DSN(数据源名)定义了缓存数据库的配置,在创建缓存数据库之前必须定义DSN

这里新建DSN,控制面板-》管理工具-ODBC数据源(64位)-》系统DSN-》添加。步骤已从二、创建 TimesTen 11g 2 版数据库演示过了。创建完成

在创建数据库之前,主数据库守护进程必须正在运行,以检查是否运行ttstatus命令

 

   接下来使用命令行工具ttisql链接到刚才创建的数据库。

 

 为了缓存Oracle表,拥有要缓存的Oracle表的用户也必须存在于缓存数据库中

创建一个数据库用户(注意:这里的用户名必须要和oracle数据库的用户名一致),并授予他创建会话和创建表特权

Command>create user ylcache identified by ylcache;

Command>grant create session,create table to ylcache;

Command>connect “dsn=ylht_cachedb;uid=ylcache;oraclepwd=ylcache”;

注:这里的oraclepwdoracle数据库用户的密码。

然后执行passthrough命令来验证对oracle的链接是否正常。

passthrough参数(缺省值为0)说明:

0

is the default setting and specifies that all statements are to be executed in the TimesTen database.

1

specify that a statement that references a table that does not exist in the TimesTen database is passed through to the Oracle database for execution.

2

INSERT, UPDATE and DELETE statements are passed through to the Oracle database for read-only cache groups and user managed cache groups that use the READONLY cache table attribute. Otherwise, Passthrough=1 behavior applies.

3

all statements are passed through to the Oracle database for execution, except that INSERT, UPDATE and DELETE statements issued on cache tables in a dynamic AWT global cache group result in a TimesTen error.

4

SELECT statements issued on cache tables in a dynamic AWT global cache group that do not satisfy the criteria for a dynamic load query are passed through to the Oracle database for execution

5

SELECT statements issued on cache tables in a dynamic AWT global cache group that do not satisfy the criteria for a dynamic load query are passed through to the Oracle database for execution when all committed updates on cache tables in dynamic AWT global cache groups by previous transactions within the connection have been propagated to the Oracle database. Otherwise, statements are executed in the TimesTen database.

详情见:https://blog.csdn.net/stevensxiao/article/details/51052150

Command>passthrough 3;

Command>select * from v$version;

 

 创建缓存数据库完成。

猜你喜欢

转载自www.cnblogs.com/TangKnife/p/12889106.html