Oracle TimesTen In-Memory Databaseインストレーション・ガイド リリース11.2.1 を見ながらインストールしていきます。
インメモリDBなので、メモリは多めに取りましょう。 ここでは仮想マシンには4GB確保しました。 1GBくらいでも簡単な検証なら大丈夫です。
/etc/sysctl.conf でメモリの設定をします。 下記のように追記しました。
#pre{{
# for TimesTen 11g net.ipv4.tcp_rmem=4096 4194304 4194304 net.ipv4.tcp_wmem=98304 4194304 4194304 net.core.rmem_default=262144 net.core.wmem_default=262144 net.core.rmem_max=4194304 net.core.wmem_max=4194304 net.ipv4.tcp_window_scaling=1 net.ipv4.ip_local_port_range="1024 65000" }}
有効にします。
#pre{{ [root@ora1 ~]# sysctl -p }}
ttadmin グループと timesten ユーザを作成します。
#pre{{ [root@ora1 ~]# groupadd ttadmin [root@ora1 ~]# adduser timesten -g ttadmin [root@ora1 ~]# id timesten uid=501(timesten) gid=503(ttadmin) 所属グループ=503(ttadmin) [root@ora1 ~]# passwd timesten Changing password for user timesten. New UNIX password: ... }}
#pre{{ [root@ora1 ~]# mkdir /etc/TimesTen [root@ora1 ~]# chgrp -R ttadmin /etc/TimesTen [root@ora1 ~]# chmod 770 /etc/TimesTen/ }}
timestenユーザにてインストールを進めていきます。 まず tar で展開します。
#pre{{ [timesten@ora1 ~]$ tar xvpfz timesten112161.linux8664.tar.gz linux8664/ linux8664/doc/ linux8664/doc/doc.zip linux8664/3rdparty/ linux8664/3rdparty/jms-1_1-fr-apidocs.tar.bz2 linux8664/3rdparty/ant-1.6.2-bin.tar.bz2 linux8664/behaviorchanges.txt linux8664/setup.sh linux8664/uninst.sh linux8664/LINUX8664/ linux8664/LINUX8664/timesten.tar.bz2 linux8664/LINUX8664/unzip linux8664/LINUX8664/ttpatchinst linux8664/LINUX8664/ttserver.tar.bz2 linux8664/LINUX8664/manifest linux8664/LINUX8664/perl linux8664/LINUX8664/common.tar.bz2 linux8664/LINUX8664/bzip2 linux8664/LINUX8664/ttclient.tar.bz2 linux8664/README.html linux8664/install.pl [timesten@ora1 ~]$ }}
setup.sh を実行します。 いろいろ聞かれますが、ほとんどそのまま Enter で通しました。
#pre{{ [timesten@ora1 ~]$ cd linux8664/ [timesten@ora1 linux8664]$ ./setup.sh
NOTE: Each TimesTen installation is identified by a unique instance name.
The instance name must be a non-null alphanumeric string, not longer than 255 characters.
Please choose an instance name for this installation? [ tt1121 ] Instance name will be 'tt1121'. Is this correct? [ yes ]
Of the three components:
[1] Client/Server and Data Manager [2] Data Manager Only [3] Client Only
Which would you like to install? [ 1 ]
Of the following options :
[1] /home/timesten [2] /home/timesten/linux8664 [3] Specify a location [q] Quit the installation
Where would you like to install the tt1121 instance of TimesTen? [ 1 ] Where would you like to create the daemon home directory? [ /home/timesten/TimesTen/tt1121/info ]
The daemon logs will be located in /home/timesten/TimesTen/tt1121/info Would you like to specify a different location for the daemon logs? [ no ] Installing into /home/timesten/TimesTen/tt1121 ... Uncompressing ... 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 53388.
Do you want to use the default port number for the TimesTen daemon? [ yes ] The daemon will run on the default port number (53388).
NOTE: For security, we recommend that you restrict access to the
TimesTen installation to members of a single OS group. Only members of that OS group will be allowed to perform direct mode connections to TimesTen, and only members of that OS group will be allowed to perform operations that access TimesTen data stores, TimesTen files and shared memory. The OS group defaults to the primary group of the instance administrator. You can default to this group, choose another OS group or you can make this instance world-accessible. If you choose to make this instance world-accessible, all database files and shared memory are readable and writable by all users.
Restrict access to the the TimesTen installation to the group 'ttadmin'? [ yes ]
NOTE: Enabling PL/SQL will increase the size of some TimesTen libraries.
Would you like to enable PL/SQL for this instance? [ yes ]
In order to use the 'In-Memory 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/ttModInstall.
Please enter a value for TNS_ADMIN (s=skip)? [ ] s
NOTE: It appears that you are running version 4.1 of the g++
compiler. TimesTen ships with multiple sets of client libraries and server binaries : one built for compatibility with g++ 3.4.6 and one with g++ 4.1.0. The installer has created links to the 4.1.0 library in the <install_dir>/lib directory and to the 4.1.0 server binary in the <install_dir>/bin directory. If you want to use a different compiler, please modify the links to point to the desired library and server binary.
Installing server components ... What is the TCP/IP port number that you want the TimesTen Server to listen on? [ 53389 ] Do you want to install QuickStart and the TimesTen Documentation? [ no ] yes Where would you like to install the quickstart and doc directories (s=skip)? [ /home/timesten/TimesTen/tt1121 ]
The TimesTen Quickstart applications can take up to 64 Mbytes of disk space. Depending on how your system is configured, you may not want to create the QuickStart DemoDataStore directory in the default location, /home/timesten/TimesTen/tt1121/info/DemoDataStore
Where would you like to create the DemoDataStore directory? [ /home/timesten/TimesTen/tt1121/info ] Creating /home/timesten/TimesTen/tt1121/info/DemoDataStore ...
Installing client components ...
Would you like to use TimesTen Replication with Oracle Clusterware? [ no ]
NOTE: The TimesTen daemon startup/shutdown scripts have not been installed.
Run the 'setuproot' script :
cd /home/timesten/TimesTen/tt1121/bin ./setuproot -install
This will move the TimesTen startup script into its appropriate location.
The startup script is currently located here :
'/home/timesten/TimesTen/tt1121/startup/tt_tt1121'.
The Quickstart home page can be accessed here :
'/home/timesten/TimesTen/tt1121/quickstart/index.html'
The 11.2.1.6 Release Notes are located here :
'/home/timesten/TimesTen/tt1121/README.html'
Starting the daemon ... TimesTen Daemon startup OK. End of TimesTen installation. [timesten@ora1 linux8664]$ }}
長々とありますが、聞かれていたのは次のようなものです。
デモ用のデータストアに接続してみます。
環境変数の設定は TimesTen/tt1121/bin/ttenv.sh で行います。 あらかじめ ~/.bash_profile で読むようにしてもいいですね。
#pre{{ [timesten@ora1 ~]$ . TimesTen/tt1121/bin/ttenv.sh ... }}
接続情報は TimesTen/tt1121/info/sys.odbc.ini に書いてあります。 ここでは sampledb_1121 に接続してみました。 表示は改行してあります。
#pre{{ [timesten@ora1 ~]$ ttisql sampledb_1121
Copyright (c) 1996-2010, Oracle. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=sampledb_1121"; Connection successful: DSN=sampledb_1121;UID=timesten; DataStore=/home/timesten/TimesTen/tt1121/info/DemoDataStore/sampledb_1121; DatabaseCharacterSet=US7ASCII; ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1121/lib/libtten.so; PermSize=40;TempSize=32;TypeMode=0; (Default setting AutoCommit=1) Command> }}
#pre{{ Command> tables; 0 tables found. Command> }}
表は何も入っていないようです。適当に作ってみました。
#pre{{ Command> create table sample (id number(10), data varchar2(1000)); Command> insert into sample values (1, 'abcdefg'); 1 row inserted. Command> insert into sample values (2, 'hijklmn'); 1 row inserted. Command> insert into sample values (3, 'opqrstu'); 1 row inserted. Command> insert into sample values (4, 'vwxyz'); 1 row inserted. Command> select * from sample;
1, abcdefg >
2, hijklmn >
3, opqrstu >
4, vwxyz > 4 rows found. Command> }}
set timing on とすると時間も計測できます。
#pre{{ Command> select * from sample where id = 3;
3, opqrstu > 1 row found. Execution time (SQLExecute + Fetch Loop) = 0.000041 seconds. Command> }}
41マイクロ秒でした。 マイクロ秒単位でのレスポンスが返ってくるのがTimesTenのいいところです。 ちゃんとメモリ上に載れば、たとえ5000万件あってもこれくらいで返ってきます。
ttDaemonAdmin で起動と終了を行います。 確認は ttStatus です。
#pre{{ [timesten@ora1 ~]$ ttDaemonAdmin -start TimesTen Daemon startup OK. [timesten@ora1 ~]$ ttStatus TimesTen status report as of Sun Aug 22 11:57:14 2010
Daemon pid 7100 port 53388 instance tt1121 TimesTen server pid 7120 started on port 53389
Data store /home/timesten/TimesTen/tt1121/info/DemoDataStore/sampledb_1121 There are no connections to the data store Replication policy : Manual Cache Agent policy : Manual PL/SQL enabled.
Accessible by group ttadmin End of report [timesten@ora1 ~]$ }}
#pre{{ [timesten@ora1 ~]$ ttDaemonAdmin -stop TimesTen Daemon stopped. [timesten@ora1 ~]$ ttStatus ttStatus: Could not connect to the TimesTen daemon. If the TimesTen daemon is not running, please start it by running "ttDaemonAdmin -start". [timesten@ora1 ~]$ }}