安装timesten(18.1.4)
环境:
OS:Centos 7
DB:18.1.4
1.下载软件包
地址地址:
https://edelivery.oracle.com/osdc/faces/SoftwareDelivery
我这里下载的是V1035435-01.zip
2.解压到相应目录
我这里是解压后迁移到/opt/目录
[root@localhost cc]# unzip V1035435-01.zip
[root@localhost cc]# unzip timesten1814340.server.linux8664.zip
[root@localhost cc]# mv tt18.1.4.34.0 /opt/
3.创建用户
groupadd -g 10000 timesten
useradd -u 55000 -g timesten instanceadmin
passwd instanceadmin
4.检查
[root@localhost tt22.1.1.13.0]# /opt/tt18.1.4.34.0/bin/ttInstallationCheck
This installation has been verified.
5.创建实例目录
[root@localhost tt18.1.4.34.0]# mkdir -p /opt/tt18.1.4.34.0
[root@localhost tt18.1.4.34.0]# chown -R instanceadmin:timesten /opt/tt18.1.4.34.0
6.创建实例
[root@localhost tt18.1.4.34.0]# /opt/tt18.1.4.34.0/bin/ttInstanceCreate -name hxl -location /opt/tt18.1.4.34.0
ERROR: It is not allowed to install TimesTen as root.
Please refer to the installation guide for more information.
Aborting installation.
使用普通用户创建
[root@localhost opt]# su - instanceadmin
[instanceadmin@localhost ~]$ /opt/tt18.1.4.34.0/bin/ttInstanceCreate -name hxl -location /opt/tt18.1.4.34.0
Creating instance in /opt/tt18.1.4.34.0/myinstance/instance1 ...
INFO: Mapping files from the installation to /opt/tt18.1.4.34.0/hxl/install
NOTE: The TimesTen daemon startup/shutdown scripts have not been installed.
The startup script is located here :
'/opt/tt18.1.4.34.0/hxl/startup/tt_instance1'
Run the 'setuproot' script :
/opt/tt18.1.4.34.0/hxl/bin/setuproot -install
This will move the TimesTen startup script into its appropriate location.
The 18.1 Release Notes are located here :
'/opt/tt18.1.4.34.0/README.html'
7.设置环境变量
[instanceadmin@localhost ~]$source /opt/tt18.1.4.34.0/hxl/bin/ttenv.sh
[instanceadmin@localhost ~]$ which ttVersion
/opt/tt18.1.4.34.0/hxl/bin/ttVersion
[instanceadmin@localhost ~]$ ttVersion
TimesTen Release 18.1.4.34.0 (64 bit Linux/x86_64) (instance1:6624) 2023-05-17T14:33:45Z
Instance admin: instanceadmin
Instance home directory: /opt/tt18.1.4.34.0/hxl
Group owner: timesten
Daemon home directory: /opt/tt18.1.4.34.0/hxl/info
PL/SQL enabled.
[instanceadmin@localhost ~]$ ttStatus
ttStatus: Could not connect to the TimesTen daemon.
If the TimesTen daemon is not running, please start it
by running "ttDaemonAdmin -start".
可以修改用户的.bash_profile加入到环境变量中
TT_HOME=/opt/tt18.1.4.34.0/hxl
PATH=$TT_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
export PATH
8.创建配置文件中指定的目录
[root@localhost tt18.1.4.34.0]#mkdir -p /ttdb_data/ttdb
[root@localhost tt18.1.4.34.0]#mkdir -p /ttdb_log
[root@localhost tt18.1.4.34.0]#chown -R instanceadmin:timesten /ttdb_data/ttdb
[root@localhost tt18.1.4.34.0]#chown -R instanceadmin:timesten /ttdb_log
9.修改配置文件
[instanceadmin@localhost ~]$ cd /opt/tt18.1.4.34.0/hxl/conf
vi sys.odbc.ini
下面部分之前是注释掉的,现在将注释去掉,启用
[ODBC Data Sources]
sampledb=TimesTen 18.1 Driver
sampledbCS=TimesTen 18.1 Client Driver
[sampledb]
Driver=/opt/tt18.1.4.34.0/hxl/install/lib/libtten.so
DataStore=/ttdb_data/ttdb
PermSize=1024
TempSize=128
LogBufMB=256
LogFileSize=256
LogDir=/ttdb_log
DatabaseCharacterSet=ZHS16GBK
ConnectionCharacterSet=ZHS16GBK
OracleNetServiceName=ttorcl
[sampledbCS]
TTC_SERVER=sampledb_CS
TTC_SERVER_DSN=sampledb
这里的PermSize根据机器内存大小进行设置,不能手工修改该配置文件,需要通过命令的方式修改,具体查看
https://www.cnblogs.com/hxlasky/p/17452441.html
这里的数据目录和日志目录建议不同的目录,否则启动有如下告警
[instanceadmin@localhost diag]$ tail -200f tterrors.log
21:09:36.327 Warn: : 2965: TimesTen Daemon Release 18.1.4.34.0 started on 2023-06-07.
21:11:56.040 Warn: : 2965: 3041/0x231a300 Conn[1]: Checkpoint and log files for database </opt/tt18.1.4.34.0/hxl/data> appear to be on the same OS device. Moving the log files to a different OS device may significantly improve performance by reducing interference between checkpoint I/O and log I/O.
10.启动ttDaemonAdmin
[instanceadmin@localhost ~]$ ttDaemonAdmin -start
TimesTen Daemon (PID: 11153, port: 6624) startup OK.
[instanceadmin@localhost ~]$ ttStatus
TimesTen status report as of Thu Jun 1 21:52:38 2023
Daemon pid 2374 port 6624 instance instance1
TimesTen server pid 2381 started on port 6625
------------------------------------------------------------------------
------------------------------------------------------------------------
Accessible by group timesten
End of report
[ODBC Data Sources]
sampledb=TimesTen 18.1 Driver
sampledbCS=TimesTen 18.1 Client Driver
[sampledb]
Driver=/opt/tt18.1.4.34.0/hxl/install/lib/libtten.so
DataStore=/opt/tt18.1.4.34.0/hxl/data
PermSize=1024
TempSize=128
LogBufMB=256
LogFileSize=256
LogDir=/opt/tt18.1.4.34.0/hxl/datalog
DatabaseCharacterSet=ZHS16GBK
ConnectionCharacterSet=ZHS16GBK
OracleNetServiceName=ttorcl
[sampledbCS]
TTC_SERVER=sampledb_CS
TTC_SERVER_DSN=sampledb
11.本地登录
[instanceadmin@localhost conf]$ cd /opt/tt18.1.4.34.0/hxl/bin
./ttisql # 本地访问客户端
Command>connect "dsn=sampledb"; # 连接dsn,若不指定userid的话会默认使用timesten.conf定义的用户admin_user=instanceadmin
Command>create user hxl identified by 'oracle';
Command> grant all to hxl;
Command> tables;
0 tables found.
Command> procedures;
0 procedures found.
退出使用创建的用户登录
./ttisql
Command> connect "dsn=sampledb;uid=hxl;pwd=oracle";
建表:
Command> create table tb_test (id number not null primary key,name varchar2(31));
Command> insert into tb_test values (1, 'zhangshan');
Command> insert into tb_test values (2, 'lisi');
Command> commit;
Command> select * from tb_test;
< 1, zhangshan >
< 2, lisi >
2 rows found.
11.远程登录
[instanceadmin@localhost bin]$ cd /opt/tt18.1.4.34.0/hxl/bin
[instanceadmin@localhost bin]$ ./ttIsqlCS # 远程访问客户端
Command> connect "dsn=sampledbCS;uid=hxl;pwd=oracle";
Connection successful: DSN=sampledbCS;TTC_SERVER=sampledb_CS;TTC_SERVER_DSN=sampledb;UID=hxl;DATASTORE=/databases/sampledb;DATABASECHARACTERSET=AL32UTF8;CONNECTIONCHARACTERSET=US7ASCII;LOGFILESIZE=256;LOGBUFMB=256;LOGDIR=/logs;PERMSIZE=512;TEMPSIZE=128;ORACLENETSERVICENAME=ttorcl;
(Default setting AutoCommit=1)
Command> select * from HXL.TB_TEST;
< 1, zhangshan >
< 2, lisi >
2 rows found.
12.日常维护
停止/启动 timesten
su - instanceadmin
ttDaemonAdmin -stop
ttDaemonAdmin -start
查看状态
source /opt/tt18.1.4.34.0/hxl/bin/ttenv.sh
ttstatus
13.程序日志目录
[instanceadmin@localhost diag]$ pwd
/opt/tt18.1.4.34.0/hxl/diag
[instanceadmin@localhost diag]$ ls -al
total 9412
drwxr-x--- 3 instanceadmin timesten 85 Jun 2 04:10 .
drwxr-x--- 9 instanceadmin timesten 117 Jun 6 20:44 ..
-rw-r----- 1 instanceadmin timesten 0 Jun 2 04:07 .instance_create.log
drwxrwx--- 3 instanceadmin timesten 32 Jun 2 04:13 plsql
-rw------- 1 instanceadmin timesten 722543 Jun 6 21:15 tterrors.log
-rw------- 1 instanceadmin timesten 8644413 Jun 6 21:37 ttmesg.log
####################windows配置odbc客户端#######################
1.客户端安装相同版本的timesten客户端
下载解压后点击setup.exe进行安装
V1019777-01.zip
2.配置odbc
控制面板-->设置odbc数据源(64位)
这里填写timesten服务器的ip地址
点击Refresh会自动刷新出在服务器上配置的sampledb
3.客户端连接
C:\Users\Administrator>ttIsql
Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
Command> connect "DSN=timesten_dns";
Connection successful: DSN=timesten_dns;TTC_SERVER=tt_test;TTC_SERVER_DSN=sampledb;UID=hxl;DATASTORE=/databases/sampledb;DATABASECHARACTERSET=AL32UTF8;CONNECTIONCHARACTERSET=US7ASCII;LOGFILESIZE=256;LOGBUFMB=256;LOGDIR=/logs;PERMSIZE=512;TEMPSIZE=128;ORACLENETSERVICENAME=ttorcl;
(Default setting AutoCommit=1)
Command> tables;
HXL.TB_TEST
1 table found.
Command> select * from hxl.tb_test;
< 1, zhangshan >
< 2, lisi >
2 rows found.