TimesTen 18.1.2.1 Classic模式安装与配置过程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/stevensxiao/article/details/89447946

概述

TimesTen 18.1.2.1版是首个兼容TimesTen Classic模式的安装包。Release Notes是这么说的:

This release supports Classic TimesTen In-Memory Database, in addition to TimesTen Scaleout.

Oracle Blogs里是这么说的:

One Download, Two Products …

也就是说一个介质中包含了两种类型的安装方式,此版本详细的新特性请见此PPT

安装文档请参Oracle Docs中的Installation, Migration, and Upgrade Guide

介质下载

Oracle网站下载,版本选择Linux
Edelivery上也有,主要搜索关键字为“Oracle TimesTen In-Memory Database”。
此介质的MD5SUM为:7b5fc2f506a89f8560b503cb61774841

准备操作系统

操作系统的支持以Linux为主,详见下图:
在这里插入图片描述
本例中使用Oracle Linux 7。

如果使用VagrantBox,可使用以下的Vagrantfile,如果不是请忽略。

Vagrant.configure("2") do |config|
  config.vm.provider :virtualbox do |vb|
        vb.name = "tt18121"
	vb.memory = 2048
	vb.cpus = 2
  end
  config.vm.box = "ol7-latest"
  config.vm.hostname = "tt18121"
  config.vm.network "private_network", ip: "192.168.0.11"
end

用户,组设定

假定用户oracle为实例管理员,假定timestenr为TimesTen 用户组,命令如下:

sudo groupadd -g 10000 timesten
sudo useradd -u 55000 -g timesten oracle
sudo passwd oracle

查看用户:

$ id oracle
uid=55000(oracle) gid=10000(timesten) groups=10000(timesten)

为方便,本例赋予实例管理员用户sudo,虽然这不是必需的:

usermod -aG wheel oracle

目录设定

规划如下:

  • 安装文件位于/u01/installation
  • 数据库文件位于/u01/database,数据和日志文件分布位于其下的data和log目录
    命令如下:
sudo mkdir -p /u01/installation
sudo mkdir -p /u01/database/data
sudo mkdir -p /u01/database/log
sudo chown oracle:timesten /u01/installation
sudo chown -R oracle:timesten /u01/database

创建安装

切换到实例管理员用户,本例为oracle。

su - oracle

创建安装:

unzip -d /u01/installation/ /vagrant/timesten181210.server.linux8664.zip

查看安装目录:

$ cd /u01/installation/
$ ls
tt18.1.2.1.0
$ cd tt18.1.2.1.0/
$ ll
total 96
dr-xr-x---. 3 oracle timesten    51 Feb 18 20:56 3rdparty
dr-xr-x---. 2 oracle timesten  4096 Feb 18 20:56 bin
dr-xr-x---. 4 oracle timesten    31 Feb 18 20:56 grid
dr-xr-x---. 3 oracle timesten  4096 Feb 18 20:56 include
dr-xr-x---. 2 oracle timesten  4096 Feb 18 20:56 info
dr-xr-x---. 3 oracle timesten  4096 Feb 18 20:56 lib
dr-xr-x---. 3 oracle timesten    19 Feb 18 20:56 network
dr-xr-x---. 3 oracle timesten    18 Feb 18 20:56 nls
dr-xr-x---. 2 oracle timesten  4096 Feb 18 20:56 oraclescripts
dr-xr-x---. 4 oracle timesten    40 Feb 18 20:56 PERL
dr-xr-x---. 7 oracle timesten    68 Feb 18 20:56 plsql
-r--r-----. 1 oracle timesten 76902 Feb 18 20:56 README.html
dr-xr-x---. 2 oracle timesten    26 Feb 18 20:56 startup
dr-xr-x---. 2 oracle timesten    90 Feb 18 20:56 support
dr-xr-x---. 3 oracle timesten    32 Feb 18 20:56 ttoracle_home
$ du -sh .
1.3G    .

验证安装:

cd /u01/installation/tt18.1.2.1.0/bin
./ttInstallationCheck

输出如下:

$ ./ttInstallationCheck
This installation has been verified.

创建classic实例

一路回车,只有设置TNS_ADMIN 时输入s。

$ ./ttInstanceCreate

NOTE: Each TimesTen instance is identified by a unique name.
      The instance name must be a non-null alphanumeric string, not longer
      than 255 characters.

