timesten配置只讀同步

安佰勝發表於2014-10-21
資料庫方面:

 

create tablespace ttusers datafile '/opt/oracle/oradata/data2db/ttusers_001.dbf' size 100m;

cd /opt/TimesTen/tt1122/oraclescripts/
cp initCacheGlobalSchema.sql /tmp
cp grantCacheAdminPrivileges.sql /tmp
cd /tmp
chmod  777 initCacheGlobalSchema.sql  grantCacheAdminPrivileges.sql

su - oracle
cd /tmp
sqlplus / as sysdba
@initCacheGlobalSchema.sql


SQL> @initCacheGlobalSchema.sql

Please enter the tablespace where TIMESTEN user is to be created
ttusers
The value chosen for tablespace is ttusers

******* 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.


create user cacheadm identified by cacheadm
default tablespace ttusers
quota unlimited on ttusers
temporary tablespace temp;

@grantCacheAdminPrivileges.sql


------------

SQL> create user cacheadm identified by cacheadm
  2  default tablespace ttusers
  3  quota unlimited on ttusers
  4  temporary tablespace temp;

User created.

SQL> @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 RESOURCE  privilege to CACHEADM
4. Granting the CREATE PROCEDURE  privilege to CACHEADM
5. Granting the CREATE ANY TRIGGER  privilege to CACHEADM
6. Granting the DBMS_LOB package privilege to CACHEADM
7. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEADM
8. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEADM
9. Checking if the cache administrator user has permissions on the default
tablespace
     Permission exists
11. Granting the CREATE TYPE privilege to CACHEADM
12. Granting the SELECT on SYS.GV$LOCK privilege to CACHEADM (optional)
13. Granting the SELECT on SYS.GV$SESSION privilege  to CACHEADM (optional)
14. Granting the SELECT on SYS.DBA_DATA_FILES privilege  to CACHEADM (optional)
15. Granting the SELECT on SYS.USER_USERS privilege  to CACHEADM (optional)
16. Granting the SELECT on SYS.USER_FREE_SPACE privilege  to CACHEADM (optional)
17. Granting the SELECT on SYS.USER_TS_QUOTAS privilege  to CACHEADM (optional)
18. Granting the SELECT on SYS.USER_SYS_PRIVS privilege  to CACHEADM (optional)
********* Initialization for cache admin user done successfully *********


建立表空間ttusers
指令碼建立timesten使用者
手動建立cacheadm使用者
手動授權給cacheadm使用者需要同步到timesten中的表的相關許可權

SQL> create table ta(id int);

SQL> select * from ta; 

no rows selected

SQL>
SQL>
SQL> insert into ta select 1 from dual;

1 row created.

SQL> commit;

Commit complete.

SQL> grant select on ta to cacheadm;

Grant succeeded.

SQL> grant update,delete,insert on ta to cacheadm;

Grant succeeded.


grant connect,resource,create any trigger to cacheadm;
grant dba to cacheadm;


tt配置

ttisql an_tt1122
create user cacheadm identified by cacheadm;
grant admin to cacheadm;

create user an identified by anbaisheng;
grant create session to an;

connect "dsn=an_tt1122;uid=cacheadm;oraclepwd=cacheadm";

call ttcacheuidpwdset ('cacheadm','cacheadm');
call ttcacheuidget;
call ttCacheStart;


call ttGridCreate('myGrid');
call ttGridNameSet('myGrid');


call ttCacheStart;


CREATE READONLY CACHE GROUP readcache
AUTOREFRESH
INTERVAL 1 SECONDS
FROM ta (id int not null primary key);


load cache group readcache commit every 1 rows;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13177610/viewspace-1306009/,如需轉載,請註明出處,否則將追究法律責任。

相關文章