当前位置: 首页 > 编程日记 > 正文

一.Timesten安装

一,安装timesten IMDB并测试

1. 创建数据库相关用户和组

  1. groupadd timesten
  2. useradd -g timesten -G dba timesten
  3. passwd timesten

2. 创建相关目录

  1. mkdir /etc/TimesTen
  2. chmod 775 /etc/TimesTen
  3. chown timesten:timesten /etc/TimesTen
  4. mkdir /u01/app/timesTen
  5. chmod 775 /u01/app/timesTen
  6. chown timesten:timesten /u01/TimesTen

3. 切换到timesten用户,设置环境变量

  1. [root@oracle ~]# su - timesten
  2. [timesten@oracle ~]$ vi .bash_profile 
  3. export ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1
  4. export TIMESTEN=/opt/timesten/TimesTen/tt1122
  5. # .bash_profile
  6. # Get the aliases and functions
  7. if [ -~/.bashrc ]; then
  8.         . ~/.bashrc
  9. fi
  10. # User specific environment and startup programs
  11. PATH=$PATH:$HOME/bin
  12. export PATH
  13. PATH=$PATH:$HOME/bin
  14. export ORACLE_BASE=/u01/app/oracle11g
  15. export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
  16. export ORACLE_SID=db11
  17. export TIMESTEN=/u01/app/timesten/TimesTen/tt1122
  18. export LD_LIBRARY_PATH=$TIMESTEN/lib:$ORACLE_HOME/lib
  19. export PATH=$TIMESTEN/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin
  20. export TNS_ADMIN=$ORACLE_HOME/network/admin
  21. unset USERNAME
  22. export PATH

4. 上传软件,并修改软件的用户和属组,切换到timesten用户

  1. [root@oracle timesten]# su - timesten
  2. [timesten@oracle ~]$ gzip -d timesten112280.linux8664.gz 
  3. [timesten@oracle ~]$ ls -l
  4. total 344792
  5. -rw-r--r-- 1 timesten timesten 353064960 May 28 2015 timesten112280.linux8664
  6. [timesten@oracle ~]$ ls -l
  7. total 344792
  8. -rw-r--r-- 1 timesten timesten 353064960 May 28  2015 timesten112280.linux8664
  9. [timesten@oracle ~]$ tar -xvf timesten112280.linux8664
  10. linux8664/
  11. linux8664/uninst.sh
  12. linux8664/install.pl
  13. linux8664/README.html
  14. linux8664/LINUX8664/
  15. linux8664/LINUX8664/ttpatchinst
  16. linux8664/LINUX8664/unzip
  17. linux8664/LINUX8664/common.tar.bz2
  18. linux8664/LINUX8664/ttclient.tar.bz2
  19. linux8664/LINUX8664/perl
  20. linux8664/LINUX8664/manifest
  21. linux8664/LINUX8664/timesten.tar.bz2
  22. linux8664/LINUX8664/bzip2
  23. linux8664/LINUX8664/ttserver.tar.bz2
  24. linux8664/3rdparty/
  25. linux8664/3rdparty/ant-1.6.2-bin.tar.bz2
  26. linux8664/3rdparty/jms-1_1-fr-apidocs.tar.bz2
  27. linux8664/doc/
  28. linux8664/doc/doc.zip
  29. linux8664/setup.sh
  30. [timesten@oracle ~]$ ll
  31. total 344796
  32. drwxrwxr-x 5 timesten timesten 4096 Jan 20 18:12 linux8664
  33. -rw-r--r-- 1 timesten timesten 353064960 May 28 2015 timesten112280.linux8664

