ITPub博客

首页 > Linux操作系统 > Linux操作系统 > CentOS 6.3下安装TimesTen

CentOS 6.3下安装TimesTen

原创 Linux操作系统 作者:deitylee 时间:2013-06-26 10:27:15 0 删除 编辑
Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE CentOS 6.3安装TimesTen

一.前期准备工作

[root@OS4~]#groupadd timesten                                                 [root@OS4 ~]# useradd -g timesten -G dba -d /opt/timesten timesten                  

[root@OS4 ~]# su - timesten 

[root@OS4 ~]# vi /opt/timesten/.bash_profile

        PATH=$PATH:$HOME/bin

export ORACLE_BASE=/opt/oracle/

export ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1

export ORACLE_SID=NINVOICE

export TIMESTEN=/opt/timesten/TimesTen/tt1122

export LD_LIBRARY_PATH=$TIMESTEN/lib:$ORACLE_HOME/lib

export PATH=$TIMESTEN/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin

export TNS_ADMIN=/opt/oracle/product/11.2.0/dbhome_1/network/admin/

export TIMESTEN=/opt/timesten/TimesTen/tt1122

unset USERNAME

export PATH

[root@OS4 ~]#mkdir /etc/TimesTen

[root@OS4 ~]#chown timesten.timesten /etc/TimesTen

二.安装过程

[root@OS4 ~]# su - timesten                                                                                                                                                                      

-bash-4.1$ ls                                                                  

timesten112250.linux8664.tar.gz                                                

-bash-4.1$ tar -zxvf timesten112250.linux8664.tar.gz                           

           linux8664/                                                                     

           linux8664/uninst.sh                                                            

           linux8664/install.pl                                                           

           linux8664/README.html                                                           

           linux8664/LINUX8664/                                                           

           linux8664/LINUX8664/ttpatchinst                                                

           linux8664/LINUX8664/unzip                                                       

           linux8664/LINUX8664/common.tar.bz2                                             

           linux8664/LINUX8664/ttclient.tar.bz2                                           

           linux8664/LINUX8664/perl                                                        

           linux8664/LINUX8664/manifest                                                   

           linux8664/LINUX8664/timesten.tar.bz2                                           

           linux8664/LINUX8664/bzip2                                                      

           linux8664/LINUX8664/ttserver.tar.bz2                                           

           linux8664/3rdparty/                                                            

           linux8664/3rdparty/ant-1.6.2-bin.tar.bz2                                       

           linux8664/3rdparty/jms-1_1-fr-apidocs.tar.bz2                                  

           linux8664/doc/                                                                  

           linux8664/doc/doc.zip                                                          

           linux8664/setup.sh                                                             

-bash-4.1$ cd linux8664/                                                        

-bash-4.1$ ls                                                                  

3rdparty  doc  install.pl  LINUX8664  README.html  setup.sh  uninst.sh         

-bash-4.1$ ./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] /opt/timesten                                                            

  [2] /opt/timesten                                                            

  [3] Specify a location                                                       

  [q] Quit the installation                                                    

Where would you like to install the tt1122 instance of TimesTen? [ 1 ]         

Where would you like to create the daemon home directory? [ /opt/timesten/TimesTen/tt1122/info ]                                                                

The daemon logs will be located in /opt/timesten/TimesTen/tt1122/info          

Would you like to specify a different location for the daemon logs? [ no ]     

Installing into /opt/timesten/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 53396.                                              

Do you want to use the default port number for the TimesTen daemon? [ yes ]    

The daemon will run on the default port number (53396).                        

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 ]                     

      TNS_ADMIN exists in your environment and is set to :                     

      /opt/oracle/product/11.2.0/dbhome_1/network/admin/                       

Would you like to use this TNS_ADMIN setting for the In-Memory Database Cache? [ yes ]

TNS_ADMIN will be set to /opt/oracle/product/11.2.0/dbhome_1/network/admin/    

You can change TNS_ADMIN later by running /bin/ttmodinstall.      

NOTE: It appears that you are running version 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 4.1.0 library in the   

      /lib directory and to the 4.1.0 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? [53397 ]                                                                       

Do you want to install QuickStart and the TimesTen Documentation? [ no ]       

Would you like to install the documentation (without QuickStart)? [ yes ]      

Where would you like to create the doc directory (s=skip)? [ /opt/timesten/TimesTen/tt1122/doc ]                                                               

The TimesTen documentation has been installed in /opt/timesten/TimesTen/tt1122/doc.                                                                            

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 /opt/timesten/TimesTen/tt1122/bin                                    

        ./setuproot -install                                                   

