Oracle 19.3 单实例到单实例OGG19.1同步实施文档


1.查看oracle为非CDB模式

https://www.cndba.cn/hbhe0316/article/4756
sys@CXMTDB 21:15:24> select name,CDB from v$database;

NAME          CDB
------------- 
CXMTDB        NO

2.安装前的准备工作
2.1.源端创建GoldenGate用户表空间

sys@CXMTDB 21:23:26> create tablespace ogg_tbs datafile '/oradata/CXMTDB/ogg01.dbf' size 100m autoextend off;

Tablespace created.

2.2.源端创建GoldenGate用户

sys@CXMTDB 21:23:46>  create user oggadmin identified by wwwwww default tablespace ogg_tbs;

User created.

sys@CXMTDB 21:25:07> grant connect,resource,dba,create table,create sequence to oggadmin;

Grant succeeded.

2.3.目标端创建GoldenGate用户表空间

sys@CXMTDB 21:26:21> create tablespace ogg_tbs datafile '/oradata/CXMTDB/ogg01.dbf' size 100m autoextend off;

Tablespace created.

2.4.目标端创建GoldenGate用户表空间https://www.cndba.cn/hbhe0316/article/4756

sys@CXMTDB 21:26:26> create user oggadmin identified by wwwwww default tablespace ogg_tbs;

User created.

sys@CXMTDB 21:27:03> grant connect,resource,dba,create table,create sequence to oggadmin;

Grant succeeded.

2.5.源端创建测试用户及测试数据

sys@CXMTDB 21:25:16> create user hbhe identified by wwwwww;

User created.

sys@CXMTDB 21:28:44> grant connect,resource to hbhe;

Grant succeeded.

sys@CXMTDB 21:31:54> grant select on dba_free_space to hbhe;

Grant succeeded.

sys@CXMTDB 21:31:58> grant select on dba_data_files to hbhe;

Grant succeeded.

sys@CXMTDB 21:32:07> grant select on dba_tablespaces to hbhe;

Grant succeeded.

[oracle@ogg01:/home/oracle]$ sqlplus hbhe/wwwwww

hbhe@CXMTDB 21:39:57> create table t1 (id number(10) primary key ,name varchar(8));

Table created.

hbhe@CXMTDB 21:40:32> insert into t1 values(1,'aaaa');

1 row created.

hbhe@CXMTDB 21:40:36> insert into t1 values(2,'bbbb');

1 row created.

hbhe@CXMTDB 21:40:42> commit;

Commit complete.

2.6.目标端创建测试用户及测试数据

sys@CXMTDB 21:42:21> create user hbhe identified by wwwwww;

User created.

Elapsed: 00:00:00.03
sys@CXMTDB 21:42:38> grant connect,resource to hbhe;

Grant succeeded.

Elapsed: 00:00:00.00

sys@CXMTDB 21:44:21> conn hbhe/wwwwww
Connected.

TABLESPACE_NAME        ALLOC_MB    USED_MB     MAX_MB FREE_OF_MAX_MB USED_OF_MAX_PCT
-------------------- ---------- ---------- ---------- -------------- -----------------------------------------
SYSTEM                      890        890      32768          31878 3%
SYSAUX                      520        495      32768          32273 2%
UNDOTBS1                    345        344      32768          32424 1%
OGG_TBS                     100          1        100             99 1%
USERS                         5          3      32768          32765 0%

Elapsed: 00:00:00.02

no rows selected

hbhe@CXMTDB 21:44:42> create table t1 (id number(10) primary key ,name varchar(8));

Table created.

hbhe@CXMTDB 21:44:51> commit;

Commit complete.

2.7.源端开启归档模式、强制日志、附加日志
2.7.1.查看是否开启归档模式、强制日志、附加日志

sys@CXMTDB 21:53:51> select LOG_MODE, SUPPLEMENTAL_LOG_DATA_MIN,FORCE_LOGGING from v$database;

LOG_MODE     SUPPLEME FORCE_LOGGING
------------ -------- ---------------------------------------
 NO            NO       NO

2.7.2.开启归档

