欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

OGG配置DML单向复制一例及错误分析

程序员文章站 2022-04-04 19:45:07
...

通过查看Oracle安装文档中列出的Package Requirements可以查看在不同平台上需要的软件包,下面列出Asianux 3, Oracle Enterprise

环境:11.2.0.3+OEL5.7

192.168.1.55zlm sid:zlm11g

192.168.1.60zlm2 sid:zlm11g

gg软件包:ogg112101_fbo_ggs_Linux_x64_ora11g_64bit

相关阅读:

Oracle DML流程

PL/SQL“ ORA-14551: 无法在查询中执行 DML 操作”解决

MySQL常用DDL、DML、DCL语言整理(附样例)

Oracle基本事务和ForAll执行批量DML练习

Oracle DML语句(insert,update,delete) 回滚开销估算

一、安装OGG软件并配置实验环境

*******

源主库:

*******

1.把gg软件包复制到源主机,2次解压到gg安装目录gg11

[oracle@zlmdb_1]$ cd $OACLE_BASE

[oracle@zlm~]$ ls

接下来请看第2页精彩内容

incremental_hot_database_backup.sh ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip

incremental_hot_database_backup.sh.out orz.sh

[oracle@zlmoracle]$ mkdir gg11

[oracle@zlmoracle]$ cd gg11

[oracle@zlmgg11]$ unzip /home/oracle/ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip

[oracle@zlmgg11]$ ll

total223764

-rw-rw-r--1 oracle oinstall 228556800 Apr 23 2012fbo_ggs_Linux_x64_ora11g_64bit.tar

-rwxrwxrwx1 oracle oinstall 220546 May 2 2012OGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf

-rwxrwxrwx1 oracle oinstall 93696 May 2 2012Oracle GoldenGate 11.2.1.0.1README.doc

-rwxrwxrwx1 oracle oinstall 24390 May 2 2012Oracle GoldenGate 11.2.1.0.1README.txt

[oracle@zlmgg11]$ tar xvoffbo_ggs_Linux_x64_ora11g_64bit.tar

UserExitExamples/

UserExitExamples/ExitDemo_more_recs/

UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX

UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.SOLARIS

UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.LINUX

UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.AIX

UserExitExamples/ExitDemo_more_recs/exitdemo_more_recs.vcproj

UserExitExamples/ExitDemo_more_recs/exitdemo_more_recs.c

UserExitExamples/ExitDemo_more_recs/readme.txt

.............

2.修改环境变量文件.bash_profile,加入OGG的环境变量

export GGHOME=/$ORACLE_BASE/gg11

exportPATH=$ORACLE_BASE/gg11:$ORACLE_HOME/bin:/usr/bin/:$PATH

[oracle@zlmgg11]$ . ~/.bash_profile

[oracle@zlmgg11]$ ggsci

ggsci:error while loading shared libraries: libnnz11.so: cannot open shared objectfile: No such file or directory

由于没有设置LD_LIBRARY_PATH环境变量,所以无法执行ggsci,重新添加到.bash_profile

在环境变量中添加如下命令:

export LD_LIBLARY_PATH=$ORACLE_BASE/gg11:$ORACLE_HOME/lib:$ORACLE_HOME/bin

重新source一下后执行ggsci

[oracle@zlmgg11]$ . ~/.bash_profile

[oracle@zlmgg11]$ ggsci

OracleGoldenGate Command Interpreter for Oracle

Version 11.2.1.0.1OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO

Linux,x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14

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

3.创建OGG专用目录subdirs

GGSCI (zlm)1> create subdirs

Creatingsubdirectories under current directory /u01/app/oracle/gg11

Parameterfiles /u01/app/oracle/gg11/dirprm: already exists

Reportfiles /u01/app/oracle/gg11/dirrpt: created

Checkpointfiles /u01/app/oracle/gg11/dirchk:created

Processstatus files /u01/app/oracle/gg11/dirpcs: created

SQLscript files /u01/app/oracle/gg11/dirsql: created

Databasedefinitions files /u01/app/oracle/gg11/dirdef: created

Extractdata files /u01/app/oracle/gg11/dirdat: created

Temporaryfiles /u01/app/oracle/gg11/dirtmp: created

Stdoutfiles /u01/app/oracle/gg11/dirout: created

4.对源数据库设置补充日志,并开启归档模式和强制归档

SQL>alter database add supplemental log data;

Databasealtered.

SQL>alter system switch logfile;

Systemaltered.

SQL>select supplemental_log_data_min,log_mode,force_logging from v$database;

SUPPLEMELOG_MODE FOR

-------------------- ---

YES ARCHIVELOG NO

SQL> alterdatabase force logging;

Databasealtered.

SQL>select supplemental_log_data_min,log_mode,force_loggingfrom v$database;

SUPPLEMELOG_MODE FOR

-------------------- ---

YES ARCHIVELOG YES

5.编辑源数据库管理进程参数文件

GGSCI(zlm) 1> edit params mgr

Cannotload ICU resource bundle 'ggMessage', error code 2 - No such file or directory

Cannotload ICU resource bundle 'ggMessage', error code 2 - No such file or directory

Aborted

这里报错是因为之前进入ggsci界面是并没有在OGG安装目录,必须要在$GGHOME(如果配置过的话,我这里$GGHOME=/u01/app/oracle/gg11)

[oracle@zlm~]$ cd $ORACLE_BASE/gg11

[oracle@zlmgg11]$ ggsci

OracleGoldenGate Command Interpreter for Oracle

Version 11.2.1.0.1OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO

Linux,x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14

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

GGSCI(zlm) 1> edit params mgr

在mgr中添加入如下一行:(和vi编辑器一样操作)

PORT 7809

OGG配置DML单向复制一例及错误分析