This will move the TimesTen startup script. into its appropriate location.      

The startup script. is currently located here :                                  

  '/opt/timesten/TimesTen/tt1122/startup/tt_tt1122'.                           

The 11.2.2.5 Release Notes are located here :                                  

  '/opt/timesten/TimesTen/tt1122/README.html'                                   

Starting the daemon ...                                                        

TimesTen Daemon startup OK.                                                    

End of TimesTen installation.                                                  

三.同步用户数据

1.       创建三个Oracle数据用户

  (1).创建timesten用户使用TimesTen自带脚本

[oracle@OS4 oraclescripts]$ sqlplus / as sysdba                                

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 25 22:42:56 2013            

Copyright (c) 1982, 2009, Oracle.  All rights reserved.                        

Connected to:                                                                  

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production   

With the Partitioning, OLAP, Data Mining and Real Application Testing options 

SQL> @initCacheGlobalSchema.sql                                                 

Please enter the tablespace where TIMESTEN user is to be created               

USERS                                                                          

The value chosen for tablespace is USERS                                       

 

******* Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE starts *******     

1. Creating TIMESTEN schema                                                    

2. Creating TIMESTEN.TT_GRIDID table                                           

3. Creating TIMESTEN.TT_GRIDINFO table                                         

4. Creating TT_CACHE_ADMIN_ROLE role                                           

5. Granting privileges to TT_CACHE_ADMIN_ROLE                                  

** Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE done successfully **    

PL/SQL procedure successfully completed. 

              (2). 创建一个管理cache的用户

SQL> create user cacheadmin identified by cacheadmin;                          

User created.

             授权给cacheadmin

                 SQL> @grantCacheAdminPrivileges.sql "cacheadmin"                                

Please enter the administrator user id                                         

The value chosen for administrator user id is cacheadmin                        

 

***************** Initialization for cache admin begins ******************     

0. Granting the CREATE SESSION privilege to CACHEADMIN                         

1. Granting the TT_CACHE_ADMIN_ROLE to CACHEADMIN                              

2. Granting the DBMS_LOCK package privilege to CACHEADMIN                      

3. Granting the RESOURCE  privilege to CACHEADMIN                              

4. Granting the CREATE PROCEDURE  privilege to CACHEADMIN                      

5. Granting the CREATE ANY TRIGGER  privilege to CACHEADMIN                    

6. Granting the DBMS_LOB package privilege to CACHEADMIN                       

7. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEADMIN              

8. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEADMIN             

9. Checking if the cache administrator user has permissions on the default

tablespace                                                                     

                                 No existing permission.                                                   

10. Altering the cache administrator to grant unlimited tablespace on USERS    

11. Granting the CREATE TYPE privilege to CACHEADMIN                           

12. Granting the SELECT on SYS.GV$LOCK privilege to CACHEADMIN (optional)      

13. Granting the SELECT on SYS.GV$SESSION privilege  to CACHEADMIN (optional)  

14. Granting the SELECT on SYS.DBA_DATA_FILES privilege  to CACHEADMIN         

(optional)                                                                      

15. Granting the SELECT on SYS.USER_USERS privilege  to CACHEADMIN (optional)  

16. Granting the SELECT on SYS.USER_FREE_SPACE privilege  to CACHEADMIN        

(optional)                                                                      

17. Granting the SELECT on SYS.USER_TS_QUOTAS privilege  to CACHEADMIN         

(optional)                                                                     

18. Granting the SELECT on SYS.USER_SYS_PRIVS privilege  to CACHEADMIN         

(optional)                                                                     

********* Initialization for cache admin user done successfully *********

         (3). 创建一个业务用户                                                                   

SQL> create user netinvoice identified by netinvoice;                          

User created.

             cacheadmin一样的进行授权操作

2.       设置/opt/timesten/TimesTen/tt1122/info/sys.odbc.ini

[TT_1122]

Driver=/opt/timesten/TimesTen/tt1122/lib/libtten.so

DataStore=/opt/timesten/TimesTen/tt1122/info/TT_1122

DatabaseCharacterSet=AL32UTF8             #(与数据库字符必须一致)

OracleNetServiceName=NINVOICE            #(tnsnames.ora里面配置名称)

ConnectionCharacterSet=AL32UTF8

PermSize=2048                           #(单位为M)

TempSize=1024                           #(单位为M)

3.       启动TimesTen

-bash-4.1$ ttdaemonadmin -stop                                                 

TimesTen Daemon stopped.                                                       

-bash-4.1$ ttdaemonadmin -start                                                

TimesTen Daemon startup OK.                                                    