5. 开始安装软件

  1. [timesten@oracle ~]$ cd linux8664/
  2. [timesten@oracle linux8664]$ ll
  3. total 420
  4. drwxr-xr-x 2 timesten timesten 4096 Jan 20 18:12 3rdparty
  5. drwxrwxr-x 2 timesten timesten 4096 Jan 20 18:12 doc
  6. -rwxr-xr-x 1 timesten timesten 256471 Jan 20 18:10 install.pl
  7. drwxr-xr-x 2 timesten timesten 4096 Jan 20 18:12 LINUX8664
  8. -rwxr--r-- 1 timesten timesten 114161 Jan 20 18:10 README.html
  9. -rwxr-xr-x 1 timesten timesten 5759 Jan 20 18:10 setup.sh
  10. -rwxr-xr-x 1 timesten timesten 34886 Jan 20 18:10 uninst.sh
  11. [timesten@oracle linux8664]$ ./setup.sh
  12. NOTE: Each TimesTen installation is identified by a unique instance name.
  13. The instance name must be a non-null alphanumeric string, not longer
  14. than 255 characters.
  15. Please choose an instance name for this installation? [ tt1122 ]
  16. Instance name will be 'tt1122'.
  17. Is this correct? [ yes ]
  18. Of the three components:
  19. [1] Client/Server and Data Manager
  20. [2] Data Manager Only
  21. [3] Client Only
  22. Which would you like to install? [ 1 ]
  23. Of the following options :
  24. [1] /home/timesten
  25. [2] /home/timesten
  26. [3] Specify a location
  27. [q] Quit the installation
  28. Where would you like to install the tt1122 instance of TimesTen? [ 1 ] 3
  29. Please specify a directory to install TimesTen? [ /home/timesten ] /u01/app/timesten
  30. The directory /u01/app/timesten does not exist.
  31. Do you want to create it? [ yes ]
  32. Where would you like to create the daemon home directory? [ /u01/app/timesten/TimesTen/tt1122/info ]
  33. The daemon logs will be located in /u01/app/timesten/TimesTen/tt1122/info
  34. Would you like to specify a different location for the daemon logs? [ no ]
  35. Installing into /u01/app/timesten/TimesTen/tt1122 ...
  36. Uncompressing ...
  37. NOTE: If you are configuring TimesTen for use with Oracle Clusterware, the
  38. daemon port number must be the same across all TimesTen installations
  39. managed within the same Oracle Clusterware cluster.
  40. NOTE: All installations that replicate to each other must use the same daemon
  41. port number that is set at installation time. The daemon port number can
  42. be verified by running 'ttVersion'.
  43. The default port number is 53396.
  44. Do you want to use the default port number for the TimesTen daemon? [ yes ]
  45. The daemon will run on the default port number (53396).
  46. NOTE: For security, we recommend that you restrict access to the
  47. TimesTen installation to members of a single OS group. Only members of
  48. that OS group will be allowed to perform direct mode connections to
  49. TimesTen, and only members of that OS group will be allowed to perform
  50. operations that access TimesTen data stores, TimesTen files and shared
  51. memory. The OS group defaults to the primary group of the instance
  52. administrator. You can default to this group, choose another OS group
  53. or you can make this instance world-accessible. If you choose to make
  54. this instance world-accessible, all database files and shared memory
  55. are readable and writable by all users.
  56. Restrict access to the the TimesTen installation to the group 'timesten'? [ yes ]
  57. NOTE: Enabling PL/SQL will increase the size of some TimesTen libraries.
  58. Would you like to enable PL/SQL for this instance? [ yes ]
  59. TNS_ADMIN exists in your environment and is set to :
  60. /u01/app/oracle11g/product/11.2.0/dbhome_1/network/admin
  61. Would you like to use this TNS_ADMIN setting for the Oracle TimesTen Application-Tier Database Cache? [ yes ]
  62. TNS_ADMIN will be set to /u01/app/oracle11g/product/11.2.0/dbhome_1/network/admin
  63. You can change TNS_ADMIN later by running <install_dir>/bin/ttmodinstall.
  64. NOTE: It appears that you are running version 4 or higher of the g++
  65. compiler. TimesTen ships with multiple sets of client libraries and server
  66. binaries : one built for compatibility with g++ 3.4.6 and one with
  67. g++ 4.1.0. The installer has created links to the 4.1.0 library in the
  68. <install_dir>/lib directory and to the 4.1.0 server binary in the
  69. <install_dir>/bin directory. If you want to use a different compiler,
  70. please modify the links to point to the desired library and server binary.
  71. Installing server components ...
  72. What is the TCP/IP port number that you want the TimesTen Server to listen on? [ 53397 ]
  73. Do you want to install the Quick Start Sample Programs and the TimesTen Documentation? [ no ]
  74. Would you like to install the documentation (without the Quick Start Sample Programs)? [ yes ]
  75. Where would you like to create the doc directory? [ /u01/app/timesten/TimesTen/tt1122/doc ]
  76. The TimesTen documentation has been installed in /u01/app/timesten/TimesTen/tt1122/doc.
  77. Installing client components ...
  78. Would you like to use TimesTen Replication with Oracle Clusterware? [ no ]
  79. NOTE: The TimesTen daemon startup/shutdown scripts have not been installed.
  80. Run the 'setuproot' script :
  81. cd /u01/app/timesten/TimesTen/tt1122/bin
  82. ./setuproot -install
  83. This will move the TimesTen startup script into its appropriate location.
  84. The startup script is currently located here :
  85. '/u01/app/timesten/TimesTen/tt1122/startup/tt_tt1122'.
  86. The 11.2.2.8 Release Notes are located here :
  87. '/u01/app/timesten/TimesTen/tt1122/README.html'
  88. Starting the daemon ...
  89. TimesTen Daemon startup OK.
  90. End of TimesTen installation.
  91. [timesten@oracle linux8664]$