[root@ogg01:/tmp]$ mkdir -p /archivelog
[root@ogg01:/tmp]$ chown -R oracle:oinstall /archivelog
[root@ogg01:/tmp]$ su - oracle
[oracle@ogg01:/home/oracle]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> alter system set log_archive_dest_1='location=/archivelog';
SQL>  archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /archivelog
Oldest online log sequence     7
Next log sequence to archive   9
Current log sequence           9

2.7.3.开启强制日志

sys@CXMTDB 21:59:17> alter database force logging;

Database altered.

2.7.4.开启附加日志

sys@CXMTDB 21:58:33> alter database add supplemental log data;

Database altered.

2.7.5.查看是否开启归档模式、强制日志、附加日志

sys@CXMTDB 22:01:14>  select LOG_MODE, SUPPLEMENTAL_LOG_DATA_MIN,FORCE_LOGGING from v$database;

LOG_MODE     SUPPLEME FORCE_LOGGING
------------ -------- ---------------------------------------
ARCHIVELOG   YES      YES

2.7.6.查看回收站是否关闭

sys@CXMTDB 22:01:27> show parameter recycle

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
buffer_pool_recycle                  string
db_recycle_cache_size                big integer 0
recyclebin                           string      on
sys@CXMTDB 22:02:02> alter system set recyclebin=off scope=spfile; 

System altered.

Elapsed: 00:00:00.02
sys@CXMTDB 22:02:14> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@CXMTDB 22:03:09> startup
ORACLE instance started.

Total System Global Area 3355440576 bytes
Fixed Size                  8902080 bytes
Variable Size             704643072 bytes
Database Buffers         2634022912 bytes
Redo Buffers                7872512 bytes
Database mounted.
Database opened.
sys@CXMTDB 27-SEP-21> show parameter recycle

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
buffer_pool_recycle                  string
db_recycle_cache_size                big integer 0
recyclebin                           string      OFF

3.GoldenGate安装
3.1.源端安装OGG
3.1.1.创建软件安装目录并赋权

[root@ogg01:/tmp]$ mkdir /ogg
[root@ogg01:/tmp]$ chown oracle.oinstall /ogg/

3.1.2 编辑ogg静默安装的静默文件https://www.cndba.cn/hbhe0316/article/4756

[root@ogg01:/tmp]$ cd /tmp
[root@ogg01:/tmp]$ unzip 191004_fbo_ggs_Linux_x64_shiphome.zip
[root@ogg01:/tmp]$ chown -R oracle.oinstall /tmp/fbo_ggs_Linux_x64_shiphome
[root@ogg01 response]# cd /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/response
[root@ogg01 response]# cat oggcore.rsp | grep -Ev '^$|#'
oracle.install.responseFileVersion=/oracle/install/rspfmt_ogginstall_response_schema_v19_1_0
INSTALL_OPTION=ORA19c
SOFTWARE_LOCATION=/ogg
START_MANAGER=
MANAGER_PORT=
DATABASE_LOCATION=
INVENTORY_LOCATION=/u01/app/oraInventory
UNIX_GROUP_NAME=oinstall

3.1.3 静默安装ogghttps://www.cndba.cn/hbhe0316/article/4756https://www.cndba.cn/hbhe0316/article/4756https://www.cndba.cn/hbhe0316/article/4756

[root@ogg01:/]$ su - oracle
[oracle@ogg01:/home/oracle]$ cd /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/
[oracle@ogg01:/tmp/fbo_ggs_Linux_x64_shiphome/Disk1]$ ./runInstaller -silent -nowait -responseFile /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp

3.1.4 设置环境变量

export OGG_HOME=/ogg
export PATH=$PATH:$OGG_HOME
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OGG_HOME
环境变量生效
[oracle@node01 Disk1]$ source ~/.bash_profile

3.1.5 运行ogg并创建目录

[oracle@ogg01:/]$ cd $OGG_HOME
[oracle@ogg01:/ogg]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
GGSCI (ogg01) 1> create subdirs

Creating subdirectories under current directory /ogg

Parameter file                 /ogg/dirprm: created.
Report file                    /ogg/dirrpt: created.
Checkpoint file                /ogg/dirchk: created.
Process status files           /ogg/dirpcs: created.
SQL script files               /ogg/dirsql: created.
Database definitions files     /ogg/dirdef: created.
Extract data files             /ogg/dirdat: created.
Temporary files                /ogg/dirtmp: created.
Credential store files         /ogg/dircrd: created.
Masterkey wallet files         /ogg/dirwlt: created.
Dump files                     /ogg/dirdmp: created.

