OGG(Oracle Golden Gate) 엔지니어가 아니므로 기본적인 설치와 운영 방법, 흐름만을 정리한 글이다.
자세한 부분은 점부파일을 확인한다.
sms 10.0.9.219
oracle / oracle
ogg 설치 경로
/data/ogg_home
# source
10.0.9.218
oracle / oracle
# target
10.0.9.220
oracle / oracle
OGG 설정 방법
1. source와 target 에 ogg client 설치
1) 엔진 - 오라클 홈페이지 - 다운로드 - 미들웨어 - ogg
2) ogg 패치파일 다운로드 - oracle support
2. ogg 하기위해 force_logging 을 yes 로 변경 => 아카이브 증가 30%
SQL> select force_logging from v$database;
FORCE_LOGGING
-------------
NO
SQL> select force_logging from v$database;
FORCE_LOGGING
-------------
NO
SQL> select force_logging from v$database;
FORCE_LOGGING
-------------
YES
3. ogg 엔진 설치
[oracle@smsdb:/data/media/OGG] ls -al
total 800456
drwxr-xr-x 2 oracle dba 4096 Feb 22 16:58 .
drwxr-xr-x 4 oracle dba 4096 Feb 22 16:58 ..
-rw-r--r-- 1 oracle dba 611849233 Feb 22 17:24 122022_fbo_ggs_Linux_x64_shiphome.zip
-rw-r--r-- 1 oracle dba 206995329 Feb 22 17:12 p27111516_122022_Linux-x86-64.zip
[oracle@smsdb:/data/media/OGG/fbo_ggs_Linux_x64_shiphome/Disk1] ls -al
total 24
drwxr-xr-x 5 oracle dba 4096 Jul 1 2017 .
drwxr-xr-x 3 oracle dba 4096 Jul 1 2017 ..
drwxr-xr-x 4 oracle dba 4096 Jul 1 2017 install
drwxrwxr-x 2 oracle dba 4096 Jul 1 2017 response
-rwxr-xr-x 1 oracle dba 918 Jul 1 2017 runInstaller
drwxr-xr-x 11 oracle dba 4096 Jul 1 2017 stage
4. opatch 패치
5. ogg 설치경로 이동
1) ggsci
GGSCI (smsdb) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
6. ogg 에서 사용할 유저 생성
select * from dba_users
grant dba to ogg
alter database add supplemental log data; -- pk 변경 정보, row id 수집
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA(ALL) COLUMNS; -- 모든 정보 수집
SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;
SUPPLEMENTAL_LOG_DATA_MIN
-------------------------
YES
ggsci >> dblogin userid oggs , password oggs
-- exta 파라미터 설정
ggsci >> edit param exta
### source 단
EXTRACT EXTA
USERID oggs , PASSWORD oggs
gettruncates
logallsupcols
statoptions, reportfetch, repoortdetail, resetreportstats
report at 00:00
reportrollover at 00:01
REPORTCOUNT EVERY 15 MINUTES, RATE
discardfile ./dirrpt/E1.dsc, purge, megabytes 200
exttrail ./dirdat/ea
table SPCCAPITAL.*;
table SMS_WEB.*;
table SPCSMS.*;
table SPCNGW.*;
--extract 등록
-- 트랜잭션 양에 따라 메가바이트 사이즈 조절 필요
add extract exta , tranlog , begin now
add exttrail ./dirdat/ea , extract exta , megabytes 50
==> start exta
-- 현재시점으로 exta을 다시 동기화
GGSCI (smsdb as ogg@SMSON) 29> alter exta, begin now
GGSCI (smsdb as ogg@SMSON) 31> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXTA 00:00:00 00:00:07
### source 에서 target 설정
ggsci >> edit param mgr
ggsci >> stop mgr
ggsci >> start mgr
PORT 7809
PURGEOLDEXTRACTS ./dirdat/ea*, USECHECKPOINTS, MINKEEPHOURS 72
ggsci >> edit param epumpa
GGSCI (smsdb as ogg@SMSON) 42> view param epumpa
extract epumpa
userid ogg,password ogg
rmthost 10.0.9.218, mgrport 7809
passthru
rmttrail ./dirdat/ra
table SPCCAPITAL.*;
table SMS_WEB.*;
table SPCSMS.*;
table SPCNGW.*;
--pump
add extract epumpa , exttrailsource ./dirdat/ea
add rmttrail ./dirdat/ra , extract epumpa , megabytes 50
GGSCI (smsdb as ogg@SMSON) 12> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EPUMPA 00:00:03 00:00:01
EXTRACT RUNNING EXTA 00:00:00 00:00:10
@@@@@@@@@@@@@@@@@@@@@@@@@@@target
replicat r1
userid ogg, password "ogg"
discardfile ./dirout/r1.dsc, megabytes 1000, append
discardrollover at 00:00
reportcount every 5 minutes, rate
REPORTROLLOVER AT 00:01 ON MONDAY
REPORT AT 08:00
REPORT AT 17:00
statoptions, reportdetail, resetreportstats
--# DBOPTIONS
--DBOPTIONS SUPPRESSTRIGGERS
--# Table Setting
ASSUMETARGETDEFS
BATCHSQL
--# TABLE LIST
MAP SPCCAPITAL.*, TARGET SPCCAPITAL.*;
MAP SMS_WEB.*, TARGET SMS_WEB.*;
MAP SPCSMS.*, TARGET SPCSMS.*;
MAP SPCNGW.*, TARGET SPCNGW.*;
~
~
~
select current_scn from v$database;
expdp system/ DIRECTORY=pump_ogg DUMPFILE=spcn_20180316.dmp LOG=spcn_20180316.log FLASHBACK_SCN=15213553117439 SCHEMAS=SPCCAPITAL,SMS_WEB,SPCSMS,SPCNGW,DW_LINK,EAI
impdp system/ DIRECTORY=pump_ogg DUMPFILE=spcn_20180316.dmp LOG=spcn_20180316.log CLUSTER=N
GGSCI (c2main-db-dev01) 2> info REP01
REPLICAT REP01 Last Started 2019-02-15 13:51 Status ABENDED
Checkpoint Lag 00:00:00 (updated 00:23:15 ago)
Log Read Checkpoint File /home/oracle/ogg/dirdat/PA000000006
2019-02-15 13:15:54.538932 RBA 49639
-- R1을 해당 scn 부터 동기화 시작
start replicat r1 atcsn 15213553117439;
alter replicat REP02, extseqno 00006, extrba 49639
select * from v$tansaction;
새로 추가 replicat 프로세스
-- add replicat <process> exttrail <./dirdat/pa>
DELETE replicat REP02
add replicat REP02, exttrail ./dirdat/pa , checkpointtable
add replicat REP02, exttrail ./dirdat/PA , nodbcheckpoint
alter replicat REP02, extseqno 6, extrba 65678
GGSCI (HaviPori) 4> ADD REPLICAT REP02, EXTTRAIL ./dirdat/pa, CHECKPOINTTABLE ogg.employees_chkpt,
####################################
ogg error
ogg-01027 long running transaction xid
http://rajkiran-dba.blogspot.com/2013/05/oracle-golden-gate-long-running.html
# 트랜잭션 확인
send extract E1, showtrans duration 20 MIN
# 트랜잭션 xid 확인, inst_id, addr 확인
select * from gv$transaction where xidusn=8805;
# addr = taddr , sql_id 확인
select sid,serial#,event,machine,sql_id,seconds_in_wait,prev_sql_id,module,program,action from gv$session where taddr='0000001BFF3DEBD8';
# sql 확인
select * from gv$sql
# 해당 세션 살아 있는지 확인
select logon_time,status,LAST_CALL_ET from gv$session where sid=9871 and inst_id=2;
# 세션 킬
alter system kill session '9871,167';
###################
OGG 기본 파라미터
ggsci> create subdirs --> source , target 모두
ggsci> edit param mgr --> source , target 모두 (source : 9000 , target : 9100)
- port 9000
sql> alter database add supplemental log data;
ggsci> dblogin userid oggs , password oggs
ggsci> add trandata oggtest.ogg_test
-- OGG (source)
? EXTA.PRM
EXTRACT EXTA
USERID oggs , PASSWORD oggs
exttrail ./dirdat/ea
table oggtest.ogg_test;
--extract
add extract exta , tranlog , begin now
add exttrail ./dirdat/ea , extract exta , megabytes 50
alter exta, begin now
==> start exta
? EPUMPA.PRM
extract epumpa
userid oggs,password oggs
rmthost localhost, mgrport 9100
passthru
rmttrail ./dirdat/ra
table oggtest.ogg_test;
--pump
add extract epumpa , exttrailsource ./dirdat/ea
add rmttrail ./dirdat/ra , extract epumpa , megabytes 50
==> start pumpa
-- OGG (target)
? REPA.PRM
replicat repa
userid oggt,password oggt
--HANDLECOLLISIONS
assumetargetdefs
map oggtest.ogg_test , target oggtest11.ogg_test;
--replicat
add replicat repa , exttrail ./dirdat/ea , nodbcheckpoint
'Oracle > etc' 카테고리의 다른 글
DBMS_SCHEDULER (0) | 2022.01.26 |
---|---|
Redefinition (0) | 2022.01.26 |
flashback (0) | 2022.01.26 |
db_link (0) | 2022.01.26 |
compress (0) | 2022.01.26 |