Setup Cache Connect Step by Step on Solaris

来源:互联网 发布:淘宝内衣试穿视频 编辑:程序博客网 时间:2024/06/07 06:18
 
1. Install TimesTen with Cache Connect option and access control.

2. Install Oracle10g Client.

3. Setup environment variable.
$ cd /export/home/timesten
$ vi  .profile
ORACLE_HOME=/disk01/app/oracle/products/10.2.0
TT_HOME=/opt/TimesTen/tt60
PATH=$PATH:$ORACLE_HOME/bin:$TT_HOME/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$TT_HOME/lib
SHLIB_PATH=$SHLIB_PATH:$ORACLE_HOME/lib:$TT_HOME/lib
export ORACLE_HOME TT_HOME PATH LD_LIBRARY_PATH SHLIB_PATH
 
4. Need to create a soft link for the oracle LIBRARY file to solve 5192 error message.
# su - oracle
$cd $ORACLE_HOME/lib
$ln -s libclntsh.so.10.1 libclntsh.so
 
5. Setup Oracle client connection string to connect to oracle server.
$ cd $ORACLE_HOME/network/admin
$ more tnsnames.ora
MSP = (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = sc-msplsnr)(PORT = 1522))
        (CONNECT_DATA =
                (SERVICE_NAME = MSP)
        )

6. Create required oracle accounts.
$ sqlplus sys/change_on_install@MSP as sysdba
SQL>CREATE USER test IDENTIFIED BY test;
SQL>GRANT connect, resource, create any trigger to test;
SQL>COMMIT;

7. Create an account on TimesTen by connecting to TimesTen using the TT_tt60 DSN.
# su - timesten
$ ttisql TT_tt60
$ CREATE USER test IDENTIFIED BY 'test';
$ GRANT ADMIN, DDL TO test;

8. Create a TimesTen DSN named tt_study.
$ vi /opt/TimesTen/tt60/info/sys.odbc.ini
tt_study=TimesTen 6.0 Driver
……………………………………….
[tt_study]
DataStore=/var/TimesTen/tt_study/tt_study
PermSize=20
TempSize=20
OracleID=msp      (oracle client connection string name)
OraclePWD=test   (oracle account password)
UID=test                (oracle and timesten account name)
PWD=test              (timesten account password)
 
9. Create an Oracle table.
$ sqlplus test/test@msp
SQL> create table tt_test (a int primary key);
SQL> insert into tt_test values(1);
SQL> insert into tt_test values(2);
SQL>COMMIT;

10. Create the cache group.
$ ttisql tt_study
Command> call ttCacheUidPwdSet('test','test');
Command> call ttCacheStart();
Command> create readonly cache group tt_cache autorefresh interval 2 seconds from tt_test(a int primary key);
 
11. Load the cache group.
Command> load cache group tt_cache commit every 2 rows;
Command> cachegroups;
 
Cache Group TEST.TT_CACHE:
 
 Cache Group Type: Read Only
 Autorefresh: Yes
 Autorefresh Mode: Incremental
 Autorefresh State: On
 Autorefresh Interval: 2 Seconds
 Autorefresh Limit: 10000
 
 Root Table: TEST.TT_TEST
 Table Type: Read Only
 
1 cache group found.
 
12. Check the result and the result should be 2 records.
Command> select * from tt_test;
< 1 >
< 2 >
2 rows found.
 
13. Insert one more record from database and check the result from TimesTen, the result should be 3 recourd.
$ sqlplus test/test@msp
SQL> insert into tt_test values(3);
SQL> commit;
 
$ ttisql tt_study
Command> select *from tt_test;
< 1 >
< 2 >
< 3 >
3 rows found.