-bash-4.1$ ttisql TT_1122                                                      

 

Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.   

Type ? or "help" for help, type "exit" to quit ttIsql.                         

connect "DSN=TT_1122";                                                         

Connection successful: DSN=TT_1122;UID=timesten;DataStore=/opt/timesten/TimesTen

/tt1122/info/TT_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=AL32UT

F8;DRIVER=/opt/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=10

24;TypeMode=0;OracleNetServiceName=NINVOICE;                                   

(Default setting AutoCommit=1)   

4.       创建TimesTen内存数据库的用户,用户必须和Oracle数据库名称相同

Command> create user cacheadmin identified by cacheadmin;                      

User created.                                                                  

Command> grant create session,cache_manager,create any table to cacheadmin;    

Command> create user netinvoice identified by netinvoice;                        

User created.                                                                  

Command> grant create session,create any table to netinvoice;

5.       TimesTen链接到Oracle数据库

Command> call ttcacheuidpwdset('cacheadmin','cacheadmin');

6.       创建GridTimesTen特性必须把cache group让在grid

Command> call ttGridCreate('myGrid');                                          

Command> call ttGridnameSet('myGrid');

         7 现在使用建立的netinvoice用户连接TimesTen

               -bash-4.1$ ttisql "dsn=TT_1122;uid=cacheadmin;pwd=cacheadmin;oraclepwd=cacheadmin";

                              Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.   

Type ? or "help" for help, type "exit" to quit ttIsql.                         

connect "dsn=TT_1122;uid=netinvoice;pwd=netinvoice;oraclepwd=netinvoice";      

Connection successful: DSN=TT_1122;UID=netinvoice;DataStore=/opt/timesten/TimesT

en/tt1122/info/TT_1122;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;DRIVER=/opt/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=1024;TypeMode=0;OracleNetServiceName=NINVOICE;                                 

(Default setting AutoCommit=1)                                                 

7.       Orace数据库里面建立表和唯一索引,TimesTen必须需要是一个主键和唯一索引

[oracle@OS4 ~]$ sqlplus / as sysdba                                            

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 25 23:50:20 2013            

Copyright (c) 1982, 2009, Oracle.  All rights reserved.                        

Connected to:                                                                  

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production   

With the Partitioning, OLAP, Data Mining and Real Application Testing options  

SQL> conn netinvoice/netinvoice                                                

Connected.                                                                     

SQL> select * from tab;                                                         

no rows selected                                                               

SQL> create table a (id number,name varchar2(20));                             

Table created.

           SQL> create unique index a_idx on a(id);       #不建唯一索引,创建cache group时回报错                              

Index created.  

8.       Load数据到TimesTen

1.启动cache

Command>call ttcachestart

2.启动cache之后就可以创建cache group了,创建group时,需要将表的名字和结构设置成语oracle数据库中test用户下的需要加载的表的名字和结构一模一样,这样才能匹配找到相应的表,否则无法加载数据。(这里创建的readonly类型的group)

Command>create readonly cache group cache_a Autorefresh interval 5 seconds mode incremental From netinvoice.a(id number not null primary key , name varchar2(20));

3. load cache group cache_a commit every 10 rows;

  四.遇到的问题及解决方法

     1.修改正在使用的DSN的字符集报错。

           报错提示

                            -bash-4.1$ ttisql "dsn=TT_1122;uid=cacheadmin;pwd=cacheadmin;oraclepwd=cacheadmi

Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.  

connect "DSN=TT_1122";                                                         

                     6228: Invalid value (AL32UTF8) for DatabaseCharacterSet connection attribute --

value must be the same as the current data store value (US7ASCII)

The command failed.                                                            

Done.

           分析

                                                 这个问题是因为已经初始化一次TT_1122后又修改了sys.odbc.iniDatabaseCharacterSet=AL32UTF8参数。

      解决方法,删掉TT_1122重新初始化并且重新建立用户

                                                 -bash-4.1$ ttDestroy TT_1122                                                                                                      

-bash-4.1$ pwd                                                                 

/opt/timesten/TimesTen/tt1122/info                                                                                                                              

-bash-4.1$ ttisql TT_1122                                                      

Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.   

Type ? or "help" for help, type "exit" to quit ttIsql.                         

connect "DSN=TT_1122";                                                         

Connection successful: DSN=TT_1122;UID=timesten;DataStore=/opt/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;DRIVER=/opt/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=1024;TypeMode=0;OracleNetServiceName=NINVOICE;                                   

(Default setting AutoCommit=1)                                                 

Command> exit                                                                  

Disconnecting...                                                               

Done.

 