Please choose an instance name for this installation? [ tt181 ]
Instance name will be 'tt181'.
Is this correct? [ yes ]
Where would you like to install the tt181 instance of TimesTen? [ /home/oracle ]
Creating instance in /home/oracle/tt181 ...
INFO: Mapping files from the installation to /home/oracle/tt181/install

NOTE: If you are configuring TimesTen for use with Oracle Clusterware, the
      daemon port number must be the same across all TimesTen installations
      managed within the same Oracle Clusterware cluster.

NOTE: All installations that replicate to each other must use the same daemon
      port number that is set at installation time. The daemon port number can
      be verified by running 'ttVersion'.

The default port number is 6624.

Do you want to use the default port number for the TimesTen daemon? [ yes ]
The daemon will run on the default port number (6624).

In order to use the 'TimesTen Application-Tier Database Cache' feature in any databases
created within this installation, you must set a value for the TNS_ADMIN
environment variable. It can be left blank, and a value can be supplied later
using <install_dir>/bin/ttInstanceModify.

Please enter a value for TNS_ADMIN (s=skip)? [  ] s
What is the TCP/IP port number that you want the TimesTen Server to listen on? [ 6625 ]

Would you like to use TimesTen Replication with Oracle Clusterware? [ no ]

NOTE: The TimesTen daemon startup/shutdown scripts have not been installed.

The startup script is located here :
        '/home/oracle/tt181/startup/tt_tt181'

Run the 'setuproot' script :
        /home/oracle/tt181/bin/setuproot -install
This will move the TimesTen startup script into its appropriate location.

The 18.1 Release Notes are located here :
  '/u01/installation/tt18.1.2.1.0/README.html'

Starting the daemon ...
TimesTen Daemon (PID: 5640, port: 6624) startup OK.

以上为实例的完全安装,如果只想安装客户端可以运行一下命令:

./ttInstanceCreate -clientonly

查看实例配置文件:

$ cat $TIMESTEN_HOME/conf/timesten.conf
# TimesTen Instance Configuration File
# Created by ttInstanceCreate
# Commented values are default values
hostname=ol7-vagrant
timesten_release=18.1.2
instance_name=tt181
daemon_port=6624
server_port=6625
admin_user=oracle
admin_uid=55000
group_name=timesten
instance_guid=B1E7F2DE-1383-4100-A9E2-6B8E15BED96D
verbose=1

为日志文件记录添加日期

默认的日志文件记录只输出时间,没有日期。
修改文件timesten.conf:

vi $TIMESTEN_HOME/conf/timesten.conf

添加以下行:

show_date=1

重启Daemon生效:

$ ttdaemonadmin -restart
TimesTen Daemon (PID: 13264, port: 6624) stopped.
TimesTen Daemon (PID: 13425, port: 6624) startup OK.

验证:

$ tail  $TIMESTEN_HOME/diag/ttmesg.log
...
2019-04-22 14:42:55.432 Info:    : 13425: << Date : Mon Apr 22 14:42:55 2019, daemon port 6624 >>
2019-04-22 14:42:56.432 Info:    : 1342 ...

环境变量设置

echo 'export TIMESTEN_HOME=~/tt181' >> ~/.bash_profile
echo 'export PATH=$PATH:$TIMESTEN_HOME/bin' >> ~/.bash_profile
source ~/.bash_profile

然后验证实例状态:

$ ttversion
TimesTen Release 18.1.2.1.0 (64 bit Linux/x86_64) (tt181:6624) 2019-02-18T19:19:18Z
  Instance admin: oracle
  Instance home directory: /home/oracle/tt181
  Group owner: timesten
  Daemon home directory: /home/oracle/tt181/info
  PL/SQL enabled.

设置实例开机自动启动

是可选的设置。

sudo TIMESTEN_HOME=$TIMESTEN_HOME -s
cd $TIMESTEN_HOME/bin
./setuproot -install -force

输出如下:

[root@ol7-vagrant bin]# ./setuproot -install -force
Copying /home/oracle/tt181/startup/tt_tt181 to /etc/init.d

Successfully installed the following scripts :
/etc/init.d/tt_tt181
/etc/rc.d/rc0.d/K45tt_tt181
/etc/rc.d/rc1.d/K45tt_tt181
/etc/rc.d/rc2.d/S90tt_tt181
/etc/rc.d/rc3.d/S90tt_tt181
/etc/rc.d/rc5.d/S90tt_tt181
/etc/rc.d/rc6.d/K45tt_tt181

