1. Environment Introduction

project Environment 1 Environment 2 Environment 2
The operating system CentOS release 6.5 CentOS release 6.5 win7
The IP address 130.9.46.19 130.9.46.220 130.9.46.110
Database and Version ORACLE 11.2.0.1.0 ORACLE 11.2.0.1.0 ORACLE 11.2.0.1.0
Database character set ZHS16GBK ZHS16GBK ZHS16GBK
ORACLE SID ora11 ora11 ora11
Goldengate user ogg ogg ogg
Goldengate version 122020 122020 122020

note

  • Check the Linux operating system version: cat /etc/redhat-release

  • Check the database character set: ‘

  • Default Oracle password

    System The default value is Manager

    Sys Default: Change_on_install as sysdba

2. Install in Linux

For Linux systems that don’t have a graphical interface, we install silently

2.1 installation

  • Download 123014_fBO_GGS_linux_x64_shiphome. zip from the Oracle official website (note that ogG version is strongly bound to Oracle version, so ensure version consistency) and copy the ZIP package to the Linux directory
  • Create a directory
#Create a directory
[root@VTSXN-SHKF java]# mkdir -p /u01/install/ogg/
#Upload decompression media
[root@VTSXN-SHKF java]# unzip 123014_fbo_ggs_Linux_x64_shiphome.zip /u01/install/ogg/
#Enter the directory
[root@VTSXN-SHKF java]# cd /u01/install/ogg/fbo_ggs_Linux_x64_shiphome/Disk1/
#Create the Goldengate directory
[root@VTSXN-SHKF Disk1]# mkdir -p /u01/ogg/12.3.0/oggcore_1/
#Root authority
[root@VTSXN-SHKF Disk1]# chown oracle.oinstall -R /u01/ogg/
#Start the OUI installer
[root@VTSXN-SHKF Disk1]# ./runInstaller 
Copy the code

If monitor reports an error

[oracle@VTSXN-SHKF Disk1]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 34100 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8015 MB    Passed
Checking monitor: must be configured to display at least 256 colors
 >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,
Copy the code

The solution

[oracle@VTSXN-SHKF Disk1]$ su
Password: 
[root@VTSXN-SHKF Disk1]# export DISPLAY=:0.0
[root@VTSXN-SHKF Disk1]# xhost +
access control disabled, clients can connect from any host
[root@VTSXN-SHKF Disk1]# su oracle
Copy the code
  • Silent installation
#Edit the response file
[root@VTSXN-SHKF Disk1]# vi /u01/install/ogg/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp

opyright(c) Oracle Corporation 2017. All rights reserved.     ##
## # #
## Specify values for the variables listed below to customize ##
## your installation. ##
## # #
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## # #
## IMPORTANT NOTE: This file should be secured to have read       ##
## permission only by the oracle user or an administrator who ##
## own this installation to protect any sensitive input values. ##
## # #
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

#-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_ogginstall_response_schema_v12_1_2


## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## # #
## Oracle GoldenGate installation option and details ##
## # #
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

#-------------------------------------------------------------------------------
# Specify the installation option.
# Specify ORA12c for installing Oracle GoldenGate for Oracle Database 12c and
#         ORA11g for installing Oracle GoldenGate for Oracle Database 11g
#-------------------------------------------------------------------------------
INSTALL_OPTION=ORA11g

#-------------------------------------------------------------------------------
# Specify a location to install Oracle GoldenGate
#-------------------------------------------------------------------------------SOFTWARE_LOCATION = / / 12.3.0 / oggcore_1 / u01 / ogg
#-------------------------------------------------------------------------------
# Specify true to start the manager after installation.
#-------------------------------------------------------------------------------
START_MANAGER=

#-------------------------------------------------------------------------------
# Specify a free port within the valid range for the manager process.
# Required only if START_MANAGER is true.
#-------------------------------------------------------------------------------
MANAGER_PORT=

#-------------------------------------------------------------------------------
# Specify the location of the Oracle Database.
# Required only if START_MANAGER is true.
#-------------------------------------------------------------------------------DATABASE_LOCATION = / home/app/oracle/product / 11.2.0 / dbhome_1

## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## # #
## Specify details to Create inventory for Oracle installs ##
## Required only for the first Oracle product install on a system. ##
## # #
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