6. 启动服务

  1. [root@oracle ~]# cd /u01/app/timesten/TimesTen/tt1122/bin/
  2. [root@oracle bin]# ./setuproot -install
  3. $* is no longer supported at ./setuproot line 260.
  4. Would you like to install the TimesTen daemon startup scripts into /etc/init.d? [ yes ]
  5. Copying /u01/app/timesten/TimesTen/tt1122/startup/tt_tt1122 to /etc/init.d
  6. Successfully installed the following scripts :
  7. /etc/init.d/tt_tt1122
  8. /etc/rc.d/rc0.d/K45tt_tt1122
  9. /etc/rc.d/rc1.d/K45tt_tt1122
  10. /etc/rc.d/rc2.d/S90tt_tt1122
  11. /etc/rc.d/rc3.d/S90tt_tt1122
  12. /etc/rc.d/rc5.d/S90tt_tt1122
  13. /etc/rc.d/rc6.d/K45tt_tt1122

查看进程

  1. [root@oracle bin]# ps -ef | grep times
  2. root 31501 31129 0 Feb24 pts/3 00:00:00 su - timesten
  3. timesten 31503 31501 0 Feb24 pts/3 00:00:00 -bash
  4. timesten 35813 1 0 Feb24 ? 00:00:00 /u01/app/timesten/TimesTen/tt1122/bin/timestend -initfd 13
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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

修改配置文件

  1. [timesten@oracle info]$ vi sys.odbc.ini
  2. [ODBC Data Sources]
  3. TT_1122=TimesTen 11.2.2 Driver
  4. sampledb_1122=TimesTen 11.2.2 Driver
  5. cachedb1_1122=TimesTen 11.2.2 Driver
  6. repdb1_1122=TimesTen 11.2.2 Driver
  7. repdb2_1122=TimesTen 11.2.2 Driver
  8. sampledbCS_1122=TimesTen 11.2.2 Client Driver
  9. cachedb1CS_1122=TimesTen 11.2.2 Client Driver
  10. repdb1CS_1122=TimesTen 11.2.2 Client Driver
  11. repdb2CS_1122=TimesTen 11.2.2 Client Driver

7. 连接测试

  1. [timesten@oracle info]$ ttIsql TT_1122
  2. Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  3. Type ? or "help" for help, type "exit" to quit ttIsql.
  4. connect "DSN=TT_1122";
  5. 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;
  6. (Default setting AutoCommit=1)
  7. Command>
  8. Command> tables
  9. 0 tables found.
  10. Command> create table tt_test(id number(20));
  11. Command> insert into tt_test values(12345678);
  12. 1 row inserted.
  13. Command> commit;
  14. Command> select * from tt_test;
  15. < 12345678 >
  16. 1 row found.
  17. Command> insert into tt_test values(1989);
  18. 1 row inserted.
  19. Command> select * from tt_test;
  20. < 12345678 >
  21. < 1989 >
  22. 2 rows found.
  23. Command> commit;
  24. Command> tables
  25. TIMESTEN.TT_TEST
  26. 1 table found.
  27. Command> drop table tt_test;
  28. Command> tables
  29. 0 tables found.
  30. Command>

二. 同步用户数据设置

在timesten安装目录的oraclescripts有相关的oracle脚本

  1. [root@oracle tt1122]# cd oraclescripts/
  2. [root@oracle oraclescripts]# ll
  3. total 104
  4. -r--r----- 1 timesten timesten 8815 Jan 20 18:09 cacheCleanUp.sql
  5. -r--r----- 1 timesten timesten 5840 Jan 20 18:09 cacheInfo.sql
  6. -r--r----- 1 timesten timesten 12344 Jan 20 18:09 grantCacheAdminPrivileges.sql
  7. -r--r----- 1 timesten timesten 21528 Jan 20 18:09 initCacheAdminSchema.sql
  8. -r--r----- 1 timesten timesten 9569 Jan 20 18:09 initCacheGlobalSchema.sql
  9. -r--r----- 1 timesten timesten 7217 Jan 20 18:09 initCacheGridSchema.sql
  10. -r--r----- 1 timesten timesten 5744 Jan 20 18:09 README.TXT
  11. drwxr-x--- 3 timesten timesten 4096 Jan 20 18:09 supporting_scripts
  12. -r--r----- 1 timesten timesten 5688 Jan 20 18:09 ttca_setupRepository.sql
  13. -r--r----- 1 timesten timesten 2272 Jan 20 18:09 ttca_setupTarget.sql
  14. [root@oracle oraclescripts]#
  15. [root@oracle oraclescripts]# cp initCacheGlobalSchema.sql /tmp
  16. [root@oracle oraclescripts]# cp grantCacheAdminPrivileges.sql /tmp
  17. [root@oracle oraclescripts]# cd /tmp/
  18. [root@oracle tmp]# chmod 777 initCacheGlobalSchema.sql
  19. [root@oracle tmp]# chmod 777 grantCacheAdminPrivileges.sql
