본문 바로가기

Note

[이중화] 로그 쉬핑(shipping)을 통한 복제서버 구성

Informix에서는 CLR (continuous log restore) 를 통하여 원격지 서버에 복제 서버 구성이 가능한 것으로 알고 있다.

DB2에서는 (내가 모르고 있는 것인지 모르지만) CLR에 해당하는 기능은 없어 보인다.

HADR 설정을 통하여 DB 동기화는 가능하지만, Flash Copy 및 디스크 복제 기반의 이중화 환경에서는 실시간으로 Disk 복제를 하지 않는 이상 불가능하다.

 

한번은 고객사쪽에서 아카이브 로그만 복제 서버로 옮겨서 복구를 계속 할 수 있는지를 문의해 왔다.

즉 rollforward 작업을 한번이 아닌, 여러 번 수행 가능한지 확인이 필요한 문제였다.

아카이브 로그를 원격지 복제서버에 수동으로 옮겨주어야 하는 불편함은 있지만, 이 부분은 제외를 하고 다음과 같이 테스트를 해 보았다.

 

1. 테스트 시나리오

순서

TEST(운영 서버)

TEST1 (복제서버)

1

TEST DB 생성 및 archive log 적용

2

T1 테이블 생성

3

온라인 DB full 백업

4

TEST 온라인 백업을 TEST1 이름으로 Restore

5

T1 에 값 입력(1) 후 로그 스위치

6

아카이브 로그 복사 후 rollforward

7

T1 에 값 입력(2) 후 로그 스위치

8

아카이브 로그 복사 후 rollforward

9

Rollforward 완료 및 데이터 조회

10

데이터 조회

 

2. 테스트

 

TEST(운영 서버)

TEST1 (복제서버)

1

db2 create db test on /database

db2 update db cfg for test using logarchmeth1 disk:/database/archivelog

db2 backup db test to /dev/null

2

db2 connect to test

db2 "create table t1 (c1 int, c2 timestamp)"

3

db2 backup db test online to /database/backup

4

db2 "restore db test from /database/backup into test1"

db2 "rollforward database test1 query status"

Rollforward Status

Input database alias = test

Number of members have returned status = 1

Member ID = 0

Rollforward status = DB pending

Next log file to be read = S0000001.LOG

Log files processed = -

Last committed transaction = 2013-03-20-06.18.12.000000 UTC

5

db2 "insert into t1 values (1,current timestamp)"

ls /database/archivelog/fed10/TEST/NODE0000/

LOGSTREAM0000/C0000000

S0000000.LOG S0000001.LOG S0000002.LOG S0000003.LOG

 ls /database/archivelog/fed10/TEST/NODE0000/

LOGSTREAM0000/C0000000

S0000000.LOG S0000001.LOG S0000002.LOG S0000003.LOG S0000004.LOG S0000005.LOG

 

6

cp /database/archivelog/fed10/TEST/NODE0000/

LOGSTREAM0000/C0000000/* .

db2 "rollforward db test1 to end of logs"

Rollforward Status

Input database alias = test1

Number of members have returned status = 1

Member ID = 0

Rollforward status = DB working

Next log file to be read = S0000006.LOG

Log files processed = S0000001.LOG - S0000005.LOG

Last committed transaction = 2013-03-20-06.21.14.000000 UTC

7

db2 "insert into t1 values (2,current timestamp)"

db2 archive log for db test

S0000000.LOG S0000001.LOG S0000002.LOG S0000003.LOG S0000004.LOG S0000005.LOG S0000006.LOG

8

cp TEST/NODE0000/LOGSTREAM0000/

C0000000/S0000006.LOG .

db2 "rollforward db test1 to end of logs"

Rollforward Status

Input database alias = test1

Number of members have returned status = 1

Member ID = 0

Rollforward status = DB working

Next log file to be read = S0000007.LOG

Log files processed = S0000001.LOG - S0000006.LOG

Last committed transaction = 2013-03-20-06.26.44.000000 UTC

9

db2 "rollforward db test1 complete"

Rollforward Status

Input database alias = test1

Number of members have returned status = 1

Member ID = 0

Rollforward status = not pending

Next log file to be read =

Log files processed = S0000001.LOG - S0000006.LOG

Last committed transaction = 2013-03-20-06.26.44.000000 UTC

 

db2 connect to test1

db2 "select * from t1"

C1 C2

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

1 2013-03-20-15.21.14.698452

2 2013-03-20-15.26.44.622604

2 record(s) selected

10

db2 connect to test

db2 "select * from t1"

C1 C2

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

1 2013-03-20-15.21.14.698452

2 2013-03-20-15.26.44.622604

2 record(s) selected