本文主要是介绍TimesTen Classic 18c 安装与配置过程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
参考
Complete example for installing and uninstalling TimesTen Classic
概述
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 = 2048vb.cpus = 2endconfig.vm.box = "ol7-latest"config.vm.hostname = "tt18121"config.vm.network "private_network", ip: "192.168.0.11"
end
用户,组设定
假定用户oracle为实例管理员,假定timesten为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,虽然这不是必需的:
sudo usermod -aG wheel oracle
目录设定
规划如下:
- 安装文件位于/u01/installation (安装文件不是安装介质,指TimesTen术语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.*/bin
unset TIMESTEN_HOME
./ttInstallationCheck
```exit
注意,需要unset环境变量是为防止ttInstallationCheck命令检查$TIMESTEN_HOME目录。
当然也可以直接指定安装目录,例如:
```bash
$ ./ttInstallationCheck
This installation has been verified.$ ./ttInstallationCheck -install_dir /u01/installation/tt18.1.4.1.0/This installation has been verified.
创建classic实例
一路回车,只有设置TNS_ADMIN 时输入s。
$ ./ttInstanceCreateNOTE: Each TimesTen instance is identified by a unique name.The instance name must be a non-null alphanumeric string, not longerthan 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/installNOTE: If you are configuring TimesTen for use with Oracle Clusterware, thedaemon port number must be the same across all TimesTen installationsmanaged within the same Oracle Clusterware cluster.NOTE: All installations that replicate to each other must use the same daemonport number that is set at installation time. The daemon port number canbe 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
环境变量设置
执行以下命令,注意不是粘贴到.bash_profile文件中:
echo 'export TIMESTEN_HOME=~/tt181' >> ~/.bash_profile
echo '. $TIMESTEN_HOME/bin/ttenv.sh' >> ~/.bash_profile
source ~/.bash_profile
然后验证实例状态:
$ ttversion
TimesTen Release 18.1.2.1.0 (64 bit Linux/x86_64) (tt181:6624) 2019-02-18T19:19:18ZInstance admin: oracleInstance home directory: /home/oracle/tt181Group owner: timestenDaemon home directory: /home/oracle/tt181/infoPL/SQL enabled.
查看实例配置文件:
$ 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 ...
设置实例开机自动启动
是可选的设置(需要用户有sudo权限,否则记录TIMESTEN_HOME环境变量后,用root执行)。
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.dSuccessfully 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 2019Daemon 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]如下,其中内存大小的单位为M:
[ODBC Data Sources]
TTDB=TimesTen 18.1 Driver[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
注意第一节[ODBC Data Sources]中的声明也很重要,否则SQL Developer看不到此条目。
以上假设:
- 字符集为ZHS16GBK,请与Oracle数据库字符集一致
- Oracle数据库的TNS接口名为orcl
- Permsize和TempSize为内存数据库的大小
根据实际情况更改你的配置。
创建数据库:
$ ttisql ttdbCopyright (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: 512PERM_IN_USE_SIZE: 14.041PERM_IN_USE_HIGH_WATER: 14.071TEMP_ALLOCATED_SIZE: 64TEMP_IN_USE_SIZE: 17.853TEMP_IN_USE_HIGH_WATER: 23.949Command> exit
Disconnecting...
Done.
设置数据库内存加载策略:
此为可选步骤。
设置加载策略为手动:
ttadmin -rampolicy manual ttdb
设置完后,以后必须用以下命令加载和卸载数据库:
ttadmin -ramload ttdb
ttadmin -ramunload ttdb
如果希望随daemon自动启动,可以如下设置:
ttadmin -rampolicy always ttdb
设置与Oracle数据库的连接
假设有一Oracle数据库,网络可达。
首先拷贝样例tnsnames.ora文件:
cp /u01/installation/tt18.1.*/network/admin/samples/tnsnames.ora $TIMESTEN_HOME/conf
chmod u+w $TIMESTEN_HOME/conf/tnsnames.ora
编辑此文件,添加Oracle数据库接口描述,也可以直接从Oracle数据库上拷贝此文件。以下为示例
$ cat tnsnames.ora
...orclpdb =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = odbserver)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orclpdb)))
需要使用ttinstancemodify来修改TNS_ADMIN,使sqlplus可以找到tnsnames.ora文件。本例设置为$TIMESTEN_HOME/conf
$ ttinstancemodifyInstance Info
-------------Name: tt181
Version: 18.1.4.1.0
Location: /home/oracle/tt181
Installation: /u01/installation/tt18.1.4.1.0
Daemon Port: 6624
Server Port: 6625Would you like to change the installation that this instance points to? [ no ]The daemon for instance 'tt181' is currently configured to use port 6624.
Would you like to change this port? [ no ]
The server for instance 'tt181' is currently configured to use port 6625.
Would you like to change this port? [ no ]
TNS_ADMIN for the instance 'tt181' is currently not set.
Would you like to change TNS_ADMIN for this instance? [ no ] yes
Please enter a value for TNS_ADMIN (q=quit)? [ ] /home/oracle/tt181/confDo you want to restart the daemon using the new configuration? [ yes ]
Restarting the daemon ...
TimesTen Daemon (PID: 6392, port: 6624) stopped.
TimesTen Daemon (PID: 15305, port: 6624) startup OK.
The instance 'tt181' is now configured with :
TNS_ADMIN=/home/oracle/tt181/confWould you like to configure TimesTen Replication with Oracle Clusterware? [ no ]
TNS_ADMIN实际上重新登陆后才能生效,如果需要马上生效:
export TNS_ADMIN=$TIMESTEN_HOME/conf
使用以下的命令测试Oracle数据库联通性:
sqlplus username/password@orcl
sqlplus sys/password@orcl as sysdba
下一步
如果想快速测试缓存组,可参见Timesten Classic 18.1 建立缓存组
这篇关于TimesTen Classic 18c 安装与配置过程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!