1. 创建timesten用户使用TimesTen自带脚本
  1. [root@oracle tmp]# su - ora11g
  2. db11@oracle /home/ora11g$ 
  3. db11@oracle  /home/ora11g$
  4. db11@oracle /home/ora11g$ cd /tmp/
  5. db11@oracle  /tmp$ sqlplus / as sysdba
  6. SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 25 01:58:16 2015
  7. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  8. Connected to:
  9. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  10. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  11. SQL> @initCacheGlobalSchema
  12. Please enter the tablespace where TIMESTEN user is to be created
  13. users
  14. The value chosen for tablespace is users
  15. ******* Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE starts *******
  16. 1. Creating TIMESTEN schema
  17. 2. Creating TIMESTEN.TT_GRIDID table
  18. 3. Creating TIMESTEN.TT_GRIDINFO table
  19. 4. Creating TT_CACHE_ADMIN_ROLE role
  20. 5. Granting privileges to TT_CACHE_ADMIN_ROLE
  21. ** Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE done successfully **
  22. PL/SQL procedure successfully completed.
  23. SQL>
2. 创建一个管理cache的用户
  1. SQL> create user cacheadmin identified by cacheadmin;
  2. User created.
  3. SQL> @grantCacheAdminPrivileges "cacheadmin"
  4. Please enter the administrator user id
  5. The value chosen for administrator user id is cacheadmin
  6. ***************** Initialization for cache admin begins ******************
  7. 0. Granting the CREATE SESSION privilege to CACHEADMIN
  8. 1. Granting the TT_CACHE_ADMIN_ROLE to CACHEADMIN
  9. 2. Granting the DBMS_LOCK package privilege to CACHEADMIN
  10. 3. Granting the CREATE SEQUENCE privilege to CACHEADMIN
  11. 4. Granting the CREATE CLUSTER privilege to CACHEADMIN
  12. 5. Granting the CREATE OPERATOR privilege to CACHEADMIN
  13. 6. Granting the CREATE INDEXTYPE privilege to CACHEADMIN
  14. 7. Granting the CREATE TABLE privilege to CACHEADMIN
  15. 8. Granting the CREATE PROCEDURE privilege to CACHEADMIN
  16. 9. Granting the CREATE ANY TRIGGER privilege to CACHEADMIN
  17. 10. Granting the GRANT UNLIMITED TABLESPACE privilege to CACHEADMIN
  18. 11. Granting the DBMS_LOB package privilege to CACHEADMIN
  19. 12. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEADMIN
  20. 13. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEADMIN
  21. 14. Checking if the cache administrator user has permissions on the default
  22. tablespace
  23. No existing permission.
  24. 15. Altering the cache administrator to grant unlimited tablespace on USERS
  25. 16. Granting the CREATE TYPE privilege to CACHEADMIN
  26. 17. Granting the SELECT on SYS.GV$LOCK privilege to CACHEADMIN (optional)
  27. 18. Granting the SELECT on SYS.GV$SESSION privilege to CACHEADMIN (optional)
  28. 19. Granting the SELECT on SYS.DBA_DATA_FILES privilege to CACHEADMIN
  29. (optional)
  30. 20. Granting the SELECT on SYS.USER_USERS privilege to CACHEADMIN (optional)
  31. 21. Granting the SELECT on SYS.USER_FREE_SPACE privilege to CACHEADMIN
  32. (optional)
  33. 22. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to CACHEADMIN
  34. (optional)
  35. 23. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to CACHEADMIN
  36. (optional)
  37. ********* Initialization for cache admin user done successfully *********
3. 创建一个业务用户
  1. SQL> create user hxy identified by hxy;
  2. User created.
  3. 进行一样的授权
  4. SQL> @grantCacheAdminPrivileges "hxy"
  5. Please enter the administrator user id
  6. The value chosen for administrator user id is hxy
  7. ***************** Initialization for cache admin begins ******************
  8. 0. Granting the CREATE SESSION privilege to HXY
  9. 1. Granting the TT_CACHE_ADMIN_ROLE to HXY
  10. 2. Granting the DBMS_LOCK package privilege to HXY
  11. 3. Granting the CREATE SEQUENCE privilege to HXY
  12. 4. Granting the CREATE CLUSTER privilege to HXY
  13. 5. Granting the CREATE OPERATOR privilege to HXY
  14. 6. Granting the CREATE INDEXTYPE privilege to HXY
  15. 7. Granting the CREATE TABLE privilege to HXY
  16. 8. Granting the CREATE PROCEDURE privilege to HXY
  17. 9. Granting the CREATE ANY TRIGGER privilege to HXY
  18. 10. Granting the GRANT UNLIMITED TABLESPACE privilege to HXY
  19. 11. Granting the DBMS_LOB package privilege to HXY
  20. 12. Granting the SELECT on SYS.ALL_OBJECTS privilege to HXY
  21. 13. Granting the SELECT on SYS.ALL_SYNONYMS privilege to HXY
  22. 14. Checking if the cache administrator user has permissions on the default
  23. tablespace
  24. No existing permission.
  25. 15. Altering the cache administrator to grant unlimited tablespace on USERS
  26. 16. Granting the CREATE TYPE privilege to HXY
  27. 17. Granting the SELECT on SYS.GV$LOCK privilege to HXY (optional)
  28. 18. Granting the SELECT on SYS.GV$SESSION privilege to HXY (optional)
  29. 19. Granting the SELECT on SYS.DBA_DATA_FILES privilege to HXY (optional)
  30. 20. Granting the SELECT on SYS.USER_USERS privilege to HXY (optional)
  31. 21. Granting the SELECT on SYS.USER_FREE_SPACE privilege to HXY (optional)
  32. 22. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to HXY (optional)
  33. 23. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to HXY (optional)
  34. ********* Initialization for cache admin user done successfully *********
  35. SQL>
4. 设置/u01/app/timesten/TimesTen/tt1122/info/sys.odbc.ini
  1. [TT_1122]
  2. Driver=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so
  3. DataStore=/u01/app/timesten/TimesTen/tt1122/info/TT_1122
  4. DatabaseCharacterSet=ZHS16GBK
  5. OracleNetServiceName=db11
  6. PermSize=2048
  7. TempSize=1024
5. 启动TimesTen
  1. [timesten@oracle info]$ ttdaemonadmin -stop
  2. TimesTen Daemon stopped.
  3. [timesten@oracle info]$ ttdaemonadmin -start
  4. TimesTen Daemon startup OK.
  5. [timesten@oracle info]$ ttisql TT_1122
  6. Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  7. Type ? or "help" for help, type "exit" to quit ttIsql.
  8. connect "DSN=TT_1122";
  9. 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;
  10. (Default setting AutoCommit=1)
  11. Command>
6. 创建TimesTen内存数据库的用户,用户必须和Oracle数据库名称相同
  1. Command> create user cacheadmin identified by cacheadmin;
  2. User created.
  3. Command> grant create session,cache_manager,create any table to cacheadmin;
  4. Command> create user hxy identified by hxy;
  5. User created.
  6. Command> grant create session,create any table to hxy;
7. 从TimesTen链接到Oracle数据库
  1. Command> connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
  2. Command> call ttcacheuidpwdset('cacheadmin','cacheadmin');
8. 创建Grid,TimesTen特性必须把cache group让在grid中
  1. connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
9. 创建cache grid,TimesTen特性必须把cache group让在grid中
  1. con1: Command> call ttGridCreate('myGrid');
  2. con1: Command> call ttGridnameSet('myGrid');
10.在Orace数据库里面建立表和唯一索引,TimesTen必须需要是一个主键和唯一索引
  1. db11@oracle /home/ora11g$ sqlplus / as sysdba
  2. SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 26 01:09:06 2015
  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  7. SQL>
  8. SQL>
  9. SQL> conn hxy/hxy
  10. Connected.
  11. SQL> create table a (id number,name varchar2(20));
  12. Table created.
  13. SQL> create unique index a_idx on a(id);
  14. Index created.

把权限授予cache管理用户

  1. GRANT SELECT ON a TO cacheadmin;
  2. GRANT INSERT ON a TO cacheadmin;
  3. GRANT UPDATE ON a TO cacheadmin;
  4. GRANT DELETE ON a TO cacheadmin;
11. Load数据到TimesTen中
  1. ttisql "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";

1.启动cache

  1. Command>call ttcachestart

2.启动cache之后就可以创建cache group了

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

  1. 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));
  2. con1: Command> cachegroups;
  3. Cache Group CACHEADMIN.CACHE_A:
  4. Cache Group Type: Read Only
  5. Autorefresh: Yes
  6. Autorefresh Mode: Incremental
  7. Autorefresh State: Paused
  8. Autorefresh Interval: 5 Seconds
  9. Autorefresh Status: ok
  10. Aging: No aging defined
  11. Root Table: HXY.A
  12. Table Type: Read Only
  13. 1 cache group found.
  14. 3. load cache group cache_a commit every 10 rows;
12.退出ttisql,重新进入,把对a表的查询权限在timesten数据库中授予cacheadmin
  1. [timesten@oracle ~]$ ttisql TT_1122
  2. Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  3. Type ? or "help" for help, type "exit" to quit ttIsql.
  4. connect "DSN=TT_1122";
  5. 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;
  6. (Default setting AutoCommit=1)
  7. GRANT SELECT ON hxy.a TO cacheadmin;
  8. GRANT INSERT ON hxy.a TO cacheadmin;
  9. GRANT UPDATE ON hxy.a TO cacheadmin;
  10. GRANT DELETE ON hxy.a TO cacheadmin;

