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;

 

 

 創建緩存數據庫完成。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM