ogg-配置添加新表

源端:192.168.214.145

目标端:192.168.214.139

 

源端

GGSCI (bogon) 1> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT1        00:00:00      00:00:03    
EXTRACT     RUNNING     PUMP1       00:00:00      00:00:01    


GGSCI (bogon) 2> view params mgr

port 7809


GGSCI (bogon) 3> view params ext1

EXTRACT ext1
SETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
--SETENV (ORACLE_SID = "orcl")
SETENV (ORACLE_HOME = /data/oracle/product/11.2.0/db_1)
USERID ogg, PASSWORD ogg
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
EXTTRAIL ./dirdat/et
DYNAMICRESOLUTION
--DDL INCLUDE ALL
TABLE songhongjun.t;
TABLE songhongjun.k;


GGSCI (bogon) 4> view params pump1

EXTRACT pump1
RMTHOST 192.168.214.139, MGRPORT 7809
RMTTRAIL ./dirdat/et
PASSTHRU
DYNAMICRESOLUTION
TABLE songhongjun.t;
TABLE songhongjun.k;

打开表级附加日志

dblogin userid ogg password ogg

add trandata songhongjun.t

add trandata songhongjun.k

 

目标端:

GGSCI (bogon) 2> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    RUNNING     REP1        00:00:00      00:00:05    


GGSCI (bogon) 3> view params mgr

port 7809


GGSCI (bogon) 4> view params rep1

REPLICAT rep1
setenv (ORACLE_SID=orcl)
SETENV (ORACLE_HOME = "/data/oracle/product/11.2.0/db_1")
USERID ogg,PASSWORD ogg
ASSUMETARGETDEFS
HANDLECOLLISIONS
REPERROR (DEFAULT, DISCARD)
DDLERROR DEFAULT DISCARD
DDLOPTIONS REPORT
DISCARDFILE ./dirrpt/repr1.dsc,append,megabytes 100
MAP songhongjun.t, TARGET songhongjun.t;
MAP songhongjun.k, TARGET songhongjun.k;


-------------------------------------------------------------------------------------------------配置init        数据量小可用,大量数据不可用

源端

GGSCI (bogon) 3> view params extinit

EXTRACT extinit
userid ogg , password ogg
RMTHOST 192.168.214.139 , MGRPORT 7809
RMTTASK replicat,GROUP repinit
TABLE songhongjun.t;
TABLE songhongjun.k;

 start extinit

 

目标端:

GGSCI (bogon) 28> view params repinit

REPLICAT repinit
USERID ogg, PASSWORD ogg
ASSUMETARGETDEFS
MAP songhongjun.t , target songhongjun.t ;
MAP songhongjun.k, target songhongjun.k;

 

  • 启动生产端的批量抽取进程start extinit,不需要启动repinit 进程,
  • MGR 会自动启动它,等同步结束,他会自动关闭:
  • 启动生产端的抽取进程start extinit:
  • GGSCI (cndba) 31> start extinit

 

---------------------------------------------------------------------------------------------------------------expdp / impdp 方式同步

源端:

[oracle@bogon ~]$ expdp songhongjun/bagayalu directory=shj_dir  dumpfile=t.bmp  dumpfile=songhongjun flashback_scn=1250236;

Export: Release 11.2.0.1.0 - Production on Mon Jan 18 10:37:15 2021

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "SONGHONGJUN"."SYS_EXPORT_SCHEMA_01":  songhongjun/******** directory=shj_dir dumpfile=t.bmp dumpfile=songhongjun flashback_scn=1250236
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SONGHONGJUN"."K"                           5.460 KB       4 rows
. . exported "SONGHONGJUN"."T"                           5.101 KB      12 rows
Master table "SONGHONGJUN"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SONGHONGJUN.SYS_EXPORT_SCHEMA_01 is:
  /data/oracle/expdpdir/t.bmp
Job "SONGHONGJUN"."SYS_EXPORT_SCHEMA_01" successfully completed at 10:37:54

 

scp shj.dmp 192.168.214.139:/data/oracle/shjdir      拷贝到指定服务器目录

 

目标端:

[oracle@bogon shj_dir]$ impdp songhongjun/bagayalu directory=shj_dir dumpfile=shj.dmp

Import: Release 11.2.0.1.0 - Production on Mon Jan 18 14:34:10 2021

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SONGHONGJUN"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SONGHONGJUN"."SYS_IMPORT_FULL_01":  songhongjun/******** directory=shj_dir dumpfile=shj.dmp
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"SONGHONGJUN" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SONGHONGJUN"."K"                           5.460 KB       4 rows
. . imported "SONGHONGJUN"."T"                           5.101 KB      12 rows
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SONGHONGJUN"."SYS_IMPORT_FULL_01" completed with 1 error(s) at 14:34:14

目标端start replicat xxx,aftercsn xxxxx  启动目标端 rep进程

验证数据

 

posted @ 2021-01-15 10:53  RedArmy  阅读(776)  评论(0编辑  收藏  举报