连接

  1. Command> connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
  2. 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;
  3. (Default setting AutoCommit=1)
  4. con1: Command> select * from hxy.a;
  5. 0 rows found. ----没有数据

在oracle数据库中插入数据

  1. SQL> show user
  2. USER is "HXY"
  3. SQL>
  4. SQL> insert into a values(1,'hello');
  5. 1 row created.
  6. SQL> insert into a values(2,'hxy');
  7. 1 row created.
  8. SQL> commit;

去IMDB查询

  1. con1: Command> select * from hxy.a;
  2. < 1, hello >
  3. < 2, hxy >
  4. 2 rows found.

可见,在oracle中提交,数据会自动复制到IMDB中

错误:

1.字符集设置成ZHS16GBK报下面的错误:

  1. [timesten@oracle info]$ ttisql TT_1122
  2. Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  3. Type ? or "help" for help, type "exit" to quit ttIsql.
  4. connect "DSN=TT_1122";
  5. 6228: Invalid value (AL32UTF8) for DatabaseCharacterSet connection attribute -- value must be the same as the current data store value (US7ASCII)
  6. The command failed.
  7. Done.
  8. Command> call ttcacheuidpwdset('cacheadmin','cacheadmin');
  9. 8296: TimesTen and Oracle database character sets do not match. TimesTen: US7ASCII, Oracle: ZHS16GBK
  10. 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"
  11. The command failed.
  12. Command> exit
  13. Disconnecting...

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

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

  1. [timesten@oracle info]$ ttDestroy TT_1122
  2. -bash-4.1$ ttisql TT_1122
  3. Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  4. Type ? or "help" for help, type "exit" to quit ttIsql.
  5. connect "DSN=TT_1122";
  6. 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;
  7. (Default setting AutoCommit=1)
  8. Command> exit
  9. Disconnecting...
  10. Done.

2.刚开始使用

connect "dsn=TT_1122;uid=cacheadmin;PWD=cacheadmin;OraclePwd=cacheadmin";
连接的时候一直报下面的错误:

  1. Command> connect "dsn=TT_1122;uid=cacheadm;OraclePWD=cacheadm;OraclePwd=cacheadm";
  2. 7001: User authentication failed
  3. The command failed.

郁闷的不行,最后在内存数据库中又执行了一次

  1. Command> create user cacheadmin identified by cacheadmin;
  2. User created.
  3. Command> grant create session,cache_manager,create any table to cacheadmin;
  4. Command> create user hxy identified by hxy;
  5. User created.
  6. Command> grant create session,create any table to hxy;

然后再次连接成功,奇怪,难道内存中的用户消失了???

3.创建cache group的时候报错

  1. 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));
  2. 5140: Could not find HXY.A in Oracle. May not have privileges.
  3. The command failed.


解决办法:

把对表的查询权限授予cache管理用户cacheadmin

  1. GRANT SELECT ON hxy.a TO cacheadmin;
  2. GRANT INSERT ON hxy.a TO cacheadmin;
  3. GRANT UPDATE ON hxy.a TO cacheadmin;
  4. GRANT DELETE ON hxy.a TO cacheadmin;

参考:

http://blog.itpub.net/16381228/viewspace-764825 ---有错误,已在上文中修正



来自为知笔记(Wiz)


转载于:https://www.cnblogs.com/haoxiaoyu/p/625fc8b1ba9a9385e3d1e38ec050e55f.html

相关文章:

linux 入门-1

刚开始接触linux&#xff0c;总有些简单的问题不知道怎么搞定&#xff0c;先将目前汇总的解决方法叫做"linux入门&#xff0d;1",后续在使用过程中逐步总结。 1. 连接 ADSL &#xff1a; sudo pon dsl-provider 断开 ADSL&#xff1a; sudo poff 查看 ADSL 状态&a…

Java项目:家庭理财系统(java+SSM+JSP+Tomcat8+Mysql)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能&#xff1a;家庭理财&#xff0c;财务分析&#xff0c;统计等等。 二、项目运行 运行环境: jdk8tomcat8mysqlIntelliJ IDEA&#xff08; Eclispe , MyEclispe ,Sts 都支持&#xff0c;代…

ORA-19809: 超出了恢复文件数的限制

实验环境&#xff1a;Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod 实验背景&#xff1a;向tough.t中插入40万条记录&#xff0c;然后rollback&#xff0c;接着执行了shutdown abort命令。当重新启动数据库的时候遇到以下问题。 SQL> alter database …

VC manifest

manifest原理和用途 dll是被动态调用的&#xff0c;所以会被若干个程序共享使用的 但是如果dll在应用程序不知道的情况下升级了、或是被另一个程序更改了&#xff0c;就可能会出现问题&#xff0c;即”DLL Hell” 随着系统资源越来越丰富&#xff0c;硬盘不那么紧张&#xff0…

