一,安装timesten IMDB并测试
1. 创建数据库相关用户和组
groupadd timesten
useradd -g timesten -G dba timesten
passwd timesten
2. 创建相关目录
mkdir /etc/TimesTen
chmod 775 /etc/TimesTen
chown timesten:timesten /etc/TimesTen
mkdir /u01/app/timesTen
chmod 775 /u01/app/timesTen
chown timesten:timesten /u01/TimesTen
3. 切换到timesten用户,设置环境变量
[[email protected] ~]# su - timesten
[[email protected] ~]$ vi .bash_profile
export ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1
export TIMESTEN=/opt/timesten/TimesTen/tt1122
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
PATH=$PATH:$HOME/bin
export ORACLE_BASE=/u01/app/oracle11g
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=db11
export TIMESTEN=/u01/app/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=$ORACLE_HOME/network/admin
unset USERNAME
export PATH
4. 上传软件,并修改软件的用户和属组,切换到timesten用户
[[email protected] timesten]# su - timesten
[[email protected] ~]$ gzip -d timesten112280.linux8664.gz
[[email protected] ~]$ ls -l
total 344792
-rw-r--r-- 1 timesten timesten 353064960 May 28 2015 timesten112280.linux8664
[[email protected] ~]$ ls -l
total 344792
-rw-r--r-- 1 timesten timesten 353064960 May 28 2015 timesten112280.linux8664
[[email protected] ~]$ tar -xvf timesten112280.linux8664
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
[[email protected] ~]$ ll
total 344796
drwxrwxr-x 5 timesten timesten 4096 Jan 20 18:12 linux8664
-rw-r--r-- 1 timesten timesten 353064960 May 28 2015 timesten112280.linux8664
```
####5. 开始安装软件
```
[[email protected] ~]$ cd linux8664/
[[email protected] linux8664]$ ll
total 420
drwxr-xr-x 2 timesten timesten 4096 Jan 20 18:12 3rdparty
drwxrwxr-x 2 timesten timesten 4096 Jan 20 18:12 doc
-rwxr-xr-x 1 timesten timesten 256471 Jan 20 18:10 install.pl
drwxr-xr-x 2 timesten timesten 4096 Jan 20 18:12 LINUX8664
-rwxr--r-- 1 timesten timesten 114161 Jan 20 18:10 README.html
-rwxr-xr-x 1 timesten timesten 5759 Jan 20 18:10 setup.sh
-rwxr-xr-x 1 timesten timesten 34886 Jan 20 18:10 uninst.sh
[[email protected] 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? [ 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/timesten
[2] /home/timesten
[3] Specify a location
[q] Quit the installation
Where would you like to install the tt1122 instance of TimesTen? [ 1 ] 3
Please specify a directory to install TimesTen? [ /home/timesten ] /u01/app/timesten
The directory /u01/app/timesten does not exist.
Do you want to create it? [ yes ]
Where would you like to create the daemon home directory? [ /u01/app/timesten/TimesTen/tt1122/info ]
The daemon logs will be located in /u01/app/timesten/TimesTen/tt1122/info
Would you like to specify a different location for the daemon logs? [ no ]
Installing into /u01/app/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 :
/u01/app/oracle11g/product/11.2.0/dbhome_1/network/admin
Would you like to use this TNS_ADMIN setting for the Oracle TimesTen Application-Tier Database Cache? [ yes ]
TNS_ADMIN will be set to /u01/app/oracle11g/product/11.2.0/dbhome_1/network/admin
You can change TNS_ADMIN later by running <install_dir>/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
<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? [ 53397 ]
Do you want to install the Quick Start Sample Programs and the TimesTen Documentation? [ no ]
Would you like to install the documentation (without the Quick Start Sample Programs)? [ yes ]
Where would you like to create the doc directory? [ /u01/app/timesten/TimesTen/tt1122/doc ]
The TimesTen documentation has been installed in /u01/app/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 /u01/app/timesten/TimesTen/tt1122/bin
./setuproot -install
This will move the TimesTen startup script into its appropriate location.
The startup script is currently located here :
‘/u01/app/timesten/TimesTen/tt1122/startup/tt_tt1122‘.
The 11.2.2.8 Release Notes are located here :
‘/u01/app/timesten/TimesTen/tt1122/README.html‘
Starting the daemon ...
TimesTen Daemon startup OK.
End of TimesTen installation.
[[email protected] linux8664]$
6. 启动服务
[[email protected] ~]# cd /u01/app/timesten/TimesTen/tt1122/bin/
[[email protected] bin]# ./setuproot -install
$* is no longer supported at ./setuproot line 260.
Would you like to install the TimesTen daemon startup scripts into /etc/init.d? [ yes ]
Copying /u01/app/timesten/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
查看进程
[[email protected] bin]# ps -ef | grep times
root 31501 31129 0 Feb24 pts/3 00:00:00 su - timesten
timesten 31503 31501 0 Feb24 pts/3 00:00:00 -bash
timesten 35813 1 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/timestend -initfd 13
timesten 35817 35813 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000000 -facility user
timesten 35819 35813 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000002 -facility user
timesten 35820 35813 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000003 -facility user
timesten 35822 35813 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/ttcserver -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000004 -p 53397 -facility user -group timesten
timesten 35834 35813 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/timestensubd -verbose -userlog tterrors.log -supportlog ttmesg.log -id 1000005 -facility user
修改配置文件
[[email protected] info]$ vi sys.odbc.ini
[ODBC Data Sources]
TT_1122=TimesTen 11.2.2 Driver
sampledb_1122=TimesTen 11.2.2 Driver
cachedb1_1122=TimesTen 11.2.2 Driver
repdb1_1122=TimesTen 11.2.2 Driver
repdb2_1122=TimesTen 11.2.2 Driver
sampledbCS_1122=TimesTen 11.2.2 Client Driver
cachedb1CS_1122=TimesTen 11.2.2 Client Driver
repdb1CS_1122=TimesTen 11.2.2 Client Driver
repdb2CS_1122=TimesTen 11.2.2 Client Driver
```
####7. 连接测试
```
[[email protected] info]$ ttIsql TT_1122
Copyright (c) 1996, 2015, 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=/u01/app/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so;TypeMode=0;
(Default setting AutoCommit=1)
Command>
Command> tables
0 tables found.
Command> create table tt_test(id number(20));
Command> insert into tt_test values(12345678);
1 row inserted.
Command> commit;
Command> select * from tt_test;
< 12345678 >
1 row found.
Command> insert into tt_test values(1989);
1 row inserted.
Command> select * from tt_test;
< 12345678 >
< 1989 >
2 rows found.
Command> commit;
Command> tables
TIMESTEN.TT_TEST
1 table found.
Command> drop table tt_test;
Command> tables
0 tables found.
Command>
二. 同步用户数据设置
在timesten安装目录的oraclescripts有相关的oracle脚本
[[email protected] tt1122]# cd oraclescripts/
[[email protected] oraclescripts]# ll
total 104
-r--r----- 1 timesten timesten 8815 Jan 20 18:09 cacheCleanUp.sql
-r--r----- 1 timesten timesten 5840 Jan 20 18:09 cacheInfo.sql
-r--r----- 1 timesten timesten 12344 Jan 20 18:09 grantCacheAdminPrivileges.sql
-r--r----- 1 timesten timesten 21528 Jan 20 18:09 initCacheAdminSchema.sql
-r--r----- 1 timesten timesten 9569 Jan 20 18:09 initCacheGlobalSchema.sql
-r--r----- 1 timesten timesten 7217 Jan 20 18:09 initCacheGridSchema.sql
-r--r----- 1 timesten timesten 5744 Jan 20 18:09 README.TXT
drwxr-x--- 3 timesten timesten 4096 Jan 20 18:09 supporting_scripts
-r--r----- 1 timesten timesten 5688 Jan 20 18:09 ttca_setupRepository.sql
-r--r----- 1 timesten timesten 2272 Jan 20 18:09 ttca_setupTarget.sql
[[email protected] oraclescripts]#
[[email protected] oraclescripts]# cp initCacheGlobalSchema.sql /tmp
[[email protected] oraclescripts]# cp grantCacheAdminPrivileges.sql /tmp
[[email protected] oraclescripts]# cd /tmp/
[[email protected] tmp]# chmod 777 initCacheGlobalSchema.sql
[[email protected] tmp]# chmod 777 grantCacheAdminPrivileges.sql
1. 创建timesten用户使用TimesTen自带脚本
[[email protected] tmp]# su - ora11g
[email protected] /home/ora11g$
[email protected] /home/ora11g$
[email protected] /home/ora11g$ cd /tmp/
[email protected] /tmp$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 25 01:58:16 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @initCacheGlobalSchema
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.
SQL>
2. 创建一个管理cache的用户
SQL> create user cacheadmin identified by cacheadmin;
User created.
SQL> @grantCacheAdminPrivileges "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 CREATE SEQUENCE privilege to CACHEADMIN
4. Granting the CREATE CLUSTER privilege to CACHEADMIN
5. Granting the CREATE OPERATOR privilege to CACHEADMIN
6. Granting the CREATE INDEXTYPE privilege to CACHEADMIN
7. Granting the CREATE TABLE privilege to CACHEADMIN
8. Granting the CREATE PROCEDURE privilege to CACHEADMIN
9. Granting the CREATE ANY TRIGGER privilege to CACHEADMIN
10. Granting the GRANT UNLIMITED TABLESPACE privilege to CACHEADMIN
11. Granting the DBMS_LOB package privilege to CACHEADMIN
12. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEADMIN
13. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEADMIN
14. Checking if the cache administrator user has permissions on the default
tablespace
No existing permission.
15. Altering the cache administrator to grant unlimited tablespace on USERS
16. Granting the CREATE TYPE privilege to CACHEADMIN
17. Granting the SELECT on SYS.GV$LOCK privilege to CACHEADMIN (optional)
18. Granting the SELECT on SYS.GV$SESSION privilege to CACHEADMIN (optional)
19. Granting the SELECT on SYS.DBA_DATA_FILES privilege to CACHEADMIN
(optional)
20. Granting the SELECT on SYS.USER_USERS privilege to CACHEADMIN (optional)
21. Granting the SELECT on SYS.USER_FREE_SPACE privilege to CACHEADMIN
(optional)
22. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to CACHEADMIN
(optional)
23. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to CACHEADMIN
(optional)
********* Initialization for cache admin user done successfully *********
3. 创建一个业务用户
SQL> create user hxy identified by hxy;
User created.
进行一样的授权
SQL> @grantCacheAdminPrivileges "hxy"
Please enter the administrator user id
The value chosen for administrator user id is hxy
***************** Initialization for cache admin begins ******************
0. Granting the CREATE SESSION privilege to HXY
1. Granting the TT_CACHE_ADMIN_ROLE to HXY
2. Granting the DBMS_LOCK package privilege to HXY
3. Granting the CREATE SEQUENCE privilege to HXY
4. Granting the CREATE CLUSTER privilege to HXY
5. Granting the CREATE OPERATOR privilege to HXY
6. Granting the CREATE INDEXTYPE privilege to HXY
7. Granting the CREATE TABLE privilege to HXY
8. Granting the CREATE PROCEDURE privilege to HXY
9. Granting the CREATE ANY TRIGGER privilege to HXY
10. Granting the GRANT UNLIMITED TABLESPACE privilege to HXY
11. Granting the DBMS_LOB package privilege to HXY
12. Granting the SELECT on SYS.ALL_OBJECTS privilege to HXY
13. Granting the SELECT on SYS.ALL_SYNONYMS privilege to HXY
14. Checking if the cache administrator user has permissions on the default
tablespace
No existing permission.
15. Altering the cache administrator to grant unlimited tablespace on USERS
16. Granting the CREATE TYPE privilege to HXY
17. Granting the SELECT on SYS.GV$LOCK privilege to HXY (optional)
18. Granting the SELECT on SYS.GV$SESSION privilege to HXY (optional)
19. Granting the SELECT on SYS.DBA_DATA_FILES privilege to HXY (optional)
20. Granting the SELECT on SYS.USER_USERS privilege to HXY (optional)
21. Granting the SELECT on SYS.USER_FREE_SPACE privilege to HXY (optional)
22. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to HXY (optional)
23. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to HXY (optional)
********* Initialization for cache admin user done successfully *********
SQL>
4. 设置/u01/app/timesten/TimesTen/tt1122/info/sys.odbc.ini
[TT_1122]
Driver=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so
DataStore=/u01/app/timesten/TimesTen/tt1122/info/TT_1122
DatabaseCharacterSet=ZHS16GBK
OracleNetServiceName=db11
PermSize=2048
TempSize=1024
5. 启动TimesTen
[[email protected] info]$ ttdaemonadmin -stop
TimesTen Daemon stopped.
[[email protected] info]$ ttdaemonadmin -start
TimesTen Daemon startup OK.
[[email protected] info]$ ttisql TT_1122
Copyright (c) 1996, 2015, 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=/u01/app/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=1024;TypeMode=0;OracleNetServiceName=db11;
(Default setting AutoCommit=1)
Command>
6. 创建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 hxy identified by hxy;
User created.
Command> grant create session,create any table to hxy;
7. 从TimesTen链接到Oracle数据库
Command> connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
Command> call ttcacheuidpwdset(‘cacheadmin‘,‘cacheadmin‘);
8. 创建Grid,TimesTen特性必须把cache group让在grid中
connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
9. 创建cache grid,TimesTen特性必须把cache group让在grid中
con1: Command> call ttGridCreate(‘myGrid‘);
con1: Command> call ttGridnameSet(‘myGrid‘);
10.在Orace数据库里面建立表和唯一索引,TimesTen必须需要是一个主键和唯一索引
[email protected] /home/ora11g$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 26 01:09:06 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL>
SQL> conn hxy/hxy
Connected.
SQL> create table a (id number,name varchar2(20));
Table created.
SQL> create unique index a_idx on a(id);
Index created.
把权限授予cache管理用户
GRANT SELECT ON a TO cacheadmin;
GRANT INSERT ON a TO cacheadmin;
GRANT UPDATE ON a TO cacheadmin;
GRANT DELETE ON a TO cacheadmin;
11. Load数据到TimesTen中
ttisql "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
1.启动cache
Command>call ttcachestart
2.启动cache之后就可以创建cache group了
创建group时,需要将表的名字和结构设置成与oracle数据库中test用户下的需要加载的表的名字和结构一模一样,这样才能匹配找到相应的表,否则无法加载数据。(这里创建的readonly类型的group)
con1: Command> create readonly cache group cache_a Autorefresh interval 5 seconds mode incremental From hxy.a(id number not null primary key , name varchar2(20));
con1: Command> cachegroups;
Cache Group CACHEADMIN.CACHE_A:
Cache Group Type: Read Only
Autorefresh: Yes
Autorefresh Mode: Incremental
Autorefresh State: Paused
Autorefresh Interval: 5 Seconds
Autorefresh Status: ok
Aging: No aging defined
Root Table: HXY.A
Table Type: Read Only
1 cache group found.
3. load cache group cache_a commit every 10 rows;
12.退出ttisql,重新进入,把对a表的查询权限在timesten数据库中授予cacheadmin
[[email protected] ~]$ ttisql TT_1122
Copyright (c) 1996, 2015, 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=/u01/app/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=1024;TypeMode=0;OracleNetServiceName=db11;
(Default setting AutoCommit=1)
GRANT SELECT ON hxy.a TO cacheadmin;
GRANT INSERT ON hxy.a TO cacheadmin;
GRANT UPDATE ON hxy.a TO cacheadmin;
GRANT DELETE ON hxy.a TO cacheadmin;
连接
Command> connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
Connection successful: DSN=TT_1122;UID=cacheadmin;DataStore=/u01/app/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=2048;TempSize=1024;TypeMode=0;OracleNetServiceName=db11;
(Default setting AutoCommit=1)
con1: Command> select * from hxy.a;
0 rows found. ----没有数据
在oracle数据库中插入数据
SQL> show user
USER is "HXY"
SQL>
SQL> insert into a values(1,‘hello‘);
1 row created.
SQL> insert into a values(2,‘hxy‘);
1 row created.
SQL> commit;
去IMDB查询
con1: Command> select * from hxy.a;
< 1, hello >
< 2, hxy >
2 rows found.
可见,在oracle中提交,数据会自动复制到IMDB中
错误:
1.字符集设置成ZHS16GBK报下面的错误:
[[email protected] info]$ ttisql TT_1122
Copyright (c) 1996, 2015, 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.
Command> call ttcacheuidpwdset(‘cacheadmin‘,‘cacheadmin‘);
8296: TimesTen and Oracle database character sets do not match. TimesTen: US7ASCII, Oracle: ZHS16GBK
5935: Could not validate Oracle login: uid = CACHEADMIN, pwd = HIDDEN, OracleNetServiceName = db11, TNS_ADMIN = "/u01/app/oracle11g/product/11.2.0/dbhome_1/network/admin", ORACLE_HOME= "/u01/app/oracle11g/product/11.2.0/dbhome_1"
The command failed.
Command> exit
Disconnecting...
分析
这个问题是因为已经初始化一次TT_1122后又修改了sys.odbc.ini中DatabaseCharacterSet=AL32UTF8参数。
解决方法:
删掉TT_1122重新初始化并且重新建立用户
[[email protected] info]$ ttDestroy TT_1122
-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.
2.刚开始使用
connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
连接的时候一直报下面的错误:
Command> connect "dsn=TT_1122;uid=cacheadm;OraclePWD=cacheadm;OraclePwd=cacheadm";
7001: User authentication failed
The command failed.
郁闷的不行,最后在内存数据库中又执行了一次
Command> create user cacheadmin identified by cacheadmin;
User created.
Command> grant create session,cache_manager,create any table to cacheadmin;
Command> create user hxy identified by hxy;
User created.
Command> grant create session,create any table to hxy;
然后再次连接成功,奇怪,难道内存中的用户消失了???
3.创建cache group的时候报错
con1: Command> create readonly cache group cache_a Autorefresh interval 5 seconds mode incremental From hxy.a(id number not null primary key , name varchar2(20));
5140: Could not find HXY.A in Oracle. May not have privileges.
The command failed.
解决办法:
把对表的查询权限授予cache管理用户cacheadmin
GRANT SELECT ON hxy.a TO cacheadmin;
GRANT INSERT ON hxy.a TO cacheadmin;
GRANT UPDATE ON hxy.a TO cacheadmin;
GRANT DELETE ON hxy.a TO cacheadmin;
参考:
http://blog.itpub.net/16381228/viewspace-764825 ---有错误,已在上文中修正
时间: 2024-10-17 02:59:24