Oracle 메모리 데이터베이스 Timesten 사용 (2)

본 고 는 Timesten 과 Oracle 의 동기 화 를 어떻게 실현 하 는 지, Oracle 과 의 동기 화 를 실현 하려 면 먼저 Oracle 에서 표 공간 과 사용자 1, 표 공간 을 만들어 야 한다. 이 표 공간 은 timesten user 와 cache administration user 에 의 해 사 용 될 것 이다. 이 표 공간 은 cache 와 관련 된 대상 만 저장 하고 다른 응용 프로그램 과 공유 하지 말 아야 한다.
CREATE TABLESPACE TIMESTEN DATAFILE '/u01/app/oradata/timesten/tbs_timesten.dbf' SIZE 300M;  

2. Timesten 사용 자 를 만 들 려 면 initCacheGlobalSchema. sql 스 크 립 트 를 실행 하고 방금 만 든 표 공간 이름 을 전달 해 야 합 니 다.이 스 크 립 트 는% Times Ten 에 있 습 니 다.install_dir%/oraclescripts
SQL> @E:/temp/oraclescripts/initCacheGlobalSchema.sql "TIMESTEN"
Cannot SET TRIMSPOOL Cannot SET TAB Please enter the tablespace where TIMESTEN user is to be created The value chosen for tablespace is TIMESTEN ******* 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 ** 

3. cache administration user 를 만 듭 니 다. 사용자 이름 은 cacheuser 를 사용 하고 비밀 번 호 는 Oacle 을 사용 합 니 다.% TimesTen 실행install_dir% / oraclescript 디 렉 터 리 에 있 는 스 크 립 트 grantCacheAdmin Privileges. sql 을 매개 변수 로 cacheuser 를 입력 합 니 다.이 스 크 립 트 를 실행 하려 면 sys 를 사용 해 야 합 니 다. DBA 권한 이 있 는 사용자 가 실행 하면 일부 권한 을 부여 할 수 없습니다.
SQL>CREATE USER CACHEUSER IDENTIFIED BY ORACLE DEFAULT TABLESPACE TIMESTEN QUOTA UNLIMITED ON TIMESTEN;
uesr created
SQL> @E:/temp/oraclescripts/grantCacheAdminPrivileges.sql "CACHEUSER";
Cannot SET TRIMSPOOL Cannot SET TAB Please enter the administrator user id The value chosen for administrator user id is CACHEUSER ***************** Initialization for cache admin begins ****************** 0. Granting the CREATE SESSION privilege to CACHEUSER 1. Granting the TT_CACHE_ADMIN_ROLE to CACHEUSER 2. Granting the DBMS_LOCK package privilege to CACHEUSER ORA-01031: insufficient privileges 3. Granting the CREATE SEQUENCE privilege to CACHEUSER 4. Granting the CREATE CLUSTER privilege to CACHEUSER 5. Granting the CREATE OPERATOR privilege to CACHEUSER 6. Granting the CREATE INDEXTYPE privilege to CACHEUSER 7. Granting the CREATE TABLE privilege to CACHEUSER 8. Granting the CREATE PROCEDURE privilege to CACHEUSER 9. Granting the CREATE ANY TRIGGER privilege to CACHEUSER 10. Granting the GRANT UNLIMITED TABLESPACE privilege to CACHEUSER 11. Granting the DBMS_LOB package privilege to CACHEUSER ORA-01031: insufficient privileges 12. Granting the SELECT on SYS.ALL_OBJECTS privilege to CACHEUSER 13. Granting the SELECT on SYS.ALL_SYNONYMS privilege to CACHEUSER 14. Checking if the cache administrator user has permissions on the default tablespace  Permission exists 16. Granting the CREATE TYPE privilege to CACHEUSER 17. Granting the SELECT on SYS.GV$LOCK privilege to CACHEUSER (optional) ORA-01031: insufficient privileges 18. Granting the SELECT on SYS.GV$SESSION privilege to CACHEUSER (optional) ORA-01031: insufficient privileges 19. Granting the SELECT on SYS.DBA_DATA_FILES privilege to CACHEUSER (optional) ORA-01031: insufficient privileges 20. Granting the SELECT on SYS.USER_USERS privilege to CACHEUSER (optional) 21. Granting the SELECT on SYS.USER_FREE_SPACE privilege to CACHEUSER (optional) 22. Granting the SELECT on SYS.USER_TS_QUOTAS privilege to CACHEUSER (optional) 23. Granting the SELECT on SYS.USER_SYS_PRIVS privilege to CACHEUSER (optional) ** Initialization for cache admin user could not be successfully done ** 

