TimesTen 데이터베이스 복제 학습: 9.Active Standby Pair 변경

Active Standby Pair에서 DDL 문 복사
다음 예에서 active master는cachedb2,standby master는cachedb1
Active Standby Pair에서 데이터베이스 객체 복사
DDLReplicationLevel 연결 속성은 객체를 복제하는 동작을 제어합니다.DDLReplicationLevel = 1: 테이블, 인덱스와 동의어의create와drop을 복제하지 않고 복사표의 추가와 삭제열만 복제합니다 DDLReplicationLevel = 2: 기본값, 복제표, 인덱스와 동의어의create와drop;DDL Replication Action은 INCLUDE(기본값) DDL Replication Level = 3으로 설정해야 합니다. 2의 모든 동작을 제외하고 보기, 시퀀스, ttCacheUidPwdset, 그리고 테이블에 비어 있는 열을 추가할 수 있습니다.
복제 동작 제어
다음은 DDLReplicationLevel = 2의 경우입니다(기본값).
cachedb2> call ttconfiguration;
......
< DDLReplicationAction, INCLUDE >
< DDLReplicationLevel, 2 >

cachedb2> create table a1(a int, primary key(a));
cachedb1> select * from a1;
cachedb2> insert into a1 values(1);
cachedb1> select * from a1;
< 1 >
cachedb2> drop table a1;
cachedb1> select * from a1;
 2206: Table TTHR.A1 not found

cachedb2> create table a2(a int);
17061: When DDLReplicationAction='INCLUDE' tables must be created with a primary key or a unique constraint on non-nullable column(s)


cachedb2> ALTER SESSION SET ddl_replication_action='EXCLUDE'; <-      DML,DDL   

Session altered.
cachedb2> call ttconfiguration('DDLReplicationAction');
< DDLReplicationAction, EXCLUDE >
cachedb2> create table a1(a int, primary key(a));
cachedb1> select * from a1;
cachedb2> insert into a1 values(1);
cachedb1> select * from a1;

cachedb2>  create table a2(a int);
cachedb1> select * from a2;

cachedb1> repschemes;

Replication Scheme Active Standby:

  Master Store: CACHEDB2 on TIMESTEN-HOL
  Master Store: CACHEDB1 on TIMESTEN-HOL


  Excluded Tables: <-     
    TTHR.A1
    TTHR.A2

  Excluded Cache Groups:
    None

  Excluded sequences:
    None

  Store: CACHEDB1 on TIMESTEN-HOL
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled

  Store: CACHEDB2 on TIMESTEN-HOL
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled

  Store: _ORACLE from TIMESTEN-HOL
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled


cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a1;
cachedb2> insert into a1 values(3);
cachedb1> select * from a1;
< 3 >

cachedb2> repschemes;

Replication Scheme Active Standby:

  Master Store: CACHEDB2 on TIMESTEN-HOL
  Master Store: CACHEDB1 on TIMESTEN-HOL


  Excluded Tables:
    TTHR.A2
  Included Tables: <-     
    TTHR.A1

  Excluded Cache Groups:
    None

  Excluded sequences:
    None

  Store: CACHEDB1 on TIMESTEN-HOL
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled

  Store: CACHEDB2 on TIMESTEN-HOL
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled

  Store: _ORACLE from TIMESTEN-HOL
    Port: (auto)
    Log Fail Threshold: (none)
    Retry Timeout: 120 seconds
    Compress Traffic: Disabled

cachedb2> create index idx on a1(a);
17063: CREATE INDEX can only refer to empty tables when DDLReplicationLevel > 1

먼저 테이블 하나를 복사하지 않고 나중에 복제 계획에 추가합니다
cachedb2> drop table a2;
cachedb2> ALTER SESSION SET ddl_replication_action='exclude';

Session altered.

cachedb2> create table a2(a int not null);
cachedb1> select * from a2;
cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a2;
 8000: No primary or unique index on non-nullable column found for replicated table TTHR.A2
cachedb2> CREATE UNIQUE INDEX ixnewtab ON a2(a);
cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a2;

다음 예는 만약에 한 표가 처음에 복제 계획에 없었다가 다시 복제 계획에 가입하면 이 표는 반드시 비어야 한다는 것을 설명한다
cachedb2> ALTER SESSION SET ddl_replication_action='exclude';

Session altered.

cachedb2> create table a2(a int, primary key(a));
cachedb2> insert into a2 values(1);
cachedb2> insert into a2 values(2);
cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a2;
17059: Replicated INCLUDE TABLE failed for (TTHR.A2) because the table is not empty
cachedb2> delete from a2;
cachedb2> ALTER ACTIVE STANDBY PAIR INCLUDE TABLE a2;

자동 복사 가능한 객체
다음 객체는 DDL Replication Level = 2 또는 3에 * Create, alter, or drop a user with the CREATE USER, ALTER USER, or DROP USER statements. *Grant or revoke privileges from a user with the GRANT or REVOKE statements. * Alter a table to add or drop a column with the ALTER TABLE … ADD COLUMN or ALTER TABLE … DROP COLUMN statements. These are the only ALTER TABLE clauses that are replicated. However, when DDLReplicationLevel=2, you cannot alter a table to add a NOT NULL column to a table that is part of a replication scheme with the ALTER TABLE … ADD COLUMN NOT NULL DEFAULT statement. You can execute this statement if DDLReplicationLevel=3. * Create or drop a table, including global temporary tables with the CREATE TABLE or DROP TABLE statements. The new table is also included in the active standby pair. * Create or drop a synonym with the CREATE SYNONYM or DROP SYNONYM statements. * Create or drop an index with the CREATE INDEX or DROP INDEX statements.
다음 대상은 DDL Replication Level = 3시에만 * 보기 * 시퀀스 (sequence) * ttCacheUidPwdset 작업을 자동으로 복사할 수 있습니다
위의 복제 작업은 복제 에이전트를 중지할 필요가 없습니다.
물적 보기의 조작에 대해 autorefresh mode를 변경하면 PL/SQL은 복제되지 않습니다. PL/SQL 함수를 만들려면 모든 데이터베이스에서create 문장을 실행하고 권한을 부여해야 합니다.
빈 테이블에서 만든 인덱스만 복사됩니다. 인덱스를 복사하려면 DDLReplicationLevel을 1로 설정하고 모든 데이터베이스에 수동으로 만들 수 있습니다
active standby pair에 대한 기타 변경 작업
다음 작업은 복사 에이전트를 중지해야 합니다. * Include or exclude a cache group. *Add or drop a subscriber. * Change values in the STORE clause. * Change network operations (ADD ROUTE or DROP ROUTE clause).
위의 절차는 다음과 같습니다. 1.active에서 Rep 에이전트 중지 2.ASP에 캐시 그룹이 있으면 active에서 cache agent 를 중지합니다. 3.Alter ACTIVE STANDBY PAIR을 사용하여 복사 schema 4.active에서rep에이전트 시작 5.ASP에 캐시 그룹이 있으면 active에서 cache agent 6. 를 시작합니다.destroy 모든standby와subscriber 7.ttRepadmin 클론 standby 8.standby의rep 에이전트 시작 9.standby 대기 상태가 자동으로 STANDBY(ttRepStateGet) 10.ASP에 캐시 그룹이 있으면 standby에서 cache agent 11을 시작합니다.standby 클론subsc를 통해 12.subscriber의 복사 프록시를 시작합니다

좋은 웹페이지 즐겨찾기