Overview
In the RAC environment to configure Ogg, in order to achieve the RAC node failure, Ogg can automatically failover to the normal node, to ensure that two points:
1. ogg's CHECKPOINT,TRAIL,BR file is placed on the shared cluster file system, and the RAC nodes can access the
2. Cluster software is required to monitor the Ogg process and automatically restart Ogg (failover) on the normal node in the event of a failure
Oracle Grid Infrastructure Standalone Agents (XAG), with Oracle-supported cluster file system, can implement Ogg's automatic failover, this article describes the relevant configuration steps.
Component and version requirements
To use XAG to implement automatic failover, the software version must meet the requirements:
As for clustered file systems, the recommendations of Oracle's official documentation are ACFS,DBFS and OCFS, and I think other clustered file systems, such as the Veritas Cluster file system, should also be available.
The example used in this article is ACFS.
Test environment software version
Source-side database: 11.2.0.4 RAC (ASM)
Target-side database: 12.1.0.2 RAC (ASM)
goldengate:12.2.0.1.1
Operating system: Both source and target end are Oracle Enterprise Linux 6.5 (64bit)
Configuring the steps to install GI XAG
Xag need to go to the Oracle website to download the installation, download location: http://www.oracle.com/technetwork/database/database-technologies/clusterware/ Downloads/index.html
The current version is 7 and the file is Xagpack_7b.zip
Unzip the file, and then use the GI installation user (typically "grid") to perform the xagsetup.sh installation:
[Email protected]c1 xag]$/xagsetup.sh--install--directory/u01/app/grid/xaghome--all_nodes
Installing Oracle Grid Infrastructure Agents on:rac1
Installing Oracle Grid Infrastructure Agents ON:RAC2
Done.
The XAG is also installed on the target side, the same method as the source side.
SOURCE side (11.2) Create Acfs
11.2.0.4 on Oel If you want to use ACFS, you must install the PSU patch to 11.2.0.4.4 above. The patch process is skipped.
The property values for the disk group using ACFS compatible.asm and COMPATIBLE.ADVM must be set to 11.2:
To create a ACFS volume using Asmcmd or ASMCA:
Create a generic Acfs
At this time Acfs is not managed by CRS, you can use the Asmcmd volinfo command or/sbin/acfsutil registry to view ACFS information
Asmcmd> Volinfo-a
DiskGroup Name:data
Volume NAME:VOLOGG1
Volume Device:/dev/asm/vologg1-426
State:enabled
Size (MB): 3072
Resize Unit (MB): 32
Redundancy:unprot
Stripe columns:4
Stripe Width (K): 128
Usage:acfs
Mountpath:/u01/app/grid/acfsmounts/data_vol1
[Email protected] ~]#/sbin/acfsutil Registry
Mount Object:
Device:/dev/asm/vologg1-426
Mount Point:/u01/app/grid/acfsmounts/data_vol1
Disk Group:data
Volume:vologg1
Options:none
Nodes:all
The source (11.2) registers the ACFS with the CRS
First remove the entry for the ACFS we just created from the registration information of the general ACFS
[Email protected] ~]#/sbin/acfsutil registry-d/u01/app/grid/acfsmounts/data_vol1
Acfsutil registry:successfully removed ACFS mount Point/u01/app/grid/acfsmounts/data_vol1 from Oracle Registry
Then, use the Srvctl tool for CRS resource registration:
[Email protected] ~]#/u01/app/11.2.0/grid/bin/srvctl add filesystem-d/dev/asm/vologg1-426-v vologg1-g data-m/u01/a Pp/grid/acfsmounts/data_vol1-u Grid
[Email protected] ~]#/u01/app/11.2.0/grid/bin/crsctl status resource-t
--------------------------------------------------------------------------------
NAME TARGET State SERVER State_details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
Ora. Data.dg
Online online Rac1
Online online Rac2
Ora. Listener.lsnr
Online online Rac1
Online online Rac2
Ora.asm
Online online Rac1 Started
Online online Rac2 Started
Ora.data.vologg1.acfs
OFFLINE OFFLINE Rac1
OFFLINE OFFLINE RAC2
Ora.gsd
OFFLINE OFFLINE Rac1
OFFLINE OFFLINE RAC2
Ora.net1.network
Online online Rac1
Online online Rac2
Ora.ons
Online online Rac1
Online online Rac2
--------------------------------------------------------------------------------
Manually start the resource (Mount ACFS)
[Email protected] ~]#/u01/app/11.2.0/grid/bin/srvctl start filesystem-d/dev/asm/vologg1-426
[Email protected] ~]#
[Email protected] ~]#/u01/app/11.2.0/grid/bin/crsctl status resource-t
--------------------------------------------------------------------------------
NAME TARGET State SERVER State_details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
Ora. Data.dg
Online online Rac1
Online online Rac2
Ora. Listener.lsnr
Online online Rac1
Online online Rac2
Ora.asm
Online online Rac1 Started
Online online Rac2 Started
Ora.data.vologg1.acfs
Online online Rac1 mounted On/u01/app/grid/acfsmounts/dat a_vol1
Online online RAC2 mounted On/u01/app/grid/acfsmounts/dat a_vol1
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_rac1-lv_root 45G 32G 12G 74%/
Tmpfs 2.0G 437M 1.6G 23%/DEV/SHM
/DEV/SDA1 477M 55M 397M 13%/boot
/dev/asm/vologg1-426 3.0G 83M 3.0G 3%/u01/app/grid/acfsmounts/data_vol1
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_rac1-lv_root 45G 25G 19G 58%/
Tmpfs 2.0G 440M 1.6G 23%/DEV/SHM
/DEV/SDA1 477M 55M 397M 13%/boot
/dev/asm/vologg1-426 3.0G 83M 3.0G 3%/u01/app/grid/acfsmounts/data_vol1
Target side (12.1) Create ACFS and register
The main difference between the 12c creation of ACFS and 11g is that, without the option of the universal and database home file system, the creation will generate a script that registers the file system to CRS.
Run the system-generated script to complete the registration and mount:
[Email protected] scripts]#./acfs_script.sh
ACFS file system/u01/app/grid/acfsmounts/ogg_vol1 is mounted on nodes OEL65VM11,OEL65VM12
To view resource information:
[Email protected] bin]#/crsctl status resource-t
--------------------------------------------------------------------------------
Name Target State Server State Details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
Ora. DATA. Vologg2.advm
Online online Oel65vm11 STABLE
Online online Oel65vm12 STABLE
Ora. Data.dg
Online online Oel65vm11 STABLE
Online online Oel65vm12 STABLE
Ora. Listener.lsnr
Online online Oel65vm11 STABLE
Online online Oel65vm12 STABLE
Ora.asm
Online online Oel65vm11 started,stable
Online online Oel65vm12 started,stable
Ora.data.vologg2.acfs
Online online OEL65VM11 mounted on/u01/app/grid/acfsmounts/ogg_vol1,stable
Online online OEL65VM12 mounted on/u01/app/grid/acfsmounts/ogg_vol1,stable
Ora.net1.network
Online online Oel65vm11 STABLE
Online online Oel65vm12 STABLE
Ora.ons
Online online Oel65vm11 STABLE
Online online Oel65vm12 STABLE
Note that all nodes must turn off SELinux, otherwise there will be an error that ACFS does not have permission to write.
Installing Oracle GoldenGate
This version of Ogg supports both 11g and 12c databases, and when installed in the graphical interface, users can select the Ogg that corresponds to different database versions
Install Ogg on the ACFS that you created earlier:
SOURCE Side Installation Location:/u01/app/grid/acfsmounts/data_vol1/ogg12
Target End Installation Location:/u01/app/grid/acfsmounts/ogg_vol1/ogg12
Select automatically start the manager process.
Database Preparation Work
L Change the source-side database to archive mode, the process is omitted.
L Source-side database to increase the relevant log and modify parameters:
sql> ALTER DATABASE ADD supplemental LOG DATA;
Database altered.
sql> ALTER DATABASE Force LOGGING;
Database altered.
Sql> SELECT supplemental_log_data_min, force_logging from V$database;
Suppleme force_logging
-------- ---------------------------------------
Yes Yes
sql> ALTER SYSTEM SWITCH LOGFILE;
System altered.
Sql> alter system set enable_goldengate_replication=true;
System altered.
L CREATE the Ogg database user and authorization on the source and target side, the user created in my example is Ggadm.
The permissions required by the Ogg user can be found in the online documentation Section 4.1.4.1 Oracle 11 Installing and configuring Oracle GoldenGate for Oracle Database 12c (12.2.0.1). 2.0.4 or later Database privileges, we have this test for convenience, grant the user the DBA role, and authorization to use a specific System package:
Sql> BEGIN
Dbms_goldengate_auth.grant_admin_privilege
2 3 (
grantee = ' Ggadm ',
Privilege_type = ' CAPTURE ',
Grant_select_privileges = TRUE
);
END;
/4 5 6 7 8 9
PL/SQL procedure successfully completed.
Source-side Ogg settings
L Login Database:
Ggsci (rac1.hthorizontest.com) 1> dblogin userid ggadm password Ggadm
Successfully logged into database.
L Register an integrated extraction
Ggsci (rac1.hthorizontest.com as [email protected]) 2> register extract EXT1 database;
2016-04-07 23:44:38 INFO OGG-02003 Extract EXT1 successfully registered with database at SCN 1291634.
L Increase the extraction process
Ggsci (rac1.hthorizontest.com as [email protected]) 3> ADD EXTRACT ext1 INTEGRATED tranlog, BEGIN now
EXTRACT (Integrated) added.
Ggsci (rac1.hthorizontest.com as [email protected]) 4> ADD Exttrail/u01/app/grid/acfsmounts/data_vol1/ogg12/dirdat /et, EXTRACT Ext1
Exttrail added.
L Increase the transfer process
Ggsci (rac1.hthorizontest.com as [email protected]) 5> ADD EXTRACT pump1 exttrailsource/u01/app/grid/acfsmounts/data _vol1/ogg12/dirdat/et
EXTRACT added.
Ggsci (rac1.hthorizontest.com as [email protected]) 6>edit PARAMS EXT1
Add the following content:
EXTRACT Ext1
USERID Ggadm, PASSWORD ggadm
Tranlogoptions INTEGRATED PARAMS (max_sga_size 100)
Exttrail/u01/app/grid/acfsmounts/data_vol1/ogg12/dirdat/et
TABLE test.*;
Ggsci (rac1.hthorizontest.com as [email protected]) 7>edit PARAMS PUMP1
Add the following content:
EXTRACT PUMP1
USERID Ggadm, PASSWORD ggadm
Rmthost 192.168.0.11, Mgrport 7809
Rmttrail/u01/app/grid/acfsmounts/ogg_vol1/ogg12/dirdat/rt
TABLE test.*;
Then start all processes.
In the 11.2.0.4 version, if you implement integrated capture mode, you will be prompted to install patch 17030189 when you start the extraction process, mainly because you need to modify the data dictionary table by using integrated capture.
However, once the PSU is installed, it can sometimes cause this patch to conflict with other patches, or it may be possible to manually execute PRVTLMPG.PLB to resolve the problem.
(EXTRACT abending with OGG-02912 (Doc ID 2091679.1))
Target-side Ogg settings
Ggsci (oel65vm11.hthorizon.com) 8> dblogin userid ggadm password Ggadm
Successfully logged into database.
Ggsci (oel65vm11.hthorizon.com as [email protected]) 9>add checkpointtable Ggadm.checkpointtab
Successfully created checkpoint table Ggadm.checkpointtab
Ggsci (oel65vm11.hthorizon.com as [email protected]) 10> ADD replicat Rep1, Exttrail/u01/app/grid/acfsmounts/ogg_ Vol1/ogg12/dirdat/rt checkpointtable Ggadm.checkpointtab
Replicat added.
Ggsci (oel65vm11.hthorizon.com as [email protected]) 11>edit PARAMS REP1
Add the following content:
Replicat REP1
USERID Ggadm, PASSWORD ggadm
Assumetargetdefs
Discardfile/u01/app/grid/acfsmounts/ogg_vol1/ogg12/dirdat/rt, PURGE
MAP test.* TARGET test.*;
Then start the process to test the Ogg data replication is normal
Modify Ogg Mgr Parameters
In order for the manager process of Ogg to start the replication process automatically, the following configuration needs to be added to the manager's configuration file:
AutoRestart ER *, retries 5, Waitminutes 1, resetminutes 60
AUTOSTART ER *
Restart the manager process for it to take effect.
Both the source and target sides are to be modified.
Configuring Source-Side XAG
L Add app VIP (as root)
[Email protected] ~]#/u01/app/11.2.0/grid/bin/appvipcfg create-network=1-ip=192.168.0.36-vipname=xag.gg_1- Vip.vip-user=oracle
L Allow grid users to start resources (as Root)
[Email protected] ~]#/u01/app/11.2.0/grid/bin/crsctl setperm resource Xag.gg_1-vip.vip-u user:grid:r-x
L Start VIP (in grid status)
[Email protected] ~]# Su-grid
[Email protected] ~]$/u01/app/11.2.0/grid/bin/crsctl start resource Xag.gg_1-vip.vip
Crs-2672:attempting to start ' xag.gg_1-vip.vip ' on ' Rac1 '
Crs-2676:start of ' xag.gg_1-vip.vip ' on ' Rac1 ' succeeded
L View Status
[Email protected] ~]$ crsctl status Resource Xag.gg_1-vip.vip
Name=xag.gg_1-vip.vip
Type=app.appvip_net1.type
Target=online
State=online on Rac1
L Create a CRS resource for Ogg (as root)
[Email protected] bin]#/u01/app/grid/xaghome/bin/agctl add goldengate gg_1--gg_home/u01/app/grid/acfsmounts/data_ Vol1/ogg12--instance_type source--nodes rac1,rac2--vip_name xag.gg_1-vip.vip--filesystems ORA.DATA.VOLOGG1.ACFS-- Databases ora.tdb.db--oracle_home/u01/app/oracle/product/11.2.0/dbhome_1--monitor_extracts EXT1,PUMP1
[Email protected] ~]# Cd/u01/app/grid/xaghome/bin
[Email protected] bin]#/agctl status Goldengate gg_1
Goldengate instance ' gg_1 ' is not running
L authorize grid to start resources
When the above command is completed, a CRS resource corresponding to Ogg is automatically created and the grid is authorized to administer it:
[Email protected] bin]#/u01/app/11.2.0/grid/bin/crsctl setperm resource Xag.gg_1.goldengate-u user:grid:r-x
Configuring Target-side XAG
The process is similar to the source end,
L Create VIP resources:
[Email protected] ~]#/u01/app/12.1.0/grid/bin/appvipcfg create-network=1-ip=192.168.0.26-vipname=xag.gg_1- Vip.vip-user=oracle
[Email protected] ~]#/u01/app/12.1.0/grid/bin/crsctl setperm resource Xag.gg_1-vip.vip-u user:grid:r-x
[Email protected] ~]#/u01/app/12.1.0/grid/bin/crsctl start resource Xag.gg_1-vip.vip
Crs-2672:attempting to start ' xag.gg_1-vip.vip ' on ' oel65vm12 '
Crs-2676:start of ' xag.gg_1-vip.vip ' on ' OEL65VM12 ' succeeded
[Email protected] ~]#/u01/app/12.1.0/grid/bin/crsctl relocate resource Xag.gg_1-vip.vip-n OEL65VM11
Crs-2673:attempting to stop ' xag.gg_1-vip.vip ' on ' oel65vm12 '
Crs-2677:stop of ' xag.gg_1-vip.vip ' on ' OEL65VM12 ' succeeded
Crs-2672:attempting to start ' xag.gg_1-vip.vip ' on ' OEL65VM11 '
Crs-2676:start of ' xag.gg_1-vip.vip ' on ' OEL65VM11 ' succeeded
L Create a CRS resource corresponding to OGG
[Email protected] bin]#/u01/app/grid/xaghome/bin/agctl add goldengate gg_2--gg_home/u01/app/grid/acfsmounts/ogg_ Vol1/ogg12--instance_type target--nodes oel65vm11,oel65vm12--vip_name xag.gg_1-vip.vip--filesystems Ora.data.vologg2.acfs--databases ora.racdb.db--oracle_home/u01/app/oracle/product/12.1.0/dbhome_1--monitor_ Replicats REP1
L Authorization
[Email protected] bin]#/u01/app/12.1.0/grid/bin/crsctl setperm resource Xag.gg_2.goldengate-u user:grid:r-x
Modifying the pump process
Modify the source-side address of the pump process to the VIP we just created
Rmthost 192.168.0.26, Mgrport 7809
Restarting the pump process
Start CRS OGG Resources
Enter the Ggsci command line to stop both the source and target segment processes
L Start target-side resources
[Email protected] ~]$ CD $ORACLE _base
[Email protected] grid]$ CD Xaghome/bin
[Email protected] bin]$/agctl start goldengate gg_2--node Oel65vm11
[Email protected] bin]$ crsctl status Resource xag.gg_2.goldengate
Name=xag.gg_2.goldengate
Type=xag.goldengate.type
Target=online
State=online on OEL65VM11
L Start Source-side resources
[Email protected] bin]$ CD $ORACLE _base
[Email protected] grid]$ CD Xaghome/bin
[Email protected] bin]$/agctl start goldengate gg_1--node Rac1
[Email protected] bin]$ crsctl status Resource xag.gg_1.goldengate
Name=xag.gg_1.goldengate
Type=xag.goldengate.type
Target=online
State=online on Rac1
After startup, go to the Ggsci command line, review the status of the process, and if the process starts automatically, there is no problem with the configuration.
Switch test
To test source-side switching using commands:
[Email protected] bin]$/agctl relocate goldengate gg_1--node Rac2
[Email protected] bin]$ crsctl status resource–t
。。。。。。
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
。。。。。。
Xag.gg_1-vip.vip
1 Online Online Rac2
Xag.gg_1.goldengate
1 Online Online Rac2
To do a power-off test, we shut down the target side of the host by "Power Off" Oel65vm11
On the host OEL65VM12, you can see the RAC VIP failover to this node, OGG VIP and gg_2 corresponding resources are automatically failover to this node:
[Email protected] ~]$ crsctl status resource-t
。。。。。。
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
。。。。。。
Ora.oel65vm11.vip
1 ONLINE Intermediate Oel65vm12 FAILED over,stable
Ora.oel65vm12.vip
1 Online Online Oel65vm12 STABLE
Ora.racdb.db
1 ONLINE OFFLINE STABLE
2 Online Online oel65vm12 open,stable
Ora.scan1.vip
1 Online Online Oel65vm12 STABLE
Xag.gg_1-vip.vip
1 Online Online Oel65vm12 STABLE
Xag.gg_2.goldengate
1 Online Online Oel65vm12 STABLE
The above is just one of the simplest examples, without considering complex situations, such as the simultaneous deployment of monitoring jagent, or downstream replication, and so on, so the actual production environment is often much more complex than this example.
Implement Goldengate automatic failover in a RAC environment using XAG