DBA 권한 을 가 진 사용자 가 실행 하 는 스 크 립 트 를 사용 하기 때문에 일부 권한 은 권한 을 부여 할 수 없습니다. 구체 적 으로 다음 과 같 습 니 다.
[oracle@bogon ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 31 11:57:54 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> GRANT EXECUTE ON SYS.DBMS_LOCK TO cacheuser;

Grant succeeded.

SQL> GRANT EXECUTE ON SYS.DBMS_LOB TO cacheuser;

Grant succeeded.

SQL> GRANT SELECT ON SYS.GV_$LOCK TO cacheuser;

Grant succeeded.

SQL> GRANT SELECT ON SYS.GV_$SESSION TO cacheuser;

Grant succeeded.

SQL> GRANT SELECT ON SYS.DBA_DATA_FILES TO cacheuser;

Grant succeeded.

스 크 립 트 를 여기까지 정리 하여 나중에 호출 하기 편리 합 니 다.
GRANT EXECUTE ON SYS.DBMS_LOCK TO cacheuser;
GRANT EXECUTE ON SYS.DBMS_LOB TO cacheuser;
GRANT SELECT ON SYS.GV_$LOCK TO cacheuser;
GRANT SELECT ON SYS.GV_$SESSION TO cacheuser;
GRANT SELECT ON SYS.DBA_DATA_FILES TO cacheuser;

이 오 라 클 의 작업 은 기본적으로 끝 났 습 니 다. 다음은 Timesten 이 설정 해 야 할 내용 4, TNS 설정 입 니 다.ADMIN
[timesten@bogon ~]$ ttModInstall -tns_admin /opt/oracle/TimesTen/tt1122/ttoracle_home/instantclient_11_2/network/admin;
TNS_ADMIN for the instance 'tt1122' is currently not set.
Would you like to change TNS_ADMIN for this instance? [ yes ] yes
Please enter a value for TNS_ADMIN (q=quit)? [ /opt/oracle/TimesTen/tt1122/ttoracle_home/instantclient_11_2/network/admin ] 

Do you want to restart the daemon using the new configuration? [ yes ] yes
Restarting the daemon ...
TimesTen Daemon stopped.
TimesTen Daemon startup OK.
Instance tt1122 is now configured with TNS_ADMIN=/opt/oracle/TimesTen/tt1122/ttoracle_home/instantclient_11_2/network/admin

설치 할 때 TNS 를 설정 하면ADMIN 은 이 항목 을 무시 하고 cache administration user 를 설정 합 니 다.
NOTE:This procedure requires CACHE_MANAGER privilege. ttCacheUidPwdSet(‘UID’, ‘PWD’) ttCacheUidGet()
Command> call ttCacheUidPwdSet('cacheuser','oracle');
Command> call ttCacheUidGet();
< CACHEUSER >
1 row found.

6. cache grid 를 만 들 기 전에 cache grid 를 만들어 야 합 니 다. cache grid 의 첫 번 째 데이터베이스 구성원 만 이 작업 을 수행 해 야 합 니 다.cache manager user 로 로그 인 한 후 다음 명령 을 입력 하여 cache grid "my Grid" 를 만 듭 니 다.
Command> call ttGridCreate('gjds_grid'); 

timesten 을 방금 만 든 cache grid 와 연결 합 니 다.
Command> call ttGridNameSet('gjds_grid');

cache 프 록 시 를 시작 합 니 다. read only cache 를 만 들 었 다 면 이 프 록 시 를 시작 해 야 사용 할 수 있 습 니 다.이 에이 전 트 는 timesten database 간 의 소통 과 Oacle 과 timesten cache database 간 의 데이터 흐름 을 책임 집 니 다.
Command> call ttCacheStart;

7. cache groups 를 만 들 고 cache group readcache 만 읽 을 수 있 는 고속 캐 시 Oacle 의 표 TEST. TT 를 만 듭 니 다.CACHE_TEST
#     Oracle  TT_CACHE_TEST       CACHEUSER
SQL> GRANT SELECT ON TT_CACHE_TEST TO CACHEUSER; 

   Timesten        
Command> create readonly cache group TT_CACHE_TEST1 autorefresh interval 60 seconds from
TT_CACHE_TEST(
ID VARCHAR2(20) PRIMARY KEY,
ADDRESS VARCHAR2(40),
NAME VARCHAR2(20)
);

복제 에이 전 트 를 시작 합 니 다. 데이터베이스 에 asynchronous writethrough cache groups 가 있 으 면 이 에이 전 트 를 시작 해 야 합 니 다. 이 프로 세 스 는 TT 데이터베이스 간, TT 와 oracle 간 의 데이터 복 제 를 책임 집 니 다.
Command> call ttrepstart;

8. read - only cache group 을 사용 하여 cache manager user 로 로그 인 한 후, 먼저 Oacle 에서 readcache 에 해당 하 는 cache 표 의 내용 을 수 동 으로 불 러 와 야 합 니 다.
Command> LOAD CACHE GROUP TT_CACHE_TEST1 COMMIT EVERY 100 ROWS;
9 cache instances affected

9. Cache 프 록 시 를 다시 시작 합 니 다. 데이터 가 동기 화 되 지 않 은 것 을 발견 하면 cache 프 록 시 를 다시 시작 할 수 있 습 니 다.
Command> call ttCacheStop();
Command> call ttCacheStart();

좋은 웹페이지 즐겨찾기