#-------------------------------------------------------------------------------
# Specify the location which holds the install inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oraInventory

#-------------------------------------------------------------------------------
# Unix group to be set for the inventory directory.
# This parameter is not applicable if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=dba
Copy the code

Note: the contents of UNIX_GROUP_NAME can be viewed by id Oracle

[root@VTSXN-SHKF Disk1]# id oracle uid=501(oracle) gid=5001(dba) groups=5001(dba)

To install

[oracle@VTSXN-SHKF Disk1]$  ./runInstaller -silent -responseFile /u01/install/ogg/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 32717 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8015 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-06-06_01-53-09PM. Please wait.Copy the code

Environment Variable Configuration

[root@VTSXN-SHKF ~]# cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in* :"The $1":*)
            ;;
        *)
            if [ "$2" = "after"];then
                PATH=$PATH:The $1
            else
                PATH=The $1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`id -u`
        UID=`id -ru`
    fi
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
    pathmunge /sbin after
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace"];then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt&& [199]"`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}"! ="$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null 2>&1
        fi
    fi
done

unset i
unset -fPathmunge JAVA_HOME = / usr/Java/jdk1.8 ORACLE_HOME = / home/app/oracle/product / 11.2.0 / dbhome_1 ORACLE_SID = ora11 LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$JAVA_HOME/bin:$ORACLE_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH
Copy the code

2.2 test

Create an OGG user and grant permissions to the user

create user ogg identified by ogg;
grant all privileges to ogg; 
Copy the code

The login

[oracle@VTSXN-SHKF oggcore_1]$./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 12.3.0.1.4 Oggcore_12.3.0.1.0_platforms_180415.0359_fbo Linux, x64, 64bit (Optimized) Oracle 11g on Apr 15 2018 21:16:09 Operating system character set identified as UTF-8. Copyright (C) 1995, 2018, Oracle and/or its affiliates. All rights reserved.Copy the code

If you log in using OGG, the following problems occur:

GGSCI (VTSXN-SHKF) 2> dblogin userid ogg,password ogg

2019-06-06 10:39:44  WARNING OGG-25108  Failed to set the Oracle session tag: ORA-04060: insufficient privileges to execute DBMS_STREAMS.SET_TAG
ORA-06512: at "SYS.DBMS_STREAMS", line 16
ORA-06512: at line 1.
ERROR: Unable to connect to database using user ogg. Ensure that the necessary privileges are granted to the user.
OCI Error ORA (status = 942-ORA-00942: table or view does not exist

Copy the code

Take the practice

grant dba to ogg;
grant all privileges to ogg;

Copy the code

Possible problems with OGG installation

WARNING OGG-01988 Could not find schematrandata function in source database: failed to find function.

Ora-01507:??????

SQL> connect sys/admin as sysdba
Connected.
SQL> archive log list; 
ORA-01507: ??????
SQL> shutdown immediate;
ORA-01507: ??????


ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1620115456 bytes
Fixed Size                  2213816 bytes
Variable Size            1291847752 bytes
Database Buffers          318767104 bytes
Redo Buffers                7286784 bytes
Database mounted.
SQL> alter database open;

Database altered.

SQL> shutdown;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1620115456 bytes
Fixed Size                  2213816 bytes
Variable Size            1291847752 bytes
Database Buffers          318767104 bytes
Redo Buffers                7286784 bytes
Database mounted.
Database opened.
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1973
Current log sequence           1975

Copy the code

To enable OGG to support DDL operations, you need to run several additional scripts. These scripts are available in OGG’s installation directory, and can be found in OGG’s installation directory. If you log in to the database in OGG’s installation directory, you can directly add the name of the script.

*** Could not open error log ggserr.log (error 13,Permission denied) ***

Modify the groups of the ggserr.log file

chown oracle:dba ggserr.log

[oggcore_1]# ./ggsci ./ggsci: error while loading shared libraries: libnnz11.so: cannot open shared object file: No such file or directory

Export LD_LIBRARY_PATH = / home/app/oracle/product / 11.2.0 / dbhome_1 / lib

Default sys password of the Oracle database

connect sys/change_on_install as sysdba

View the database character set

SELECT * from nls_database_parameters

The archive log is burst

[oracle@VTSXN-SHKF dbhome_1]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sat Aug 10 15:34:25 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> connect /as sysdba
Connected to an idle instance.
SQL> create pfile from spfile
  2  ;

File created.

SQL> startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified forRDBMS instance ORACLE instance started. Total System Global Area 1620115456 bytes Fixed Size 2213816 bytes Variable Size  1342179400 bytes Database Buffers 268435456 bytes Redo Buffers 7286784 bytes Database mounted. SQL> show parameter db_recovery_file_dest_size; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_recovery_file_dest_size biginteger 3882M
SQL> select * from v$flash_recovery_area_usage f where f.file_type='ARCHIVE_LOG';

no rows selected

SQL> SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE;

FILE_TYPE            PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE
-------------------- ------------------ -------------------------
NUMBER_OF_FILES
---------------
CONTROL FILE                          0                         0
              0

REDO LOG                              0                         0
              0

ARCHIVED LOG                      99.01                         0
             96


FILE_TYPE            PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE
-------------------- ------------------ -------------------------
NUMBER_OF_FILES
---------------
BACKUP PIECE                          0                         0
              0

IMAGE COPY                            0                         0
              0

FLASHBACK LOG                         0                         0
              0


FILE_TYPE            PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE
-------------------- ------------------ -------------------------
NUMBER_OF_FILES
---------------
FOREIGN ARCHIVED LOG                  0                         0
              0


7 rows selected.

SQL> select * from v$flash_recovery_area_usage f where f.file_type='ARCHIVED_LOG'2; no rows selected SQL> select * from v$flash_recovery_area_usage f where f.file_type='ARCHIVED LOG'; FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE -------------------- ------------------ ------------------------- NUMBER_OF_FILES -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ARCHIVED LOG 99.01 0. 96Copy the code

3. Install in Windows

Foolproof installation, step by step to operate

4. Configure the process

This section describes the OGG process

Oracle GoldenGate consists of the following components

Low Extract

Low Data pump

Low Trails

Low Collector

Low Replicat

When the Manager

Oracle GoldenGate data replication process is as follows:

Use the Extract Process to read Online Redo logs or Archive logs in the source database and parse them to Extract only the changes in the data, such as DML operations — add, delete, modify operations. The extracted information is converted to GoldenGate’s custom intermediate format and stored in the Trail file. Then the transport process sends the trail file to the target system via TCP/IP.

The Server Collector receives the data changes from the source and caches them into the GoldenGate trail file, which is then read by the replication process on the target.

GoldenGate Replicat process reads the data change information from trail file, creates the corresponding SQL statement, executes it through the local interface of the database, submits it to the target database, and updates its checkpoint after the submission is successful. Record the location where the replication has been completed, and the data replication process is finally complete.

Note:

  • Edit the GLOBALS parameter file, switch to the GoldenGate installation directory, and run the following command:

GGSCI>EDIT PARAMS ./GLOBALS

Add the following (optional) to the file:

  • Using the default key, generate ciphertext:

GGSCI>encrypt password ogg encryptkey default

Encrypted password: AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB

Record this ciphertext, which will be used in the following process parameter configuration.

4.1 Adding table-level TRANDATA to the source End

Add trandata to the table, which user’s table needs to be synchronized with the target library. In fact, add supplemental Log to the table, but this only takes effect after opening minimal Supplemental log above.

Log in to the source database as user OGG.

GGSCI (dbdream) 2> DBLOGIN USERID ogg, PASSWORD ogg

Successfully logged into database.
Copy the code

Add table level TRANDATA at the source end. In this case, use EMP_OGG and DEPT_OGG tables.

GGSCI (dbdream) 3> add trandata scott.emp_ogg

Logging of supplemental redo data enabled for table SCOTT.EMP_OGG.

GGSCI (dbdream) 4> add trandata scott.dept_ogg

Logging of supplemental redo data enabled for table SCOTT.DEPT_OGG.
Copy the code

After successfully adding table-level TRANDATA, you can use the INFO command to see which tables have TRANDATA added.

GGSCI (dbdream) 5> INFO TRANDATA scott.* Logging of supplemental redo log data is disabled for table SCOTT.BONUS. Logging of supplemental redo log data is disabled for table SCOTT.DEPT. Logging of supplemental redo log data is enabled  for table SCOTT.DEPT_OGG. Columns supplementally logged for table SCOTT.DEPT_OGG: DEPTNO. Logging of supplemental redo log data is disabled for table SCOTT.EMP. Logging of supplemental redo log data is enabled for table SCOTT.EMP_OGG. Columns supplementally logged for table SCOTT.EMP_OGG: SAL, HIREDATE, MGR, COMM, DEPTNO, ENAME, EMPNO, JOB. Logging of supplemental redo log data is disabled for table SCOTT.SALGRADE.Copy the code

4.2 Configuring the MGR Management process

The source side:

GGSCI (dbdream) 8> EDIT PARAMS MGR

#Add three lines
PORT 7809
PURGEOLDEXTRACTS /ogg/dirdat, USECHECKPOINTS
userid ogg, password AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKY default
Copy the code

End goals:

GGSCI (stream) 2> EDIT PARAMS MGR

#Add the following three lines
PORT 7809
PURGEOLDEXTRACTS /ogg/dirdat, USECHECKPOINTS
userid ogg, password AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKY default
Copy the code

Parameter Description:

PORT 7809: indicates the PORT monitored by the OGG management process.

PURGEOLDEXTRACTS: Deletes unwanted TRAIL files.

/ogg/dirdat: trail file location.

USECHECKPOINTS: Use checkpoint queues.

Password: indicates the encrypted password

Only the above parameters are used in this experiment. Other parameters of MGR are shown in the table below, extracted from the official OGG document.

Manager parameters: General

The name use
CHARSET Specifies a multibyte character set for the process to usinstead of the operating system default when reading theparameter file.
COMMENT Allows insertion of comments in a parameter file.
SOURCEDB Specifies a data source name as part of the login
USERID Provides login information for Manager when it needs toaccess the database.
SYSLOG Filters the types of Oracle GoldenGate messages that arewritten to the system logs.

Manager parameters: Port management

The name use
DYNAMICPORTLIST Specifies the ports that Collector can dynamically allocate.
PORT Establishes the TCP/IP port number on which Manager listensfor requests.

Manager parameters: Process management

The name use
AUTORESTART Specifies processes to be restarted by Manager after a
AUTOSTART Specifies processes to be started when Manager starts.
BOOTDELAYMINUTES Determines how long after system boot time Manager delaysuntil performing main processing activities. This parametersupports Windows.
UPREPORT Determines how often process heartbeat messages are reported.

Manager parameters: Event management

The name use
DOWNCRITICAL Reports processes that stopped gracefully or abnormally.
DOWNREPORT Controls the frequency for reporting stopped processes.
LAGCRITICAL Specifies a lag threshold that is considered critical andgenerates a warning to the error log.
LAGINFO Specifies a lag threshold at which an informational messageis reported to the error log.
LAGREPORT Sets an interval for reporting lag time to the error log.

Manager parameters: Maintenance

The name use
CHECKMINUTES Determines how often Manager cycles through maintenance
PURGEDDLHISTORY Purges rows from the Oracle DDL history table when they areno longer needed.
PURGEDDLHISTORYALT Purges rows from the alternate Oracle DDL history table thatkeeps track of partition IDs that are associated with atable ID.
PURGEMARKERHISTORY Purges Oracle marker table rows that are no longer needed.
PURGEOLDEXTRACTS Purges trail data that is no longer needed.
PURGEOLDTASKS Purges Extract and Replicat tasks after a specified periodof time.
STARTUPVALIDATIONDELAY[CSECS] Sets a delay time after which Manager checks that processesare still running after startup.

After configuring the MGR manager process, you can start the MGR manager process (both the source and target ends need to be started).

GGSCI (dbdream) 9> start mgr
Manager started.
Copy the code

GGSCI (dbdream) 9> start mgr

Manager started.

You can use the INFO command to check the status of the process (preferably at both ends of each startup).

GGSCI (dbdream) 10> info mgr

Manager is running (IP port dbdream.7809).

4.3 Configuring the Initialization Process

4.3.1 Extract Process Configuration at the source End

The test table at the source end has data, while the test table at the target end has only structure and no data, so it needs to initialize the data at the target end. The so-called initialization means that the data at the target end and the data at the source end are exactly the same at this point in time, so the initialization does not need to use OGG. You can also use other tools such as EXP, EXPDP, and SQLLOAD. This article describes how to use OGG to initialize data, and configure the capture process EINI_1 on the source end.

GGSCI (dbdream) 11> ADD EXTRACT EINI_1, SOURCEISTABLE

EXTRACT added.
Copy the code

Check the EINI_1 process status.

GGSCI (dbdream) 12> INFO EXTRACT *, TASKS

EXTRACT    EINI_1    Initialized   2012-11-13 22:45   Status STOPPED

Checkpoint Lag       Not Available

Log Read Checkpoint  Not Available

First Record         Record 0

Task                 SOURCEISTABLE
Copy the code

Because only the capture process EINI_1 was added, the process has not been configured and started, so it is now in the STOPPED state.

The source side edits the capture process EINI_1.

GGSCI (dbdream) 13> EDIT PARAMS EINI_1
Copy the code

– Add the following content

EXTRACT EINI_1 SETENV (NLS_LANG= american_america.zhs16gbk) USERID ogg, PASSWORD ogg RMTHOST 192.168.249.99, MGRPORT 7809 RMTTASK REPLICAT, GROUP RINI_1 TABLE scott.EMP_OGG; TABLE scott.DEPT_OGG;Copy the code

Parameter Description:

EXTRACT EINI_1: Indicates that this is the EXTRACT process with the name EINI_1

SETENV: The environment variable must be set to the same character set as the database character set, otherwise it may be garbled

USERID: OGG user of the database

PASSWORD: indicates the PASSWORD of database user OGG

RMTHOST: indicates the address of the target end. If resolution has been set in the /etc/hosts file, the host name can be written

MGRPORT: port listened by the MGR management process on the target end

RMTTASK REPLICAT: indicates the group and name of the target REPLICAT application process

TABLE: the name of the TABLE from which data is to be initialized at the source end

After the capture process EINI_1 is edited, a REPLICAT application process must be configured on the target end. The name of the REPLICAT application process must be the same as that of the RMTTASK REPLICAT parameter in the capture process EINI_1 on the source end.

4.3.2 Replicat configuration on the target end

End goals:

GGSCI (stream) 7> EDIT PARAMS RINI_1

– Add the following content

REPLICAT RINI_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

ASSUMETARGETDEFS

USERID ogg, PASSWORD ogg

DISCARDFILE /ogg/dirrpt/RINIaa.dsc, PURGE

MAP scott., TARGET scott.;

Parameter Description:

REPLICAT RINI_1: Indicates that this is a REPLICAT application process. The name is RINI_1

SETENV: language variable, same as capture process EINI_1

ASSUMETARGETDEFS: This command tells OGG that the structure of the table to be synchronized between the target end and source end is the same, and OGG does not need to check the structure of the table, including the table name, field name, field type, and field length. If the structure of the table to be synchronized between the target end and source end is different, use the SOURCEDEFS parameter. For details, see the official OGG document.

USERID, PASSWORD: same as capture process EINI_1 parameter description

DISCARDFILE: indicates the location and naming rule of error information

MAP: the name of the table captured at the source end

TARGET: indicates the name of the table to be synchronized at the TARGET end.

4.3.3 Initializing Data

After configuring the application process RINI_1 on the target end, you can start the capture process on the source end to capture data. The application process RINI_1 on the target end does not need to be manually started.

GGSCI (dbdream) 14> START EXTRACT EINI_1

Sending START request to MANAGER…

EXTRACT EINI_1 starting

After the EINI_1 process on the source end is started, data on the source end is normally transmitted to the target end (if the configuration is correct). You can run the VIEW command to VIEW the working status of EINI_1 process on the source end.

GGSCI (dbdream) 11> VIEW REPORT EINI_1

— You’ll see it at the end

Output to RINI_1:

From Table SCOTT.EMP_OGG:

# inserts: 14

# updates: 0

# deletes: 0

# discards: 0

From Table SCOTT.DEPT_OGG:

# inserts: 4

# updates: 0

# deletes: 0

# discards: 0

REDO Log Statistics

Bytes parsed 0

Bytes output 3056

If the configuration is correct, you will see the above log. The log will tell you that on the target side scott. EMP_OGG table INSERT 14 records, scott. DEPT_OGG table INSERT 4 records. If an ERROR occurs in the last part of the above log, you need to check the ggserr.log in the installation directory of OGG, which is equivalent to the alarm log of the database.

4.3.4 Verifying initialization Data

Log in to the target database and check whether the initialization is successful.

After initialization, the initialization processes mentioned above (EINI_1, RINI_1) are stopped automatically, because normally the data initialization work is done only once. You can run the INFO command to check the process status.

The source side:

GGSCI (dbdream) 9> INFO EXTRACT EINI_1

EXTRACT EINI_1 Last Started 2012-11-14 02:03 Status STOPPED

Checkpoint Lag Not Available

Log Read Checkpoint Table SCOTT.DEPT_OGG

2012-11-14 02:03:22 Record 4

Task SOURCEISTABLE

End goals:

GGSCI (stream) 1> INFO REPLICAT RINI_1

REPLICAT RINI_1 Initialized 2012-11-14 20:30 Status STOPPED

Checkpoint Lag 00:00:00 (updated 03:16:37 ago)

Log Read Checkpoint Not Available

Task SPECIALRUN

4.4 Configuring checkpoints

Purpose: In order to make OGG in the case of network interruption, server downtime, power failure can be correctly continued

Both the source and target ends need to be configured.

GGSCI (stream) 2> EDIT PARAMS ./GLOBALS

– Add the following information

CHECKPOINTTABLE ogg.ggschkpt

This tells OGG that the checkpoint is stored in the GGSCHKPT table under OGG user, but you also need to log in to the database as OGG user to create the checkpoint table. In this case, you need to log out of OGG and re-log in, otherwise you may encounter the following error.

GGSCI (stream) 4> ADD CHECKPOINTTABLE

ERROR: Missing checkpoint table specification.

Log out of OGG, re-log in, and log in to the database as the OGG user on both the source and target ends.

GGSCI (stream) 5> exit

[ogg@stream ogg]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 11.2.1.0.1 OGGCORE_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 (stream) 1> dblogin userid ogg,password ogg

Successfully logged into database.

Run the ADD CHECKPOINTTABLE command, and OGG automatically creates checkpoints on both the source and target ORACLE users.

GGSCI (stream) 2> ADD CHECKPOINTTABLE

No checkpoint table specified, using GLOBALS specification (ogg.ggschkpt)…

Successfully created checkpoint table ogg.ggschkpt.

At this point, log in to the database with OGG and you can see the checkpoint table created by OGG.

4.5 Source Extract Process

Now configure the capture process on the source side.

GGSCI (dbdream) 10> EDIT PARAMS EORA_1

– Add the following content

EXTRACT EORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD ogg

EXTTRAIL /ogg/dirdat/aa

TABLE scott.EMP_OGG;

Parameter Description:

The EXTTRAIL parameter is the path and naming format of the TRAIL queue file. The TRAIL file can be understood as the log file captured by the capture process. At this point, you also need to add the capture process EORA_1 to OGG.

GGSCI (dbdream) 11> ADD EXTRACT EORA_1, TRANLOG, BEGIN NOW

EXTRACT added.

GGSCI (dbdream) 12> ADD EXTTRAIL /ogg/dirdat/aa, EXTRACT EORA_1, MEGABYTES 5

EXTTRAIL added.

The two names above tell OGG that the capture process starts to capture from the start, save the capture data to the TRAIL file, the path of the TRAIL file, the naming format, and the maximum size of a single TRAIL file.

You are now ready to start the source capture process EORA_1.

GGSCI (dbdream) 13> START EXTRACT EORA_1

Sending START request to MANAGER…

EXTRACT EORA_1 starting

Run the INFO command to check whether the EORA_1 process is RUNNING.

GGSCI (dbdream) 14> INFO EXTRACT EORA_1

EXTRACT EORA_1 Last Started 2012-11-14 02:06 Status RUNNING

Checkpoint Lag 00:00:58 (updated 00:00:08 ago)

Log Read Checkpoint Oracle Redo Logs

2012-11-14 02:05:58 Seqno 19, RBA 38097424

SCN 0.0 (0)

4.6 Source Pump Process

If the transport process is not configured, OGG will transfer TRAIL queue files through the EXTRACT process, but as with checkpoint queues, it is recommended to configure the PUMP transport process to ensure breakpoint continuations to ORACLE.

GGSCI (dbdream) 15> EDIT PARAMS PORA_1

– Add the following content

EXTRACT PORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

PASSTHRU

RMTHOST 192.168.249.99, MGRPORT 7809

RMTTRAIL /ogg/dirdat/pa

TABLE scott.EMP_OGG;

TABLE scott.DEPT_OGG;

Add PUMP process PORA_1 to OGG and specify the local TRAIL file.

GGSCI (dbdream) 16> ADD EXTRACT PORA_1, EXTTRAILSOURCE /ogg/dirdat/aa

EXTRACT added.

Run the INFO command to view the PORA_1 status of the PUMP process.

GGSCI (dbdream) 17> INFO EXTRACT PORA_1

EXTRACT PORA_1 Initialized 2012-11-14 02:10 Status STOPPED

Checkpoint Lag 00:00:00 (updated 00:00:10 ago)

Log Read Checkpoint File /ogg/dirdat/aa000000

First Record RBA 0

For PUMP process PORA_1, specify the name of the local TRAIL file that will be transferred to the destination and saved as the destination TRAIL file.

GGSCI (dbdream) 18> ADD RMTTRAIL /ogg/dirdat/pa, EXTRACT PORA_1, MEGABYTES 5

RMTTRAIL added.

Start the PUMP process PORA_1 and check the status of PORA_1.

GGSCI (dbdream) 19> START EXTRACT PORA_1

Sending START request to MANAGER…

EXTRACT PORA_1 starting

– Viewing the status

GGSCI (dbdream) 20> INFO EXTRACT PORA_1

EXTRACT PORA_1 Last Started 2012-11-14 02:11 Status RUNNING

Checkpoint Lag 00:00:00 (updated 00:00:03 ago)

Log Read Checkpoint File /ogg/dirdat/aa000000

First Record RBA 0

In the /ogg/dirdat/ directory on the target end, you can see the TRAIL file transferred from the source PUMP process PORA_1.

[ogg@stream dirdat]$ pwd

/ogg/dirdat

[ogg@stream dirdat]$ ls

pa000000

[ogg@stream dirdat]$

4.7 REPLICAT is the synchronization process on the target end

GGSCI (stream) 5> ADD REPLICAT RORA_1, SPECIALRUN

REPLICAT added.

The target edits the RORA_1 process.

GGSCI (stream) 7> EDIT PARAMS RORA_1

– Add the following content

REPLICAT RORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD ogg

HANDLECOLLISIONS

ASSUMETARGETDEFS

DISCARDFILE /ogg/dirrpt/RORA_aa.DSC, PURGE

MAP scott.emp_ogg, TARGET scott.emp_ogg;

After the RORA_1 synchronization process is edited on the target end, the RORA_1 process can be started.

GGSCI (stream) 5> START REPLICAT RORA_1

Sending START request to MANAGER…

REPLICAT RORA_1 starting

Check the RORA_1 process status after it is started.

GGSCI (stream) 6> INFO REPLICAT RORA_1=

REPLICAT RORA_1 Last Started 2012-11-15 00:08 Status RUNNING

Checkpoint Lag 00:00:00 (updated 00:00:05 ago)

Log Read Checkpoint File /ogg/dirdat/pa000000

First Record RBA 0

5. To summarize

The installation process of OGG is quite troublesome and may encounter various problems. When these problems occur, go to the Internet to search the official documents and check the official website to solve their problems faster.

The existence of various domestic blog explanation is not clear, operation omission and other problems, not credulous

6. Reference documents

  1. Ogg Oracle
  2. Ogg Oracle official document
  3. “OGG 01” Windows 7 configuration Oracle GoldenGate trampling guide
  4. OGG basic knowledge collation – Cloud habitat community – Ali Cloud
  5. Oracle Golden Date(OGG) setup and management
  6. OGG is used to realize one-way synchronization between Oracle database and MySQL database

Think it’s good. Please give it a thumbs up