Command> grant create session,cache_manager,create any table to cacheadmin;    

Command> create user netinvoice identified by netinvoice;                      

User created.                                                                  

Command> grant create session,create any table to netinvoice;                  

Command> exit                                                                   

Disconnecting...                                                               

Done.  

                   2.解析不到TNS_ADMIN报错

            报错提示                                                

Command> call ttcacheuidpwdset('cacheadmin','cacheadmin');                     

 5220: Permanent Oracle connection failure error in OCIServerAttach(): ORA-12154

: TNS:could not resolve the connect identifier specified rc = -1               

 5935: Could not validate Oracle login: uid = CACHEADMIN, pwd = HIDDEN, OracleNe

tServiceName = NINVOICE, TNS_ADMIN = "/opt/oracle/product/11.2.0/dbhome_1/networ

k/admin/", ORACLE_HOME= "/opt/oracle/product/11.2.0/dbhome_1"                  

The command failed.

            分析

                根据提示是因为TimesTen不能解析链接Oracle数据库的TNS

            解决问题

                a).检查TimesTen安装过程中配置的TNS_ADMIN是否正确,如果不正确,可以在timesten用户下使用ttmodinstall命令进行修改。

                b).检查被链接的Oracle数据库TNS是否正常开启,使用tnsping

                c).查看timesten用户对tnsnames.ora是否有可读权限(上错有此引起)

         3.netivoice用户没有启用cache权限

             报错提示

                                         Command> call ttcachestart;                                                    

15100: User NETINVOICE lacks privilege CACHE_MANAGER                           

The command failed.                                                            

Command> exit                                                                  

Disconnecting...                                                               

Done. 

             解决方案

                                      -bash-4.1$ ttisql TT_1122                                                                                

Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.   

Type ? or "help" for help, type "exit" to quit ttIsql.                         

connect "DSN=TT_1122";                                                         

Connection successful: DSN=TT_1122;UID=timesten;DataStore=/opt/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;DRIVER=/opt/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=10

24;TypeMode=0;OracleNetServiceName=NINVOICE;                                   

(Default setting AutoCommit=1)                                                 

Command> grant cache_manager to netinvoice;                                     

Command> exit                                                                  

Disconnecting...                                                               

Done.  

                    4.创建cachegroup时报错

                            报错提示

                                     Command> create readonly cache group cache_a autorefresh interval 5 seconds mode

 incremental fromnetinvoice.a(id number not null primary key,name varchar2(20));                                                                             

 5120: No matching unique index with not null columns, unique key constraint wit

h not null columns, or primary key constraint on table NETINVOICE.A, cache opera

tions are restricted                                                           

5168: Restricted cache groups are deprecated                                  

5126: A system managed cache group cannot contain non-standard column type mapping                                                                            

The command failed.    

            分析

               提示说需要一个唯一索引在primary key

            解决方法

                [oracle@OS4 ~]$ sqlplus / as sysdba                                             

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jun 26 00:17:05 2013           

Copyright (c) 1982, 2009, Oracle.  All rights reserved.                       

Connected to:                                                                  

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production   

With the Partitioning, OLAP, Data Mining and Real Application Testing options  

SQL> conn netinvoice/netinvoice                                                

Connected.                                                                     

SQL> create unique index a_idx on a(id);                                        

Index created.

                   5.load  chache  group报错

                            报错提示

Command> load cache group readcache_large commit every 256 rows;
5056: The cache operation fails: error_type=, error_code=<802>, error_message: [TimesTen]
TT0802: Data store space exhausted

5037: An error occurred while loading netinvoice.a oad failed ([TimesTen]TT0802: Data store space
exhausted
The command failed.

            分析

                                    根据提示是数据存储空间不足

                            解决方法

修改sys.odbc.ini PremSize,这个值的单位是M.

如果不能确定大小,TimesTen提供了一个命令可以预估表的装载后的大小如下例子:

[timesten@OS2 ~]$ ttSize -tbl netinvoice.pms -rows 5000000 TT_1122;

Rows = 5000000

Total in-line row bytes = 5501496296

Out-of-line columns:

  Column PAYEE                           total 270000000    avg size     54

  Column PAYER                           total 200000000    avg size     40

  Column REMARKS                         total        0    avg size      0

  Total out-of-line column bytes = 475000000

Indexes:

  Range index NETINVOICE.PMS_INVOICE_MAIN adds 101591274 bytes

  Total index bytes = 101591274

Total = 6078087570

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

上一篇: CentOS yum报错404
下一篇: EXP-00091
请登录后发表评论 登录
全部评论

注册时间:2011-10-27

最新文章