OGG 연동 TABLE 누락으로 EXP/IMP/OGG Merge
/*
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-- OGG 연동 TABLE 누락으로 새롭게 추가 작업
--# EXPDP + IMPDP
--# Replicat 신규 생성
--# Replicat merge
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/
select * from dba_tables where table_name like 'TB_DP_COMMENT%';
select count(*) from SPSAC.TB_DP_COMMENT;
--------------------------------------------------------------------------------------------
-- EXPDP+IMPDP
--------------------------------------------------------------------------------------------
select * from dba_Directories;
-- SYS EXP_DIR /DB_MGMT/exp/mig/qa
-- 1 exp@spdb
-- select dbms_flashback.get_system_change_number from dual; -- 12980939775956
-- 실행 중 Transaction 확인
/*
------------------------------------------------------------------------------------------------------------------------
select t.addr, t.xidusn, t.xidslot, t.xidsqn, t.start_time, sid, serial#, username, taddr, used_ublk, used_urec, t.status
, s.username, s.osuser, s.status, s.program, s.sql_id
--, q.sql_fulltext
from v$transaction t, v$session s --, v$sql q
where t.addr = s.taddr(+)
--and s.sql_address = q.address(+)
;
*/
expdp userid='spadmin/**********' directory=exp_dir dumpfile=qa_tb_dp_comment_%u.dmp logfile=qa_tb_dp_comment_exp.log \
parallel=4 content=data_only flashback_scn=12980939775956 \
tables=\
SPSAC.TB_DP_COMMENT
-- 2 imp@spbidb
impdp userid='spadmin/***********' directory=exp_dir dumpfile=qa_tb_dp_comment_%u.dmp logfile=qa_tb_dp_comment_imp.log \
parallel=4 content=data_only transform=disable_archive_logging:y transform=lob_storage:securefile \
tables=\
SPSAC.TB_DP_COMMENT
/*
DATA PUMP JOB 모니터링
-----------------------------------------------
-- 1. 방법
select * from USER_DATAPUMP_JOBS;
select * from DBA_DATAPUMP_SESSIONS;
impdp system/passwd attach=job_name ;
impdp > stop_job immediate
impdp > kill_job
-- 2. 방법
select o.status, o.object_id, o.object_type, o.owner||'.'||object_name "OWNER.OBJECT"
from dba_objects o, dba_datapump_jobs j
where o.owner=j.owner_name
and o.object_name=j.job_name
and j.job_name not like 'BIN$%'
order by 4,2 ;
drop table SPADMIN.SYS_EXPORT_SCHEMA_01 purge;
*/
--------------------------------------------------------------------------------------------
-- 3. ogg replicat 생성
--------------------------------------------------------------------------------------------
--GGSCI (QAs-db03) 2> edit param RS001
REPLICAT rs001
SETENV (NLS_LANG = "AMERICAN_AMERICA.UTF8")
USERID ogg, PASSWORD ********
ASSUMETARGETDEFS
DISCARDFILE ./dirout/rs001.dec, APPEND, megabytes 1000
EOFDELAYCSECS 5
STATOPTIONS RESETREPORTSTATS
REPORT AT 00:00
REPORTROLLOVER AT 00:01
DDLERROR DEFAULT IGNORE RETRYOP
applynoopupdates
MAP SPSAC.TB_DP_COMMENT, TARGET SPSAC.TB_DP_COMMENT ;
--------------------------------------------------------------------------------------------
-- 4 @spbidb : add rep
--------------------------------------------------------------------------------------------
dblogin USERID ogg, PASSWORD ********
add rep rs001 exttrail ./dirdat/ps
start rs001 aftercsn 12980939775956 -- flashback_scn
/*
GGSCI (QAs-db03 as ogg@STGSPBI1) 29> sh ls -ltr dirdat/ps*
-rw-r----- 1 ogg oinstall 1999999877 May 27 04:53 dirdat/ps000000479
-rw-r----- 1 ogg oinstall 1999999903 May 27 06:20 dirdat/ps000000480
-rw-r----- 1 ogg oinstall 1999999887 May 27 06:34 dirdat/ps000000481
-rw-r----- 1 ogg oinstall 1999999616 May 27 06:49 dirdat/ps000000482
-rw-r----- 1 ogg oinstall 1999999783 May 27 07:00 dirdat/ps000000483
-rw-r----- 1 ogg oinstall 1999999681 May 27 07:11 dirdat/ps000000484
-rw-r----- 1 ogg oinstall 1999999826 May 27 07:28 dirdat/ps000000485
-rw-r----- 1 ogg oinstall 1999999934 May 27 07:39 dirdat/ps000000486
-rw-r----- 1 ogg oinstall 1999999823 May 27 07:52 dirdat/ps000000487
...
GGSCI (QAs-db03 as ogg@STGSPBI1) 30> alter rqa01 extseqno 586
GGSCI (QAs-db03 as ogg@STGSPBI1) 31> START RQA01 AFTERCSN 12980939775956
*/
-- 아래와 같이 처리함.
stop rs001
alter rs001 extseqno 5414 <-- expdp 시간보다 이후 시간의 dirdat extseqno 지정함.
start rs001
info RS*
--------------------------------------------------------------------------------------------
-- 5. Replicat merge
--------------------------------------------------------------------------------------------
--# 1. DATA PUMP 전송 프로세스 Stop
--# QAs-db01
ggsci> stop pbi
--# 이하는 QAs-db03
--# 2. Replicat 읽는 위치 확인
--# QAs-db03
--# 프로세스의 RBA 값이 같아 질 때까지 대기(ps0000)
ggsci> info rs001
ggsci> info rssac
--# 3. Replicat Stop
--# <2번> 수행 후 진행
ggsci> stop rs001
ggsci> stop rssac
--# 4. Process 결합
--# rdevca 프로세스에 있는 테이블을 모두 rssac 파라미터에 추가
ggsci> edit param rssac
MAP SPSAC.TB_DP_COMMENT, TARGET SPSAC.TB_DP_COMMENT ;
--# 5. 프로세스 삭제
ggsci> dblogin userid ogg, password ********
delete rs001
--# 6. 프로세스 기동
ggsci> start rssac
--# sp01
ggsci> start pbi