判断年月日是否正确

//输入年月日 Console.Write("请输入年&#xff1a;"); int year Convert.ToInt32(Console.ReadLine()); Console.Write("请输入月&#xff1a;"); int month Convert.ToInt32(Console.ReadLine()); Console.Write("请输入日&#xff1a;"); i…

Java项目:农业计算工具(java+swing)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 1、换算:吨、千克、斤&#xff0c;晌/公顷、亩、平方米&#xff0c;晌/株、亩/株、平方米/株 2、籽粒干重、果穗干重、出籽率计算 3、发芽种粒数、供试种粒数、发芽率计算 4、种子袋、晌、亩、品种 换算 pac…

web网站加速之CDN(Content Delivery Network)技术原理

2019独角兽企业重金招聘Python工程师标准>>> 在不同地域的用户访问网站的响应速度存在差异,为了提高用户访问的响应速度、优化现有Internet中信息的流动,需要在用户和服务器间加入中间层CDN. 使用户能以最快的速度&#xff0c;从最接近用户的地方获得所需的信息&…

response.getWriter().write()和 response.getWriter().print()的区别

异步上传图片的代码。发现里面用了response.getWriter().print(),故联想到response.getWriter().writer&#xff08;&#xff09;,经过一番api的查找与实操&#xff0c;总结如下&#xff1a; response.getWriter()返回的是PrintWriter&#xff0c;这是一个打印输出流。response…

c语言中volatile关键字的作用

读文章之前 可以先看一下《程序员的自我修养 》第28页 过度优化。 volatile 提醒编译器它后面所定义的变量随时都有可能改变&#xff0c;因此编译后的程序每次需要存储或读取这个变量的时候&#xff0c;都会直接从变量地址中读取数据。如果没有 volatile关键字&#xff0c;则编…

Java项目:抽奖点名神器(HTML+可自定义抽选)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 用于年终抽奖或随机点名神器 //获取页面元素var student_box document.getElementById("student_box");//循环生成HTMLvar html "";for (var i 0 ; i < 22; i ) {html <div st…

Hive Metastore 连接报错

背景 项目中需要通过一些自定义的组件来操控hive的元数据&#xff0c;于是使用了remote方式来存储hive元数据&#xff0c;使用一个服务后台作为gateway&#xff0c;由它来控制hive元数据。 现象 在windows上连接hive metastore的时候&#xff0c;无端的会报NullPointerExceptio…

普通的简单对话框

2019独角兽企业重金招聘Python工程师标准>>> activity_main.xml <LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"xmlns:tools"http://schemas.android.com/tools"android:layout_width"fill_parent"and…

[POI2007]ZAP-Queries

出处&#xff1a;http://www.cnblogs.com/peng-ym/p/8660937.html &#xff08;还是 建议 去看 原文&#xff09; 题目&#xff1a;链接&#xff1a;https://www.luogu.org/problemnew/show/P3455 #include<bits/stdc.h> #define LL long long #define ULL unsigned long…

python pdb 基础调试

当手边没有IDE,面对着python调试犯愁时&#xff0c;你就可以参考下本文&#xff1b;&#xff08;pdb 命令调试&#xff09;参考&#xff1a;http://docs.python.org/library/pdb.html和 (pdb)help首先你选择运行的 pypython -m pdb myscript.py(Pdb) 会自动停在第一行&#xff…

Java项目:设计管理系统(java+SSM+JSP+MYSQL+layui+Maven)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能包括&#xff1a; 课题管理&#xff0c;学生管理&#xff0c;内容管理&#xff0c;文件管理&#xff0c;提问管理&#xff0c;教师管理&#xff0c;进度管理等等。 二、项目运行 环境配置…

linux(以ubuntu为例)下Android利用ant自动编译、修改配置文件、批量多渠道,打包生成apk文件...

原创&#xff0c;转载请注明&#xff1a;http://www.cnblogs.com/ycxyyzw/p/4555328.html 之前写过一篇《windows下Android利用ant自动编译、修改配置文件、批量多渠道&#xff0c;打包生成apk文件》&#xff0c;关于ant打包原理&#xff0c;请先阅读此篇文章&#xff0c;再阅…

自制的一个eclipse 插件jcodesmith(代码生成器)

为什么80%的码农都做不了架构师&#xff1f;>>> 实现思路 使用模板输出&#xff0c;定制一些特定的输入【如数据库元素、普通文件】等控制模板生成&#xff1b;并把指定输入可视化&#xff0c;方便使用&#xff1b; 下载安装 插件下载&#xff1a;http://git.os…

Boring counting HDU - 3518 (后缀数组)

