标签:files dblink exists ddr dig extra duplicate ESS fatal
环境:
RAC1:192.168.56.111 (db版本:12.2.0.1)
RAC2:192.168.56.112 (db版本:12.2.0.1)
DG备库:192.168.56.19 (db版本:12.2.0.1) OGG源库
OGG目标库:192.168.56.166 (db版本:11.2.0.4) OGG目标库
1.停掉从库的复制进程,并删除dirdat目录下的内容
GGSCI (epidb01) 2> stop repep
epidb01-> cd dirdat
epidb01-> rm ep*
2.主库停掉并删除主库的抽取进程
stop extract dpep
stop extract extep
dblogin userid goldengate,password goldengate
delete extract dpep
delete extract extep
3.主库创建抽取和投递进程
GGSCI>edit params dpep
GGSCI>ADD EXTRACT dpep, EXTTRAILSOURCE ./dirdat/ep
GGSCI>ADD RMTTRAIL ./dirdat/ep, EXTRACT dpep, MEGABYTES 100
---dpep参数如下:
extract dpep
userid goldengate, password AACAAAAAAAAAAAKAPATACEHBIGQGCFZCCDIGAEMCQFFBZHVC ,ENCRYPTKEY DEFAULT
RmtHost 192.168.56.166, MgrPort 7819, Compress
RmtTrail ./dirdat/ep
gettruncates
Passthru
table hxl.*;
4.抽取进程
GGSCI>edit params extep
GGSCI>ADD EXTRACT extep, tranlog, begin now, threads 2 ##注意这里虽然dg是单节点的,但是dg的主库是rac环境的,这里必须写对应的节点数
GGSCI>ADD EXTTRAIL ./dirdat/ep, EXTRACT extep, megabytes 100
---extep参数如下:
extract extep
userid goldengate, password AACAAAAAAAAAAAKAPATACEHBIGQGCFZCCDIGAEMCQFFBZHVC ,ENCRYPTKEY DEFAULT
SETENV (ORACLE_SID="dg12c")
SETENV ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK)
exttrail ./dirdat/ep
BR BRINTERVAL 20M
numfiles 5000
warnlongtrans 3h, checkinterval 10m
TRANLOGOPTIONS LOGRETENTION ENABLED
--TRANLOGOPTIONS AltArchiveLogDest /u01/app/oracle/archive_log/
tranlogoptions minefromactivedg
--TRANLOGOPTIONS ASMUSER sys@asmtns_rac01, ASMPASSWORD oracle
--TRANLOGOPTIONS DBLOGREADER
--DDL parameter
DDL &
EXCLUDE INSTR ‘shrink space CHECK‘ &
INCLUDE MAPPED OBJTYPE ‘TABLE‘ &
INCLUDE MAPPED OBJTYPE ‘INDEX‘ &
INCLUDE MAPPED OBJTYPE ‘SEQUENCE‘ &
INCLUDE MAPPED OBJTYPE ‘VIEW‘ &
INCLUDE MAPPED OBJTYPE ‘PROCEDURE‘ &
INCLUDE MAPPED OBJTYPE ‘FUNCTION‘ &
INCLUDE MAPPED OBJTYPE ‘PACKAGE‘
--DDLOPTIONS ADDTRANDATA REPORT
table hxl.tb_ogg_test;
6.删除掉主库上./dirdat目录下的ep开头的文件
[oracle@localhost dirdat]$ cd /goldengate12c/dirdat
[oracle@localhost dirdat]$ rm ep*
7.启动主库的抽取进程
start extep -- 主库
start dpep -- 主库
---------------------------------从库操作-------------------------
1.停掉监听器并杀掉ogg目标库用户下的进程
lsnrctl stop
Select Distinct
‘alter system kill session ‘ || ‘‘‘‘ || b.sid || ‘,‘ ||b.SERIAL# || ‘‘‘;‘ kill_command,
b.Username
From Gv$sql a,
Gv$session b,
Gv$session_Wait c,
Gv$latchholder d,
Gv$locked_Object e,
(Select lk.inst_id,Lk.Sid, Lk.Type, Lt.Name Lock_Name
From Gv$lock Lk,
Gv$lock_Type Lt
Where Lk.Type = Lt.Type
And lk.inst_id = lt.inst_id
Group By lk.inst_id,Lk.Sid, Lk.Type, Lt.Name) f,
(Select Addr,
inst_id,
program,
Sum(Pga_Used_Mem) Pga_Used_Mem,
Sum(Pga_Alloc_Mem) Pga_Alloc_Mem,
Sum(Pga_Freeable_Mem) Pga_Freeable_Mem,
Sum(Pga_Max_Mem) Pga_Max_Mem
From Gv$process
Group By Addr,
inst_id,
program) g,
Gv$sort_Usage h
--Gv$session_Longops Sl
Where a.Sql_Id = b.Sql_Id
And b.Sid = c.Sid
And b.Sid = d.Sid(+)
And b.Sid = e.Session_Id(+)
And b.Sid = f.Sid(+)
And b.Paddr = g.Addr(+)
And b.Saddr = h.Session_Addr(+)
--And b.Sid = Sl.Sid(+)
And b.Status = ‘ACTIVE‘
And b.Username In (‘ogg目标库业务用户‘);
2.从库停掉并删除复制进程
stop replicat repep
dblogin userid goldengate,password goldengate
delete replicat repep
3.配置从库复制进程
>edit params repep
>add replicat repep, exttrail ./dirdat/ep, NODBCHECKPOINT
这里先不启动
--repep参数如下
replicat repep
userid goldengate, password AACAAAAAAAAAAAKAPATACEHBIGQGCFZCCDIGAEMCQFFBZHVC ,ENCRYPTKEY DEFAULT
DiscardFile ./dirrpt/repep.dsc, append, Megabytes 200
gettruncates
AllowNoopUpdates
ASSUMETARGETDEFS
DBOPTIONS SUPPRESSTRIGGERS
DBOPTIONS DEFERREFCONST
HANDLECOLLISIONS
MAP hxl.tb_ogg_test ,TARGET hxl.tb_ogg_test;
DDLERROR 10655 IGNORE
DDLERROR 10636 IGNORE
4.数据初始化
a.查询主库SCN:select current_scn from v$database,然后修改/home/oracle/impdblink.sh脚本
将FLASHBACK_SCN替换为查出来的值,我这里通过dblink查询
SQL> set numw 20;
SQL> select current_scn from v$database@dblink_dg备库; ##这里是备库的scn,好像也可以连接主库查scn
CURRENT_SCN
--------------------
75738330810
b.执行impdb脚本(/home/oracle/impdblink.sh)
epidb01-> cd /home/oracle
nohup ./impdblink.sh > impdblink.out 2>&1 &
该脚本内容如下:
epidb01-> more impdblink.sh
#! /bin/bash
impdp goldengate/goldengate network_link=dblink_dg主库 FLASHBACK_SCN=2149986 directory=DATA_PUMP_DIR EXCLUDE=STATISTICS cluster=n tables=hxl.tb_ogg_test parallel=40 table_exists_action=replace
dblink_dg主库 这里是连接主库的dblink,若是连接备库的tns会报如下错误
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "GOLDENGATE"."SYS_IMPORT_TABLE_03": goldengate/******** network_link=dblink_dg12c FLASHBACK_SCN=2166813 directory=DATA_PUMP_DIR EXCLUDE=STATISTICS cluster=n tables=hxl.tb_ogg_test parallel=40 table_exists_action=replace
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.MAIN [INSERT INTO SYS.KU$_LIST_FILTER_TEMP_2@dblink_dg12c (process_order,duplicate,object_schema,object_name,base_process_order,parent_process_order) SELECT process_order,duplicate,object_schema,object_name,base_process_order,parent_process_order FROM "GOLDENGATE"."SYS_IMPORT_TABLE_03" WHERE process_order = :1]
ORA-08176: consistent read failure; rollback data not available
ORA-02063: preceding line from ORA11G
ORA-02063: preceding 2 lines from DBLINK_DG12C
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPW$WORKER", line 9715
----- PL/SQL Call Stack -----
object line object
handle number name
0xc2a6e0e8 21979 package body SYS.KUPW$WORKER
0xc2a6e0e8 9742 package body SYS.KUPW$WORKER
0xc2a6e0e8 1878 package body SYS.KUPW$WORKER
0xc26cf850 2 anonymous block
Job "GOLDENGATE"."SYS_IMPORT_TABLE_03" stopped due to fatal error at Wed Apr 7 23:34:41 2021 elapsed 0 00:00:01
c.从库启动复制进程
GGSCI>start repep aftercsn 2149986
d.启动从库的监听器
lsnrctl start
备注说明:
1.创建dblink
connect goldengate/goldengate
create public database link dblink_dg备库 connect to goldengate identified by goldengate using ‘dg备库TNS‘;
create public database link dblink_dg主库 connect to goldengate identified by goldengate using ‘dg主库TNS‘;
标签:files dblink exists ddr dig extra duplicate ESS fatal
原文地址:https://www.cnblogs.com/hxlasky/p/14631319.html