1、安装前环境准备
[oracle@fyl ~]$ vi .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
export EDITOR=vi
export ORACLE_SID=fyl
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
--以下为TT需要的变量
export TT_HOME=/u02/TimesTen/tt_fyl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib:/u02/TimesTen/tt_fyl/lib:$LD_LIBRARY_PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:
$ORACLE_HOME/rdbms/jlib:/u02/TimesTen/tt_fyl/lib/ttjdbc14.jar:$CLASSPATH
export PATH=$ORACLE_HOME/bin:/u02/TimesTen/tt_fyl/bin:$PATH
~
~
".bash_profile" 25L, 765C written
[oracle@fyl ~]$ . ./.bash_profile
[oracle@fyl ~]$ vi /etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 4194304 4194304
net.ipv4.tcp_wmem = 98304 4194304 4194304
net.ipv4.tcp_mem = 98304 4194304 4194304
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 63359738368
kernel.shmall = 17000000
kernel.shmmni = 4096
kernel.sem = 1500 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 4194304
注意:不同的内存kernel.shmmax = 34359738368(32G内存)/kernel.shmmax = 63359738368(64G内存) 设置不一样
[oracle@fyl ~]$ cd /soft
[oracle@fyl soft]$ ll
total 432152
-rw-r--r-- 1 oracle oinstall 47 Jun 10 21:04 afiedt.buf
drwxr-xr-x 8 oracle oinstall 4096 Sep 22 2011 database
drwxr-xr-x 5 oracle oinstall 4096 Jan 20 18:12 linux8664
-rw-r--r-- 1 oracle oinstall 89186858 Jun 8 22:48 ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
dr-xr-xr-x 2 oracle oinstall 249856 Feb 28 22:40 Packages
-rw-r--r-- 1 oracle oinstall 353064960 Jun 9 22:03 timesten112280.linux8664
[oracle@fyl soft]$ cd linux8664/
[oracle@fyl 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 ] tt_fyl
Instance name will be 'tt_fyl'.
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 ] 1
Of the following options :
[1] /home/oracle
[2] /soft
[3] Specify a location
[q] Quit the installation
Where would you like to install the tt_fyl instance of TimesTen? [ 1 ] 3
Please specify a directory to install TimesTen? [ /home/oracle ] /u02
Where would you like to create the daemon home directory? [ /u02/TimesTen/tt_fyl/info ]
The daemon logs will be located in /u02/TimesTen/tt_fyl/info
Would you like to specify a different location for the daemon logs? [ no ] yes
Where would you like the daemon logs to be written? [ /u02/TimesTen/tt_fyl/info ]
/u02/TimesTen/timesten_log
Are you sure you want the daemon logs to be written to /u02/TimesTen/timesten_log? [ yes ]
Installing into /u02/TimesTen/tt_fyl ...
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 'oinstall'? [ 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 was not set in your environment but there is a tnsnames.ora
file in /u02/app/oracle/product/11.2.0/db_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 /u02/app/oracle/product/11.2.0/db_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? [ /u02/TimesTen/tt_fyl/doc ]
The TimesTen documentation has been installed in /u02/TimesTen/tt_fyl/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 /u02/TimesTen/tt_fyl/bin
./setuproot -install
This will move the TimesTen startup script into its appropriate location.
The startup script is currently located here :
'/u02/TimesTen/tt_fyl/startup/tt_tt_fyl'.
The 11.2.2.8 Release Notes are located here :
'/u02/TimesTen/tt_fyl/README.html'
Starting the daemon ...
TimesTen Daemon startup OK.
End of TimesTen installation.
创建独立的缓存用户表空间
create tablespace tt datafile '/u02/app/oracle/oradata/fyl/tt01.dbf' size 20m;
SQL> @/u02/TimesTen/tt_fyl/oraclescripts/initCacheGlobalSchema.sql
Please enter the tablespace where TIMESTEN user is to be created
tt
The value chosen for tablespace is tt
******* 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.
创建cahce管理员用户 并赋权(需要缓存的表)
SQL>
SQL> create user cacheadm identified by cacheadm default tablespace tt
2 quota unlimited on tt;
User created.
SQL> @/u02/TimesTen/tt_fyl/oraclescripts/grantCacheAdminPrivileges.sql
Please enter the administrator user id
cacheadm
The value chosen for administrator user id is cacheadm
***************** Initialization for cache admin begins ******************
0. Granting the CREATE SESSION privilege to CACHEADM
1. Granting the TT_CACHE_ADMIN_ROLE to CACHEADM
2. Granting the DBMS_LOCK package privilege to CACHEADM
3. Granting the CREATE SEQUENCE privilege to CACHEADM
4. Granting the CREATE CLUSTER privilege to CACHEADM
5. Granting the CREATE OPERATOR privilege to CACHEADM
6. Granting the CREATE INDEXTYPE privilege to CACHEADM
7. Granting the CREATE TABLE privilege to CACHEADM
8. Granting the CREATE PROCEDURE privilege to CACHEADM
9. Granting the CREATE ANY TRIGGER privilege to CACHEADM
10. Granting the GRANT UNLIMITED TABLESPACE privilege to CACHEADM
11. Granting the DBMS_LOB package privilege to CACHEADM
12. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEADM
13. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEADM
14. Checking if the cache administrator user has permissions on the default
tablespace
Permission exists
16. Granting the CREATE TYPE privilege to CACHEADM
17. Granting the SELECT on SYS.GV$LOCK privilege to CACHEADM (optional)
18. Granting the SELECT on SYS.GV$SESSION privilege to CACHEADM (optional)
19. Granting the SELECT on SYS.DBA_DATA_FILES privilege to CACHEADM (optional)
20. Granting the SELECT on SYS.USER_USERS privilege to CACHEADM (optional)
21. Granting the SELECT on SYS.USER_FREE_SPACE privilege to CACHEADM (optional)
22. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to CACHEADM (optional)
23. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to CACHEADM (optional)
********* Initialization for cache admin user done successfully *********
SQL>
SQL> grant select,insert,update,delete on scott.dept to cacheadm;
配置连接oracle的TNS
[oracle@fyl admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /u02/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
FYL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = fyl)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fyl)
)
)
4、配置TT的数据源DSN
编辑install_dir/info/sys.odbc.ini
[ODBC Data Sources]
mydb=TimesTen 11.2.2 Driver
[mydb]
Driver=/u02/TimesTen/tt_fyl/lib/libtten.so
DataStore=/u02/TimesTen/oradata/mydb
DatabaseCharacterSet=ZHS16GBK
PermSize=60
TempSize=40
OracleNetServiceName=fyl
[oracle@fyl ~]$ ttisql mydb
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=mydb";
Connection successful:
DSN=mydb;UID=oracle;DataStore=/u02/TimesTen/oradata/mydb;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/u02/TimesTen/tt_fyl/lib/libtten.so;PermSize=60;TempSize=40;TypeMode=0;OracleNetServiceN
ame=fyl;
(Default setting AutoCommit=1)
创建cacheadm用户
为了能够同步oracle数据库数据,需要在TT数据库建立缓存管理员用户,远程访问数据库执行建立,更新删除数据源de动作。(与oracle数据库中创建的cache管理员用户同名)
Command> create user cacheadm identified by cacheadm;
User created.
Command> grant admin to cacheadm;
需要缓存oracle中哪个schema的表,创建同名schema
Command> create user scott identified by scott;
User created.
Command> grant create session to scott;
关联oracle中的cacheadm和TT中的cacheadm用户
[oracle@fyl info]$ ttisql "dsn=mydb;uid=cacheadm"
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "dsn=mydb;uid=cacheadm";
Enter password for 'cacheadm':
Connection successful:
DSN=mydb;UID=cacheadm;DataStore=/u02/TimesTen/oradata/mydb;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/u02/TimesTen/tt_fyl/lib/libtten.so;PermSize=60;TempSize=40;TypeMode=0;OracleNetServiceName=fyl;
(Default setting AutoCommit=1)
Command>
Command> call ttcacheuidpwdset('cacheadm','cacheadm') ;oracle数据库的cacheadm用户名密码
Command> call ttcacheuidget;
< CACHEADM >
1 row found.
Command>
创建缓存grid
Command> call ttgridcreate('mygrid');
Command> call ttgridnameset('mygrid');
Command> call ttgridinfo;
< MYGRID, CACHEADM, Linux x86-64, 64-bit, 11, 2, 2 >
1 row found.
启动cacheagent
Command> call ttcachestart;
创建缓存组
create readonly cache group scott.ttg_dept
autorefresh
mode incremental
interval 300000 milliseconds
from
scott.dept
(DEPTNO NUMBER(2) primary key,
DNAME VARCHAR2(14),
LOC VARCHAR2(13));
刷新cachegroup
Command> refresh Cache Group SCOTT.TTG_DEPT commit every 1000 rows parallel 6; 刷新所有
Command> load cache group SCOTT.TTG_DEPT commit every 256 rows; 导入oracle与TT不同的记录
(Command> ALTER CACHE GROUP SCOTT.TTG_DEPT SET AUTOREFRESH STATE PAUSED;)
4 cache instances affected.
Command> select * from scott.dept;
< 10, ACCOUNTING, NEW YORK >
< 20, RESEARCH, DALLAS >
< 30, SALES, CHICAGO >
< 40, OPERATIONS, BOSTON >
4 rows found.
Command>
对于dynamic asynchronous writethrough global cache group需要开启Replication
Command> call ttrepstart;