TimesTen_安装-创建数据库

TimesTen安装及创建数据库。

1,用户、用户组、目录准备
#log in as root
#create user group,allow direct driver connection
groupadd timesten

#create registry directory
mkdir /etc/TimesTen

#create admin group,install and uninstall
groupadd ttadmin
chgrp -R ttadmin /etc/TimesTen
chmod 770 /etc/TimesTen/
chmod 660 /etc/TimesTen/*

#create user
useradd -g timesten -G ttadmin tt

mkdir /tt
chown tt:timesten /tt

2,软件准备
下载timesten112220[1].linux86.tar.gz


3,安装
#logon as tt
cd /tt
3.1 解压
gunzip timesten112220[1].linux86.tar.gz
tar -xvf timesten112220[1].linux86.tar

3.2 安装
cd /linux
[tt@rhel5 linux86]$ ./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? [ tt1122 ]
Instance name will be 'tt1122'.
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/tt
  [2] /tt
  [3] Specify a location
  [q] Quit the installation

Where would you like to install the tt1122 instance of TimesTen? [ 1 ] 2
Where would you like to create the daemon home directory? [ /tt/TimesTen/tt1122/info ]

The daemon logs will be located in /tt/TimesTen/tt1122/info
Would you like to specify a different location for the daemon logs? [ no ]
Installing into /tt/TimesTen/tt1122 ...
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 53392.

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

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 'timesten'? [ 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 /bin/ttModInstall.

Please enter a value for TNS_ADMIN (s=skip)? [  ] s


NOTE: It appears that you are running version 3.4 or higher 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 3.4.6 library in the
      /lib directory and to the 3.4.6 server binary in the
      /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? [ 53393 ]
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)? [ /tt/TimesTen/tt1122 ]

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,
/tt/TimesTen/tt1122/info/DemoDataStore

Where would you like to create the DemoDataStore directory? [ /tt/TimesTen/tt1122/info ]
Creating /tt/TimesTen/tt1122/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 /tt/TimesTen/tt1122/bin
        ./setuproot -install
This will move the TimesTen startup script. into its appropriate location.

The startup script. is currently located here :
  '/tt/TimesTen/tt1122/startup/tt_tt1122'.

The Quickstart home page can be accessed here :
  '/tt/TimesTen/tt1122/quickstart/index.html'

The 11.2.2.2 Release Notes are located here :
  '/tt/TimesTen/tt1122/README.html'

Starting the daemon ...
TimesTen Daemon startup OK.
End of TimesTen installation.

3.3 配置自动启动
#logon as root
cd /tt/TimesTen/tt1122/bin
[root@rhel5 bin]# ./setuproot -install
Would you like to install the TimesTen daemon startup scripts into /etc/init.d? [ yes ]
Copying /tt/TimesTen/tt1122/startup/tt_tt1122 to /etc/init.d

Successfully installed the following scripts :
/etc/init.d/tt_tt1122
/etc/rc.d/rc0.d/K45tt_tt1122
/etc/rc.d/rc1.d/K45tt_tt1122
/etc/rc.d/rc2.d/S90tt_tt1122
/etc/rc.d/rc3.d/S90tt_tt1122
/etc/rc.d/rc5.d/S90tt_tt1122
/etc/rc.d/rc6.d/K45tt_tt1122

3.4 查看后台进程
#logon as tt
[tt@rhel5 linux86]$ cat /tt/TimesTen/tt1122/info/timestend.pid
15595

[tt@rhel5 linux86]$ ps -ef|grep TimesTen
tt       15595     1  0 07:51 ?        00:00:00 /tt/TimesTen/tt1122/bin/timestend -initfd 13
tt       15599 15595  0 07:51 ?        00:00:00 /tt/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000000 -facility user
tt       15600 15595  0 07:51 ?        00:00:00 /tt/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000001 -facility user
tt       15601 15595  0 07:51 ?        00:00:00 /tt/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000002 -facility user
tt       15602 15595  0 07:51 ?        00:00:00 /tt/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000003 -facility user
tt       15604 15595  0 07:51 ?        00:00:00 /tt/TimesTen/tt1122/bin/ttcserver -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000004 -p 53393 -facility user -group timesten

3.5 实例信息、运行日志、错误日志
[tt@rhel5 linux86]$ cat /tt/TimesTen/tt1122/info/ttendaemon.options
# Commented values are default values
#-supportlog /tt/TimesTen/tt1122/info/ttmesg.log
#-maxsupportlogfiles 10
#-maxsupportlogsize 10485760
#-userlog /tt/TimesTen/tt1122/info/tterrors.log
#-maxuserlogfiles 10
#-maxuserlogsize 0x100000
#
-verbose
#-tns_admin
-server 53393
[tt@rhel5 linux86]$ cat /tt/TimesTen/tt1122/info/ttmesg.log
07:51:19.62 Info:    : 15595: FD limits are 65536 / 65536
07:51:19.63 Info:    : 15595: Process running as user tt
07:51:19.63 Info:    : 15595: listening on port 53392
07:51:19.63 Warn:    : 15595: TimesTen Daemon Release 11.2.2.2.0.tt1122 started.
07:51:19.63 Info:    : 15595: Running in /tt/TimesTen/tt1122/info as group timesten
07:51:19.63 Info:    : 15595: Spawning '/tt/TimesTen/tt1122/bin/timestensubd'
07:51:19.63 Info:    : 15595: Spawned new process (timestensubd), idx 1000000, handle 0x3cef=15599
07:51:19.63 Info:    : 15595: Subdaemon id 1000000 started
07:51:19.63 Info:    : 15595: Spawning '/tt/TimesTen/tt1122/bin/timestensubd'
07:51:19.63 Info:    : 15595: Spawned new process (timestensubd), idx 1000001, handle 0x3cf0=15600
07:51:19.63 Info:    : 15595: Subdaemon id 1000001 started
07:51:19.63 Info:    : 15595: Spawning '/tt/TimesTen/tt1122/bin/timestensubd'
07:51:19.63 Info:    : 15595: Spawned new process (timestensubd), idx 1000002, handle 0x3cf1=15601
07:51:19.63 Info:    : 15595: Subdaemon id 1000002 started
07:51:19.63 Info:    : 15595: Spawning '/tt/TimesTen/tt1122/bin/timestensubd'
07:51:19.64 Info:    : 15595: Spawned new process (timestensubd), idx 1000003, handle 0x3cf2=15602
07:51:19.64 Info:    : 15595: Subdaemon id 1000003 started
07:51:19.64 Info:    : 15595: Spawning '/tt/TimesTen/tt1122/bin/ttcserver'
07:51:19.64 Info:    : 15595: Spawned new process (ttcserver), idx 1000004, handle 0x3cf4=15604
07:51:19.67 Info:    : 15600: FD limits are 65536 / 65536
07:51:19.67 Info:    : 15601: FD limits are 65536 / 65536
07:51:19.67 Info:    : 15600: Process running as user tt
07:51:19.67 Info:    : 15601: Process running as user tt
07:51:19.68 Info:    : 15602: FD limits are 65536 / 65536
07:51:19.68 Info:    : 15602: Process running as user tt

[tt@rhel5 linux86]$ cat /tt/TimesTen/tt1122/info/tterrors.log
07:51:19.63 Warn:    : 15595: TimesTen Daemon Release 11.2.2.2.0.tt1122 started.

[tt@rhel5 linux86]$ cat /etc/TimesTen/instance_info
#SUM 53845     1
[ tt1122 ]
Product=TimesTen11.2.2.2.0
InstallDir=/tt/TimesTen/tt1122
InstanceAdministrator=tt
DaemonHome=/tt/TimesTen/tt1122/info
BitLevel=32
Component=Client/Server and DataManager
TT_PORT=53392

3.6 启动、关闭实例
#stop
cd /tt/TimesTen/tt1122/bin
[tt@rhel5 bin]$ ./ttDaemonAdmin -stop
TimesTen Daemon stopped.

#start
[tt@rhel5 bin]$ ./ttDaemonAdmin -start
TimesTen Daemon startup OK.

3.7设置环境变量
#enviroment variables setting
#log on as tt
. ./bin/ttenv.sh

#永久设置
#log on as tt
cd
vi .bash_profile

# User specific environment and startup programs
TT_HOME=/tt/TimesTen/tt1122
PATH=$TT_HOME/bin/:$PATH:$HOME/bin
LD_LIBRARY_PATH=$TT_HOME/lib:$TT_HOME/ttoracle_home/instantclient_11_2:$LD_LIBRARY_PATH
CLASSPATH=$TT_HOME/lib/ttjdbc5.jar:$TT_HOME/lib/orai18n.jar:$TT_HOME/lib/timestenjmsxla.jar:$TT_HOME/3rdparty/jms1.1/lib/jms.jar:$CLASSPATH
ANT_HOME=$TT_HOME/3rdparty/ant:$ANT_HOME

export TT_HOME PATH LD_LIBRARY_PATH CLASSPATH ANT_HOME

32位UNIX上的缺省实例名称为tt1122_32,缺省端口为53384(Main Daemon)\53385(Server Daemon),cache agent 监听端口取决于操作系统,不能单独设置.

缺省情况下,LINUX安装位置为:$HOME/TimesTen,TimesTen使用临时文件目录为:/tmp

注:为了提高性能,需要对系统信号量、内存、网络进行合理设置,参考《Installtion Guide》Installation prerequisites.

[tt@rhel5 ~]$ ttVersion
TimesTen Release 11.2.2.2.0 (32 bit Linux/x86) (tt1122:53392) 2011-12-23T09:21:34Z
  Instance admin: tt
  Instance home directory: /tt/TimesTen/tt1122
  Group owner: timesten
  Daemon home directory: /tt/TimesTen/tt1122/info
  PL/SQL enabled.

4,创建数据库
4.1 设置DSN(Data Source Names)
#创建者必须为安装者
#log on as tt
mkdir /tt/ttdata
mkdir /tt/ttdata/database
mkdir /tt/ttdata/logs

vi /tt/TimesTen/tt1122/info/sys.odbc.ini
#在[ODBC Data Sources]段内追加:
test_db=TimesTen 11.2.2 Driver

#在[ODBC Data Sources]段后面追加:
[test_db]
Driver=/tt/TimesTen/tt1122/lib/libtten.so
DataStore=/tt/ttdata/database/test_db
LogDir=/tt/ttdata/logs
PermSize=40
TempSize=32
DatabaseCharacterSet=AL32UTF8

4.2创建数据库
TimesTen数据库在建立第一个连接时自动创建,连接一个已经存在但未装载到内存的数据库将导致装载数据到内存.
在确认TimesTen后台进程启动的情况下,以tt用户登录系统:
[tt@rhel5 info]$ ttisql

Copyright (c) 1996-2011, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.


Command> connect "dsn=test_db"
       > ;
Connection successful: DSN=test_db;UID=tt;DataStore=/tt/ttdata/database/test_db;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=/tt/TimesTen/tt1122/lib/libtten.so;LogDir=/tt/ttdata/logs;PermSize=40;TempSize=32;TypeMode=0;
(Default setting AutoCommit=1)

#支持格式:connect test_db [as conn1];connect "dsn=test_db;udi=tt";

5,简单测试
5.1 创建用户
con1: Command> create user mh identified by mh;

User created.
con1: Command> grant create session to mh;
con1: Command> disconnect;
Command> connect "dsn=test_db;uid=mh";
Enter password for 'mh':
Connection successful: DSN=test_db;UID=mh;DataStore=/tt/ttdata/database/test_db;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=/tt/TimesTen/tt1122/lib/libtten.so;LogDir=/tt/ttdata/logs;PermSize=40;TempSize=32;TypeMode=0;
(Default setting AutoCommit=1)

Command> select * from v$version;
 2206: Table MH.V$VERSION not found
The command failed.

5.2创建表
con1: Command> connect test_db;
con1: Command> create table t(x int,y int);
con1: Command> insert into t(x,y) values(1,1);
1 row inserted.
#--&gt缺省自动提交,在另外一个会话中可以看到该记录
con1: Command> rollback;
con1: Command> desc t;

Table TT.T:
  Columns:
    X                               NUMBER (38)
    Y                               NUMBER (38)

1 table found.
(primary key columns are indicated with *)
con1: Command> autocommit 0;
con1: Command> insert into t(x,y) values(2,2);
1 row inserted.
#--&gt关闭自动提交,在另外一个会话中不能看到该记录
con1: Command> commit;

5.3关闭实例,验证表和数据
con1: Command> disconnect
Disconnecting from con1...
none: Command> exit
Disconnecting from test_db...
Done.
[tt@rhel5 ~]$ ttDaemonAdmin -stop
TimesTen Daemon stopped.
[tt@rhel5 ~]$ ps -ef|grep Times
tt       17531 17509  0 19:32 pts/1    00:00:00 /tt/TimesTen/tt1122/bin/ttIsqlCmd
tt       17574 17443  0 19:48 pts/2    00:00:00 grep Times
[tt@rhel5 ~]$ ttDaemonAdmin -start
TimesTen Daemon startup OK.
[tt@rhel5 ~]$ ttisql
Command> connect test_db;
Connection successful: DSN=test_db;UID=tt;DataStore=/tt/ttdata/database/test_db;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=/tt/TimesTen/tt1122/lib/libtten.so;LogDir=/tt/ttdata/logs;PermSize=40;TempSize=32;TypeMode=0;
(Default setting AutoCommit=1)
Command> select * from t;
< 1, 1 >
< 2, 2 >
2 rows found.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/18922393/viewspace-720714/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/18922393/viewspace-720714/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值