重启机器验证实例已自动启动:

$ ttstatus
TimesTen status report as of Mon Apr 22 04:14:00 2019

Daemon pid 3072 port 6624 instance tt181
TimesTen server pid 3079 started on port 6625
------------------------------------------------------------------------
------------------------------------------------------------------------
Accessible by group timesten
End of report
$ ps -ef|grep -i timesten
oracle    3072     1  0 04:12 ?        00:00:00 /home/oracle/tt181/install/bin/timestend -initfd 13 -minsubs 2 -boot
oracle    3076  3072  0 04:12 ?        00:00:00 /u01/installation/tt18.1.2.1.0/bin/timestensubd -verbose -id 1000000 -facility user
oracle    3077  3072  0 04:12 ?        00:00:00 /u01/installation/tt18.1.2.1.0/bin/timestensubd -verbose -id 1000001 -facility user
oracle    3079  3072  0 04:12 ?        00:00:00 /u01/installation/tt18.1.2.1.0/bin/ttcserver -verbose -id 1000002 -p 6625 -facility user -group timesten
oracle    5171  5135  0 04:14 pts/0    00:00:00 grep --color=auto -i timesten

创建数据库

进入配置文件目录,编辑DSN配置文件sys.odbc.ini:

cd $TIMESTEN_HOME/conf
vi sys.odbc.ini

创建新DSN,本例为TTDB。在[ODBC Data Sources]一节中添加一行:

[ODBC Data Sources]
...
TTDB=TimesTen 18.1 Driver
...

创建一新的小节[TTDB]如下:

[TTDB]
Driver=/home/oracle/tt181/install/lib/libtten.so
DataStore=/u01/database/data/ttdb
LogDir=/u01/database/log
PermSize=512
TempSize=64
LogBufMB=256
LogBufParallelism=8
DatabaseCharacterSet=ZHS16GBK
ConnectionCharacterSet=ZHS16GBK
OracleNetServiceName=orcl

以上假设:

  • 字符集为ZHS16GBK,请与Oracle数据库字符集一致
  • Oracle数据库的TNS接口名为orcl
  • Permsize和TempSize为内存数据库的大小
    根据实际情况更改你的配置。

创建数据库:

[oracle@ol7-vagrant database]$ ttisql ttdb

Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.



connect "DSN=ttdb";
Connection successful: DSN=TTDB;UID=oracle;DataStore=/u01/database/data/ttdb;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;DRIVER=/home/oracle/tt181/install/lib/libtten.so;LogBufMB=256;LogBufParallelism=8;LogDir=/u01/database/log;PermSize=512;TempSize=64;OracleNetServiceName=orcl;
(Default setting AutoCommit=1)
Command> dssize
The following values are in MB:

  PERM_ALLOCATED_SIZE:      512
  PERM_IN_USE_SIZE:         14.041
  PERM_IN_USE_HIGH_WATER:   14.071
  TEMP_ALLOCATED_SIZE:      64
  TEMP_IN_USE_SIZE:         17.853
  TEMP_IN_USE_HIGH_WATER:   23.949

Command> exit
Disconnecting...
Done.

设置数据库内存加载策略:

此为可选步骤。
设置加载策略为手动:

ttadmin -rampolicy manual ttdb

设置完后,以后必须用以下命令加载和卸载数据库:

ttadmin -ramload ttdb
ttadmin -ramunload ttdb

设置与Oracle数据库的连接

假设有一Oracle数据库,网络可达。
首先拷贝样例tnsnames.ora文件:

cp /u01/installation/tt18.1.2.1.0/network/admin/samples/tnsnames.ora $TIMESTEN_HOME/conf
chmod u+w $TIMESTEN_HOME/conf

编辑此文件,添加Oracle数据库接口描述,也可以直接从Oracle数据库上拷贝此文件。以下为示例

$ cat tnsnames.ora
...
orcl =
 (DESCRIPTION=
 (ADDRESS=(PROTOCOL=tcp)(HOST=10.1.16.70)(PORT=1521))
 (CONNECT_DATA=(SERVICE_NAME=orcl)))

使用以下的命令测试Oracle数据库联通性:

sqlplus username/password@orcl
sqlplus sys/password@orcl as sysdba

猜你喜欢

转载自blog.csdn.net/stevensxiao/article/details/89447946
今日推荐