3.2.目标端安装OGG
3.2.1.创建软件安装目录并赋权

[root@ogg02:/tmp]$ mkdir /ogg
[root@ogg02:/tmp]$ chown oracle.oinstall /ogg/

3.1.2 编辑ogg静默安装的静默文件

[root@ogg02:/tmp]$ cd /tmp
[root@ogg02:/tmp]$ unzip 191004_fbo_ggs_Linux_x64_shiphome.zip
[root@ogg02:/tmp]$ chown -R oracle.oinstall /tmp/fbo_ggs_Linux_x64_shiphome
[root@ogg02 response]# cd /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/response
[root@ogg02 response]# cat oggcore.rsp | grep -Ev '^$|#'
oracle.install.responseFileVersion=/oracle/install/rspfmt_ogginstall_response_schema_v19_1_0
INSTALL_OPTION=ORA19c
SOFTWARE_LOCATION=/ogg
START_MANAGER=
MANAGER_PORT=
DATABASE_LOCATION=
INVENTORY_LOCATION=/u01/app/oraInventory
UNIX_GROUP_NAME=oinstall

3.2.3 静默安装ogghttps://www.cndba.cn/hbhe0316/article/4756

[root@ogg02:/]$ su - oracle
[oracle@ogg02:/home/oracle]$ cd /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/
[oracle@ogg02:/tmp/fbo_ggs_Linux_x64_shiphome/Disk1]$ ./runInstaller -silent -nowait -responseFile /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp

3.2.4 设置环境变量