Boring counting \[ Time Limit: 1000 ms \quad Memory Limit: 32768 kB \] 题意 给出一个字符串&#xff0c;求出其中出现两次及以上的子串个数&#xff0c;要求子串之间不可以重合。 思路 对字符串后缀数组&#xff0c;然后枚举子串长度 \(len\)&#xff0c;若某一段连续的 \…

什么是JTAG

JTAG(Joint Test Action Group)联合测试行动小组)是一种国际标准测试协议&#xff08;IEEE 1149.1兼容&#xff09;&#xff0c;主要用于芯片内部测试。现在多数的高级器件都支持JTAG协议&#xff0c;如DSP、FPGA器件等。标准的JTAG接口是4线&#xff1a;TMS、 TCK、TDI、TDO&a…

Java项目:个人博客系统(java+SSM+Mysql+Servlet+JavaWeb)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 项目内容包括&#xff1a;首页&#xff0c;登陆&#xff0c;新建文章&#xff0c;搜索&#xff0c;登陆日志&#xff0c;登录次数&#xff0c;评论统计&#xff0c;相关信息&#xff0c;文章列…

Lucene4 入门(2)–Field类及辅助类说明

2019独角兽企业重金招聘Python工程师标准>>> Lucene4 入门(2)–Field类及辅助类说明 一、Eclipse中Field类的继承关系图&#xff1a; 二、Field类 1、 类的说明 在一般情况下为Document对象创建一个Field对象会使用它的子类&#xff0c;比如&#xff1a; IntField,…

C#入门详解(4)

什么是类型 类型又名数据类型。表示数据在内存中存储时的型号。小内存容纳大尺寸数据会丢失精度&#xff0c;发生错误。 大内存容纳小尺寸的数据会导致内存浪费。 编程语言的数据类型与数据的数据类型不完全相同。 类型在C#语言中的作用 类型所包含的信息有&#xff1a; 存储此…

使用 Trace32 对 FLASH 编程

from: http://www.ibm.com/developerworks/cn/linux/l-trace32/随着软硬件复杂性的增加&#xff0c;在嵌入式系统开发中&#xff0c;调试器对项目的开发进度、质量起着越来越重要的作用。在众多的调试器中&#xff0c;Lauterbach 公司的 Trace32 凭借其强大的功能&#xff0c…

Farseer.net轻量级ORM开源框架 V1.x 入门篇:新版本说明

导航目 录&#xff1a;Farseer.net轻量级ORM开源框架 目录 上一篇&#xff1a;没有了 下一篇&#xff1a;Farseer.net轻量级ORM开源框架 V1.x 入门篇&#xff1a;数据库配置 前言V1.x版本终于到来了。本次版本的开发从3月份开始&#xff0c;花了一个月的时间完成了概念版本设…

Java项目:健身管理系统(Java+ssm+springboot)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 主要技术&#xff1a;springmvc、 springboot 、mybatis、mysql 、jQuery、layui、css、jsp shiro权限控制 主要功能截图如下&#xff1a; 用户登录、首页主要功能有&#xff1a;会员信息管理、会员到期续费…

计算几何算法概览

为什么80%的码农都做不了架构师&#xff1f;>>> 计算几何算法概览一、引言 计算机的出现使得很多原本十分繁琐的工作得以大幅度简化&#xff0c;但是也有一些在人们直观看来很容易的问题却需要拿出一套并不简单的通用解决方案&#xff0c;比如几何问题。作为计算…

诚意租房网blog2

&#xff08;一&#xff09;数据库设计部分&#xff1a; 创建数据库hourse: 1&#xff1a;关注表 CREATE TABLE guanzhu ( id int(11) NOT NULL AUTO_INCREMENT, uid int(11) DEFAULT NULL, hid int(11) DEFAULT NULL, time datetime DEFAULT NULL, PRIMARY KEY (id) ) ENGINEI…

基于S3C4510B的一个简单BSP的开发报告

系统环境 &#xff08;一&#xff09; 硬件环境 CPU&#xff1a;S3C4510B SDRAM:W981216DH 16M FLASH:MX29LV160AB 2M &#xff08;二&#xff09; 软件环境 tornado2.01 for arm&#xff08;AKA的FTP上有tornado2.2需要的可以自己去下载&#xff1a;&#…

Java项目:房屋租赁管理系统(java+SSM+Layui+Maven+Mysql+Jsp)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 功能包括&#xff1a; 房屋租赁管理系统是一款方便快捷&#xff0c;易操作的租房和各种物业收费的管理系统&#xff0c;该系统官网包含着用户和管理员分类登录&#xff0c;减少了为使用管理员…

sdtz技术组成

发送短信数据库表到第二天就删除前一天的的内容重新建表是用触发器功能实现的 回款、发标、发短信一些核心功能是用windows服务运行在服务器上自动运行的 sql管理中的维护计划就能设置自动备份数据库转载于:https://www.cnblogs.com/zheng510ke/p/4562812.html