export OGG_HOME=/ogg
export PATH=$PATH:$OGG_HOME
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OGG_HOME
环境变量生效
[oracle@node01 Disk1]$ source ~/.bash_profile
3.2.5 运行ogg并创建目录
```shell
[oracle@ogg02:/]$ cd $OGG_HOME
[oracle@ogg02:/ogg]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.



GGSCI (ogg02) 1> create subdirs

Creating subdirectories under current directory /ogg

Parameter file                 /ogg/dirprm: created.
Report file                    /ogg/dirrpt: created.
Checkpoint file                /ogg/dirchk: created.
Process status files           /ogg/dirpcs: created.
SQL script files               /ogg/dirsql: created.
Database definitions files     /ogg/dirdef: created.
Extract data files             /ogg/dirdat: created.
Temporary files                /ogg/dirtmp: created.
Credential store files         /ogg/dircrd: created.
Masterkey wallet files         /ogg/dirwlt: created.
Dump files                     /ogg/dirdmp: created.

4.GoldenGate配置
4.1.OGG源端配置
4.1.1.配置mgr进程

GGSCI (ogg01) 2> edit params mgr
GGSCI (ogg01) 3> view param mgr
PORT 7809
GGSCI (ogg01) 4> start mgr
Manager started.
GGSCI (ogg01) 5> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING  
GGSCI (ogg01) 6> sh netstat -ntpl |grep 7809

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::7809                 :::*                    LISTEN      7501/./mgr          


GGSCI (ogg01) 7> sh ps -ef|grep mgr
postfix   1204  1200  0 21:10 ?        00:00:00 qmgr -l -t unix -u
oracle    7501  6967  0 22:30 ?        00:00:00 ./mgr PARAMFILE /ogg/dirprm/mgr.prm REPORTFILE /ogg/dirrpt/MGR.rpt PROCESSID MGR
oracle    7541  6967  0 22:31 pts/0    00:00:00 sh -c ps -ef|grep mgr
oracle    7543  7541  0 22:31 pts/0    00:00:00 grep mgr

4.1.2.添加表级transdata
注意:为了方便这里直接添加整个用户下表级transdata,如果只是同步部分表的,请批量
执行add trandata test.tablename

GGSCI (ogg01 as oggadmin@cxmtdb) 9> info trandata hbhe.t1;

2021-09-27 22:32:29  ERROR   OGG-15122  No viable tables matched specification hbhe.t1;.

GGSCI (ogg01 as oggadmin@cxmtdb) 10>   info trandata hbhe.t1

2021-09-27 22:35:18  INFO    OGG-10471  ***** Oracle Goldengate support information on table HBHE.T1 ***** 
Oracle Goldengate support native capture on table HBHE.T1.
Oracle Goldengate marked following column as key columns on table HBHE.T1: ID.

Logging of supplemental redo log data is disabled for table HBHE.T1.

GGSCI (ogg01 as oggadmin@cxmtdb) 11> add trandata hbhe.*

2021-09-27 22:35:40  INFO    OGG-15132  Logging of supplemental redo data enabled for table HBHE.T1.

2021-09-27 22:35:40  INFO    OGG-15133  TRANDATA for scheduling columns has been added on table HBHE.T1.

2021-09-27 22:35:41  INFO    OGG-15135  TRANDATA for instantiation CSN has been added on table HBHE.T1.

2021-09-27 22:35:41  INFO    OGG-10471  ***** Oracle Goldengate support information on table HBHE.T1 ***** 
Oracle Goldengate support native capture on table HBHE.T1.
Oracle Goldengate marked following column as key columns on table HBHE.T1: ID.

4.1.3.配置extract抽取进程

GGSCI (ogg01 as oggadmin@cxmtdb) 12>  add extract ext1, tranlog, begin now, threads 1
EXTRACT added.


GGSCI (ogg01 as oggadmin@cxmtdb) 13> add exttrail ./dirdat/et, extract ext1
EXTTRAIL added.

GGSCI (ogg01 as oggadmin@cxmtdb) 14> edit params ext1
GGSCI (ogg01 as oggadmin@cxmtdb) 15> view params ext1

EXTRACT ext1
SETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK") --此处数据库字符集设为一致
--SETENV (ORACLE_SID = "cxmtdb")
SETENV (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)
USERID oggadmin, PASSWORD wwwwww
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
EXTTRAIL ./dirdat/et
--DDL INCLUDE ALL
TABLE hbhe.*;

4.1.4.配置pump传输进程

GGSCI (ogg01 as oggadmin@cxmtdb) 16>  add extract pump1,exttrailsource ./dirdat/et,begin now
EXTRACT added.


GGSCI (ogg01 as oggadmin@cxmtdb) 17> add rmttrail ./dirdat/et,extract pump1
RMTTRAIL added.

GGSCI (ogg01 as oggadmin@cxmtdb) 18> edit params pump1
GGSCI (ogg01 as oggadmin@cxmtdb) 19> view params pump1

EXTRACT pump1
RMTHOST 192.168.56.101, MGRPORT 7809
RMTTRAIL ./dirdat/et
PASSTHRU
TABLE hbhe.*;
GGSCI (ogg01 as oggadmin@cxmtdb) 20> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     STOPPED     EXT1        00:00:00      00:05:31    
EXTRACT     STOPPED     PUMP1       00:00:00      00:02:05

4.2.OGG目标端配置
4.2.1.添加GLOBALS参数文件,创新检查点表

GGSCI (ogg02) 2> edit params ./GLOBALS
GGSCI (ogg02) 3> view params ./GLOBALS

GGSCHEMA oggadmin
checkpointtable oggadmin.checkpoint

GGSCI (ogg02) 4> dblogin userid oggadmin,password wwwwww
Successfully logged into database.

GGSCI (ogg02 as oggadmin@cxmtdb) 5> add checkpointtable oggadmin.checkpoint   

Successfully created checkpoint table oggadmin.checkpoint.

4.2.2.配置mgr进程

GGSCI (ogg02 as oggadmin@cxmtdb) 6> edit params mgr
GGSCI (ogg02 as oggadmin@cxmtdb) 7> view params mgr
PORT 7809

GGSCI (ogg02 as oggadmin@cxmtdb) 8> start mgr
Manager started.

GGSCI (ogg02 as oggadmin@cxmtdb) 9> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           

GGSCI (ogg02 as oggadmin@cxmtdb) 10> sh netstat -ntpl |grep 7809

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::7809                 :::*                    LISTEN      7980/./mgr          


GGSCI (ogg02 as oggadmin@cxmtdb) 11> sh ps -ef|grep mgr | grep -v grep

postfix   1229  1225  0 21:11 ?        00:00:00 qmgr -l -t unix -u
oracle    7980  6932  0 22:46 ?        00:00:00 ./mgr PARAMFILE /ogg/dirprm/mgr.prm REPORTFILE /ogg/dirrpt/MGR.rpt PROCESSID MGR

4.2.3.配置replicat复制进程

https://www.cndba.cn/hbhe0316/article/4756
GGSCI (ogg02 as oggadmin@cxmtdb) 12> add replicat rep1, exttrail ./dirdat/et, checkpointtable oggadmin.checkpoint
REPLICAT added.

GGSCI (ogg02 as oggadmin@cxmtdb) 13> edit params rep1
GGSCI (ogg02 as oggadmin@cxmtdb) 14> view params rep1

REPLICAT rep1
setenv (ORACLE_SID=cxmtdb)
SETENV (ORACLE_HOME = "/u01/app/oracle/product/19.3.0/db")
USERID oggadmin,PASSWORD wwwwww
ASSUMETARGETDEFS
HANDLECOLLISIONS
REPERROR (DEFAULT, DISCARD)
DDLERROR DEFAULT DISCARD
DDLOPTIONS REPORT
DISCARDFILE ./dirrpt/repr1.dsc,append,megabytes 100
MAP hbhe.*, TARGET hbhe.*;

5.初始化数据-initial load
5.1.启动源端和目标端的管理进程
—源端启动MGR

GGSCI (ogg01 as oggadmin@cxmtdb) 23> start mgr
Manager started.

GGSCI (ogg01 as oggadmin@cxmtdb) 24> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     STOPPED     EXT1        00:00:00      00:14:29    
EXTRACT     STOPPED     PUMP1       00:00:00      00:11:03

目标端启动MGR

GGSCI (ogg02 as oggadmin@cxmtdb) 17> start mgr
Manager started.

GGSCI (ogg02 as oggadmin@cxmtdb) 18> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    STOPPED     REP1        00:00:00      00:04:39

5.2.源端初始化抽取的配置

GGSCI (ogg01 as oggadmin@cxmtdb) 25> edit params extinit
GGSCI (ogg01 as oggadmin@cxmtdb) 26> view param extinit
EXTRACT extinit
userid oggadmin, password wwwwww
RMTHOST 192.168.56.101 , MGRPORT 7809
RMTTASK replicat,GROUP repinit --目标端replicat
TABLE hbhe.* ;
GGSCI (ogg01) 2> ADD EXTRACT extinit, SOURCEISTABLE
EXTRACT added.

5.3.目标端初始化复制的配置

GGSCI (ogg02 as oggadmin@cxmtdb) 19>  edit params repinit
GGSCI (ogg02 as oggadmin@cxmtdb) 20> view  params repinit

REPLICAT repinit
USERID oggadmin, PASSWORD wwwwww
ASSUMETARGETDEFS
MAP hbhe.* , target hbhe.* ;
---------添加初始化Replicat 进程---------------
GGSCI (ogg02) 2> ADD REPLICAT repinit, SPECIALRUN
REPLICAT added.

5.4.启动源端的EXTRACT进程
期间在启动start ext1的时候抛出错误

2021-09-27T22:58:10.743+0800  ERROR   OGG-00303  Oracle GoldenGate Capture for Oracle, ext1.prm:  Unable to connect to database using user oggadmin. Ensure that the necessary privileges are granted to the user.
                              Operation not supported because enable_goldengate_replication is not set to true.

执行命令

https://www.cndba.cn/hbhe0316/article/4756
sys@CXMTDB 22:59:48> ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION = TRUE;

System altered.
GGSCI (ogg01 as oggadmin@cxmtdb) 27>   start ext1

Sending START request to MANAGER ...
EXTRACT EXT1 starting


GGSCI (ogg01 as oggadmin@cxmtdb) 28> start pump1

Sending START request to MANAGER ...
EXTRACT PUMP1 starting

GGSCI (ogg01 as oggadmin@cxmtdb) 35> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT1        00:21:45      00:00:01    
EXTRACT     RUNNING     PUMP1       00:00:00      00:00:04

5.5.在目标端启动投递进程start rep1

GGSCI (ogg02 as oggadmin@cxmtdb) 23> start rep1

Sending START request to MANAGER ...
REPLICAT REP1 starting

GGSCI (ogg02 as oggadmin@cxmtdb) 24> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    RUNNING     REP1        00:00:00      00:00:01

5.6 目标端关闭

GGSCI (ogg02 as oggadmin@cxmtdb) 25>    SEND REPLICAT rep1, NOHANDLECOLLISIONS

Sending NOHANDLECOLLISIONS request to REPLICAT REP1 ...
No tables found matching * to set NOHANDLECOLLISIONS for REP1.

6.检查同步是否正常

7.开启DDL
7.1.添加参数https://www.cndba.cn/hbhe0316/article/4756

GGSCI (ogg01 as oggadmin@cxmtdb) 45> view params ./GLOBALS
GGSCI (ogg01 as oggadmin@cxmtdb) 47> view params ./GLOBALS

GGSCHEMA oggadmin

7.2.在源端执行与DDL同步相关的SQL脚本
切记@marker_setup.sql 一定要在cd $OGG_HOME目录下执行否则会卡主。执行脚本时要输入ogg管理用户,本实例是oggadmin

cd /ogg
sqlplus / as sysdba
grant execute on utl_file to oggadmin;
@marker_setup.sql
@ddl_setup.sql
@role_setup.sql
grant GGS_GGSUSER_ROLE to oggadmin;
@ddl_enable.sql
@ddl_pin oggadmin
@marker_status

7.3.源端extract 配置

GGSCI (ogg01 as oggadmin@cxmtdb) 48> edit params ext1
GGSCI (ogg01 as oggadmin@cxmtdb) 49> view params ext1

EXTRACT ext1
SETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK") --此处数据库字符集设为一致
--SETENV (ORACLE_SID = "cxmtdb")
SETENV (ORACLE_HOME = /u01/app/oracle/product/19.3.0/db)
USERID oggadmin, PASSWORD wwwwww
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
EXTTRAIL ./dirdat/et
DDL INCLUDE ALL
TABLE hbhe.*;
GGSCI (ogg01 as oggadmin@cxmtdb) 50> stop ext1

Sending STOP request to EXTRACT EXT1 ...
Request processed.

GGSCI (ogg01 as oggadmin@cxmtdb) 51> start ext1

Sending START request to MANAGER ...
EXTRACT EXT1 starting

7.4.目标端replicat 配置

GGSCI (ogg02 as oggadmin@cxmtdb) 27> edit params rep1
GGSCI (ogg02 as oggadmin@cxmtdb) 28> view params rep1

REPLICAT rep1
setenv (ORACLE_SID=cxmtdb)
SETENV (ORACLE_HOME = "/u01/app/oracle/product/19.3.0/db")
USERID oggadmin,PASSWORD wwwwww
--ASSUMETARGETDEFS
HANDLECOLLISIONS
REPERROR (DEFAULT, DISCARD)
DDLERROR DEFAULT DISCARD
DDLOPTIONS REPORT
DISCARDFILE ./dirrpt/repr1.dsc,append,megabytes 100
MAP hbhe.*, TARGET hbhe.*;
ddl include all 
ddlerror default ignore retryop maxretries 3 retrydelay 5
GGSCI (ogg02 as oggadmin@cxmtdb) 29> stop rep1

Sending STOP request to REPLICAT REP1 ...
Request processed.


GGSCI (ogg02 as oggadmin@cxmtdb) 30> 

GGSCI (ogg02 as oggadmin@cxmtdb) 30> 

GGSCI (ogg02 as oggadmin@cxmtdb) 30> start rep1

Sending START request to MANAGER ...
REPLICAT REP1 starting


GGSCI (ogg02 as oggadmin@cxmtdb) 32> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    RUNNING     REP1        00:00:00      00:00:07

7.5.DDL测试

源端创建表
hbhe@CXMTDB 23:29:41> create table t3 (id int) ;

Table created.

Elapsed: 00:00:00.05
hbhe@CXMTDB 23:29:52> insert into t3 values (111);

1 row created.

Elapsed: 00:00:00.00
hbhe@CXMTDB 23:30:04> commit;

Commit complete.

目前端查看表
hbhe@CXMTDB 23:29:12>       select * from t3;

        ID
----------
       111

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux,oracle

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值