Configurando Oracle GoldenGate com Oracle Grid Infrastructure Bundled Agents (XAG) no Real Application Clusters (RAC) On Oracle 12c

Por Y V Ravi Kumar Oracle ACE director, Rodrigo Mufalani Oracle ACE, Archana Durai (OCP and RHCE)
Publicado em Julho 2018

Revisado por Mario Andrés Escobar



Introdução

O Oracle Grid Infrastructure (GI) fornece os componentes  necessários para gerenciar a Alta disponibilidade (HA) e o gerenciamento de recursos para aplicações críticas. O Oracle Grid Infrastructure Bundled Agents (XAG) são processos do GI que fornecem HA e um framework de gerenciamento para qualquer aplicação. A intergração transparente entre o Oracle Clusterware e o Oracle GoldenGate é gerenciada pelo Oracle Clusterware. O XAG garante que o Oracle GoldenGate pode falhas dos servidores movendo processos para um outro servidor disponível (instance failover em um ambiente clusterizado ou um failover com o Oracle Dataguard).

Configuração do ambiente:

Sistema de Origem
Operating system:                           Oracle Enterprise Linux 6.5
Oracle Version:                              Oracle Database 12cR1 (12.1.0.2.0)
GoldenGate version:                       Oracle GoldenGate (12.2.0.1.1)
XAG Version:                                 xagpack_72.zip
Hostnames:                                     rac1-12c, rac2-12c
Database:                                     orcl (orcl1 and orcl2)
Oracle Home:                                 /u01/app/oracle/product/12.1.0.2/db_1
GoldenGate Home                          /vol1/app/gggate
XAG Home                                     /u01/app/xag
Public IPs                                   192.168.2.101, 192.168.2.102
Private IPs                                  10.1.4.146, 10.1.4.147
SCAN                                         192.168.2.105, 192.168.2.106 and 192.168.2.107
XAG VIP                                     192.168.1.150

Sistema de Destino
Operating system:                         Oracle Enterprise Linux 6.5
Oracle Version:                            Oracle Database 12cR1 (12.1.0.2.0)
GoldenGate version:                     Oracle GoldenGate (12.2.0.1.1)
XAG Version:                               xagpack_72.zip
Hostnames:                                   rac3-12c, rac4-12c
Database:                                     orcldb (orcldb1 and orcldb2)
Oracle Home:                               /u01/app/oracle/product/12.1.0.2/db_1
GoldenGate Home                        /vol1/app/ggate
XAG Home                                  /u01/app/xag
Public IPs                                    192.168.2.201, 192.168.2.202
Private IPs                                  10.1.4.246, 10.1.4.247
SCAN                                        192.168.2.205, 192.168.2.206 and 192.168.2.207
XAG VIP                                    192.168.1.160



Arquitetura do Oracle GoldenGate com XAG nos Cluster Nodes



Benefícios do Oracle Grid Infrastructure Bundled Agent (XAG)

  • XAG permite você registrar uma instance do Oracle GoldeGate instance no CRS para fornecer HA em um ambiente clusterizado.
  • Ele resolve problemas relacionados aos processos chave garantindo a disponibilidade da instance do Oracle GoldenGate quando há falhas.
    • Perda de uma instance (RAC node failover)
    • Perda do primary database (integração com Data Guard Failover)
  • Uso do utilitário de linha de comando AGCTL para registrar, iniciar parar recursos


Criando um file system compartilhado para a instalação do Oracle GoldenGate e seus arquivos relacionados.

  1. Oracle ASM Cluster File System (ACFS)
  2. Database File System (DBFS)
  3. Oracle Cluster File System (OCFS2)


O papel do DBFS file system em uma configuração XAG

  • XAG realoca perfeitamente a instance Oracle GoldenGate ou uma falha do primary database.
  • A consistência dos dados e metadados do Oracle GoldenGate é garantida com um DBFS file system.
  • Armazenamento da trilha de dados e checkpoints no DBFS garante a consistência em caso de Role transitions (Dataguard) 

Nota: Nós estamos criando e configurando o Oracle ASM Cluster File System (ACFS) no Cluster de Origem (rac1-12c e rac2-12c) e no Cluster de Destino (rac3-12c e rac4-12c)

Nota: Download os componentes do XAG da URL abaixo
http://www.oracle.com/technetwork/database/database-technologies/clusterware/downloads/xag-agents-downloads-3636484.html



Configuração do Sistema de Origem

  1. Instalado e configurado o Oracle Grid Infrastructure 12cR1 (12.1.0.2.0) em /u01/app/12.1.0.2/grid
  2. Instalado e configurado o Oracle Database 12cR1 (12.1.0.2.0) em /u01/app/oracle/product/12.1.0.2/db_1
  3. Criado e configurado os disk groups: DATA e RECO
  4. Assinalado PUBLIC IPs, PRIVATE IPs e SCAN IPs para os nodes (rac1-12c e rac2-12c)
  5. Criado o disk group ACFS_DG para colocar o ACFS file system para a instalação compartilhada do Oracle GoldenGate

Configuração do Sistema de Destino

  1. Instalado e configurado o Oracle Grid Infrastructure 12cR1 (12.1.0.2.0) em /u01/app/12.1.0.2/grid
  2. Instalado e configurado o Oracle Database 12cR1 (12.1.0.2.0) em /u01/app/oracle/product/12.1.0.2/db_1
  3. Criado e configurado os disk groups: DATA e RECO
  4. Assinalado PUBLIC IPs, PRIVATE IPs e SCAN IPs para os nodes (rac3-12c e rac4-12c)
  5. Criado o disk group ACFS_DG para colocar o ACFS file system para a instalação compartilhada do Oracle GoldenGate



Sistema de Origem – configuração do Oracle GoldenGate

Logue-se como ‘oracle’ user e descompacte os binários de instalação do Oracle GoldenGate e execute o ‘runInstaller’

[oracle@rac1-12c ~]$ cd /vol1/
[oracle@rac1-12c vol1]$ mkdir -p app/gggate
[oracle@rac1-12c ~]$ chmod -R 777 fbo_ggs_Linux_x64_shiphome.zip
[oracle@rac1-12c ~]$ unzip fbo_ggs_Linux_x64_shiphome.zip
Archive:  fbo_ggs_Linux_x64_shiphome.zip
   creating: fbo_ggs_Linux_x64_shiphome/
   creating: fbo_ggs_Linux_x64_shiphome/Disk1/
   inflating: fbo_ggs_Linux_x64_shiphome/Disk1/runInstaller
 (saída omitida)

[oracle@rac1-12c ~]$ cd fbo_ggs_Linux_x64_shiphome/Disk1/
[oracle@rac1-12c Disk1]$ ./runInstaller &
[1] 16584
[oracle@rac1-12c Disk1]$ Starting Oracle Universal Installer...
[oracle@rac1-12c Disk1]$ cd /vol1/app/gggate/
[oracle@rac1-12c gggate]$ ls -lrth
total 663M
-rw-r-----  1 oracle oinstall 1.5K Oct 15  2010 zlib.txt
-rw-r-----  1 oracle oinstall  759 Oct 15  2010 tcperrs
-rw-r-----  1 oracle oinstall  248 Oct 15  2010 sqlldr.tpl
(saída omitida)

[oracle@rac1-12c ggate]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Dec 12 2015 02:56:48
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.

GGSCI (rac1-12c.localdomain) 1> create subdirs

Creating subdirectories under current directory /vol1/app/ggate
Parameter files                		/vol1/app/ggate/dirprm: created
Report files                   		/vol1/app/ggate/dirrpt: created
Checkpoint files               		/vol1/app/ggate/dirchk: created
Process status files           		/vol1/app/ggate/dirpcs: created
SQL script files               		/vol1/app/ggate/dirsql: created
Database definitions files     		/vol1/app/ggate/dirdef: created
Extract data files             		/vol1/app/ggate/dirdat: created
Temporary files                		/vol1/app/ggate/dirtmp: created
Credential store files         		/vol1/app/ggate/dircrd: created
Masterkey wallet files         		/vol1/app/ggate/dirwlt: created
Dump files                     		/vol1/app/ggate/dirdmp: created

GGSCI (rac1-12c.localdomain) 2> edit params mgr
GGSCI (rac1-12c.localdomain) 4> view params mgr
PORT 7878
AUTORESTART ER *, retries 5, waitminutes 1, resetminutes 60
AUTOSTART ER *

GGSCI (rac1-12c.localdomain) 3> info all
Program     	Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     	STOPPED




Logue-se  como ‘oracle’ e depois com um usuário SYS no banco de dados de origem  para criar tablespace, criar o user ‘ogguser’ e conceder os privilégios para a configuração do Oracle GoldenGate

[oracle@rac1-12c ~]$.oraenv
ORACLE_SID = [orcl1]?orcl
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@rac1-12c ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 24 05:57:41 2017
Copyright(c) 1982, 2014, Oracle.  All rights reserved.

SQL> connect sys/oracle@orcl as sysdba
Connected.

SQL> archive log list;
Database log mode              		Archive Mode
Automatic archival             		Enabled
Archive destination            		USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     	    	7
Next log sequence to archive   	    	8
Current log sequence           		8


SQL> create tablespace goldengate datafile '+DATA' size 100M autoextend on;
Tablespace created.

SQL> create user ogguser identified by oracle default tablespace goldengate 
temporary tablespace temp account unlock;
User created.

SQL> GRANT CONNECT TO ogguser;
Grant succeeded.

SQL> GRANT DBA TO ogguser;
Grant succeeded.

SQL> GRANT UNLIMITED TABLESPACE TO ogguser;
Grant succeeded.

SQL> GRANT SELECT ANY DICTIONARY TO ogguser;
Grant succeeded.

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.

SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.

SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
SUPPLEME
--------
YES

SQL> alter user scott identified by oracle account unlock;
User altered.

SQL> alter system set enable_goldengate_replication=TRUE scope=spfile sid='*';
System altered.

SQL> alter system set streams_pool_size=256M scope=spfile sid='*';
System altered.

SQL> exit



Logue-se como ‘ogguser’ e crie os processos de Extract e Pump no Sistema de Origem


[oracle@rac1-12c ~]$ cd $GG
[oracle@rac1-12c gggate]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Dec 12 2015 02:56:48
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.

GGSCI (rac1-12c.localdomain) 1> dblogin userid ogguser, password oracle
Successfully logged into database.



Registre o Extract (eorcl) com om banco de dados para uma extração integrada

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 4> register extract eorcl database
2017-06-25 05:12:04  INFO  OGG-02003  Extract EORCL successfully registered with 
database at SCN 2031967.



Crie uma extração integrada (eorcl) no sistema de origem

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 5> add extract eorcl, integrated tranlog, 
begin now
EXTRACT (Integrated) added.

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 3> add exttrail ./dirdat/lt, extract eorcl, 
megabytes 10
EXTTRAIL added.



Crie um processo de Pump (porcl) no sistema de origem

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 4> add extract porcl, exttrailsource 
./dirdat/lt
EXTRACT added.

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 5> add rmttrail ./dirdat/rt, extract porcl,
megabytes 5
RMTTRAIL added.

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 6> add trandata scott.*

2017-06-24 06:19:45  WARNING OGG-06439  No unique key is defined for table BONUS. All viable 
columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be 
used to define the key.

Logging of supplemental redo data enabled for table SCOTT.BONUS.
TRANDATA for scheduling columns has been added on table 'SCOTT.BONUS'.
TRANDATA for instantiation CSN has been added on table 'SCOTT.BONUS'.
Logging of supplemental redo data enabled for table SCOTT.DEPT.
TRANDATA for scheduling columns has been added on table 'SCOTT.DEPT'.
TRANDATA for instantiation CSN has been added on table 'SCOTT.DEPT'.
Logging of supplemental redo data enabled for table SCOTT.EMP.
TRANDATA for scheduling columns has been added on table 'SCOTT.EMP'.
TRANDATA for instantiation CSN has been added on table 'SCOTT.EMP'.
2017-06-24 06:19:45  WARNING OGG-06439  No unique key is defined for table SALGRADE. All viable 
columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be 
used to define the key.

Logging of supplemental redo data enabled for table SCOTT.SALGRADE.
TRANDATA for scheduling columns has been added on table 'SCOTT.SALGRADE'.
TRANDATA for instantiation CSN has been added on table 'SCOTT.SALGRADE'.

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 7> edit param eorcl
GGSCI (rac1-12c.localdomain as ogguser@orcl1) 8> view param eorcl
extract eorcl
exttrail ./dirdat/lt
userid ogguser, password oracle
table scott.*;

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 9> view param mgr
PORT 7878
AUTORESTART ER *, retries 5, waitminutes 1, resetminutes 60
AUTOSTART ER *

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 10> edit param porcl
GGSCI (rac1-12c.localdomain) 8> view param porcl

extract porcl
rmthost gg_2-vip, mgrport 7879
rmttrail ./dirdat/rt
passthru
table scott.*;

Nota importante: O parâmetro RMOHOST deve referenciar o VIP IP do destino para um failover automatico na configuração do Oracle GoldenGate XAG.

GGSCI (rac1-12c.localdomain as ogguser@orcl1) 12> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     STOPPED
EXTRACT     STOPPED     EORCL       00:00:00      00:02:20
EXTRACT     STOPPED     PORCL       00:00:00      00:02:02



Logue-se como ‘oracle’ user e descompacte os binários de instalação do Oracle GoldenGate e execute o ‘runInstaller’ no sistema de destino

[oracle@rac3-12c ~]$ cd /vol1/
[oracle@rac3-12c vol1]$ mkdir -p app/ggate
[oracle@rac3-12c ~]$ chmod -R 777 fbo_ggs_Linux_x64_shiphome.zip
[oracle@rac3-12c ~]$ unzip fbo_ggs_Linux_x64_shiphome.zip
Archive:  fbo_ggs_Linux_x64_shiphome.zip
   creating: fbo_ggs_Linux_x64_shiphome/
   creating: fbo_ggs_Linux_x64_shiphome/Disk1/
   inflating: fbo_ggs_Linux_x64_shiphome/Disk1/runInstaller
   creating: fbo_ggs_Linux_x64_shiphome/Disk1/stage/
(saída omitida)

[oracle@rac3-12c ~]$ cd fbo_ggs_Linux_x64_shiphome/Disk1/
[oracle@rac3-12c Disk1]$ ./runInstaller &
[1] 16584
[oracle@rac3-12c Disk1]$ Starting Oracle Universal Installer...
[oracle@rac3-12c Disk1]$ cd /vol1/app/ggate/



Logue-se como ‘ogguser’ e crie o processo Manager e Replicat no sistema de destino

[oracle@rac3-12c ggate]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.

GGSCI (rac3-12c.localdomain) 1> create subdirs

Creating subdirectories under current directory /vol1/app/ggate
Parameter files                		/vol1/app/ggate/dirprm: created
Report files                   		/vol1/app/ggate/dirrpt: created
Checkpoint files               		/vol1/app/ggate/dirchk: created
Process status files           		/vol1/app/ggate/dirpcs: created
SQL script files               		/vol1/app/ggate/dirsql: created
Database definitions files     		/vol1/app/ggate/dirdef: created
Extract data files             		/vol1/app/ggate/dirdat: created
Temporary files                		/vol1/app/ggate/dirtmp: created
Credential store files         		/vol1/app/ggate/dircrd: created
Masterkey wallet files         		/vol1/app/ggate/dirwlt: created
Dump files                     		/vol1/app/ggate/dirdmp: created



Crie o arquivo de parâmetros para o  Manager no sistema de destino

GGSCI (rac3-12c.localdomain) 1> edit params mgr
GGSCI (rac3-12c.localdomain) 2> view param mgr
PORT 7879
AUTOSTART ER *

GGSCI (rac3-12c.localdomain) 3> info all
Program     	Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     	STOPPED

GGSCI (rac3-12c.localdomain) 4> edit param ./GLOBALS
GGSCI (rac3-12c.localdomain) 5> view param ./GLOBALS
GGSCHEMA OGGUSER
ENABLEMONITORING
CHECKPOINTTABLE OGGUSER.GGS_CHECKPOINT



Crie o processo Replicat (rorcl) no sistema destino

GGSCI (rac3-12c.localdomain) 6> edit param rorcl
GGSCI (rac3-12c.localdomain) 7> view param rorcl
replicat rorcl
userid ogguser, password oracle
assumetargetdefs
ddloptions report
discardfile ./dirout/rorcl.dsc, purge
map scott.*, target scott.*;

GGSCI (rac3-12c.localdomain as ogguser@orcldb1) 6> add checkpointtable
No checkpoint table specified. Using GLOBALS specification (OGGUSER.GGS_CHECKPOINT)...
Successfully created checkpoint table OGGUSER.GGS_CHECKPOINT.

GGSCI (rac3-12c.localdomain) 6> info all
Program     	Status     	 Group       Lag at Chkpt  Time Since Chkpt

MANAGER     	STOPPED
JAGENT      	STOPPED
REPLICAT    	STOPPED           RORCL       00:00:00      00:00:02



Loguese como ‘oracle’ user e crie tablespace, usuário ogguser e conceda os privilégios para o ‘ogguser’.

[oracle@rac3-12c ~]$.oraenv
ORACLE_SID = [orcldb] ? orcldb
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac3-12c ~]$ sqlplus /nolog

SQL> connect sys/oracle@orcldb as sysdba
Connected.

SQL> archive log list;
Database log mode              		Archive Mode
Automatic archival             		Enabled
Archive destination            		USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     		27
Next log sequence to archive   		28
Current log sequence           		28


SQL> create tablespace goldengate datafile '+DATA' size 100M autoextend on;
Tablespace created.

SQL> create user ogguser identified by oracle default tablespace goldengate 
temporary tablespace temp account unlock;
User created.

SQL> GRANT CONNECT TO ogguser;
Grant succeeded.

SQL> GRANT DBA TO ogguser;
Grant succeeded.

SQL> GRANT UNLIMITED TABLESPACE TO ogguser;
Grant succeeded.

SQL> GRANT SELECT ANY DICTIONARY TO ogguser;
Grant succeeded.

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.

SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.

SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;

SUPPLEMENTAL_LOG_DATA
---------------------
YES

SQL> alter user scott identified by oracle account unlock;
User altered.

SQL> alter system set enable_goldengate_replication=TRUE scope=spfile sid='*';
System altered.

SQL> alter system set streams_pool_size=256M scope=spfile sid='*';
System altered.




Configuração do XAG - Sistema de Origem

Faça o download e descompacte os componentes XAG no node rac1-12c e instale fora da Grid Infrastructure ORACLE_HOME e tenha certeza de colocar na variável PATH do usuário do SO antes do caminho do GI (assim ele vai achar os binários do XAG antes do GI).

[oracle@rac1-12c xag]$ unzip xagpack_72.zip
Archive:  xagpack_72.zip
   creating: xag/
   inflating: xag/agmysqlas.pm
   creating: xag/bin/
   inflating: xag/bin/oerr.pl
   creating: xag/template/
   inflating: xag/template/app.appvip.type
   inflating: xag/template/xag.goldengate.type
   inflating: xag/template/xag.mysql.type
   inflating: xag/template/xag.wl.type
   inflating: xag/template/xag.tomcat.type
   inflating: xag/template/xag.psoftapp.type
   inflating: xag/template/xag.siebgtwy.type
   inflating: xag/template/xag.apache.type
   inflating: xag/template/xag.psoftpia.type
   inflating: xag/template/xag.siebsrvr.type
   inflating: xag/template/xag.psoftbatch.type
   inflating: xag/template/xag.jde.type
   inflating: xag/template/xag.base.type
  (saída omitida)
 [oracle@rac1-12c xag]$

Nota: Conteúdo do ‘.bash_profile’




Logue-se como ‘root’ user e crie o diretório no rac1-12c e rac2-12c para o XAG

[root@rac1-12c ~]# cd /u01/app/
[root@rac1-12c app]# mkdir xag
[root@rac1-12c app]# chown -R oracle:oinstall /u01/app/xag/
[root@rac1-12c app]# chmod -R 777 /u01/app/xag/

[root@rac1-12c app]# ssh rac2-12c
root@rac2-12c's password:
[root@rac2-12c ~]# cd /u01/app/
[root@rac2-12c app]# mkdir xag
[root@rac2-12c app]# chown -R oracle:oinstall /u01/app/xag/
[root@rac2-12c app]# chmod -R 777 /u01/app/xag/



Logue-se como ‘oracle’ user e configure o XAG no rac1-12c e rac2-12c (de uma só vez usando –all_nodes)

[oracle@rac1-12c xag]$ ./xagsetup.sh --install --directory /u01/app/xag --all_nodes
Installing Oracle Grid Infrastructure Agents on: rac1-12c
Installing Oracle Grid Infrastructure Agents on: rac2-12c
Done.
[oracle@rac1-12c xag]$



Logue-se como ‘root’ user e adicione o IP para ‘gg_1’ no rac1-12c e rac2-12c para o XAG

[root@rac1-12c ~]# cat /etc/hosts
192.168.2.101           	rac1-12c.localdomain            		rac1-12c
192.168.2.102           	rac2-12c.localdomain            		rac2-12c
10.1.4.246              	rac1-12c-priv.localdomain       	    rac1-12c-priv
10.1.4.247              	rac2-12c-priv.localdomain       	    rac2-12c-priv
192.168.2.103           	rac1-12c-vip.localdomain        	    rac1-12c-vip
192.168.2.104           	rac2-12c-vip.localdomain        	    rac2-12c-vip
192.168.2.105           	rac-scan.localdomain            		rac-scan
192.168.2.106           	rac-scan.localdomain            		rac-scan
192.168.2.107           	rac-scan.localdomain            		rac-scan
192.168.2.150           	gg_1-vip.localdomain            		gg_1-vip



Cheque se gg_1 está acessível de ambos os nodes rac1-12c e rac2-12c

[root@rac1-12c ~]# ping gg_1-vip
[root@rac2-12c ~]# ping gg_1-vip



Logue-se como ‘ oracle’ user na instnce ASM e depois use o comando asmcmd

[oracle@rac1-12c ~]$.oraenv
ORACLE_SID = [orcl1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1-12c ~]$ asmcmd

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  
MOUNTED  EXTERN  N         512   4096  1048576     20472    20373                0 
MOUNTED  EXTERN  N         512   4096  1048576     20472    12647                0 

Usable_file_MB  Offline_disks  Voting_files  Name
         20373              0             N  ACFS_DG/
         12647              0             Y  DATA/



Cheque as informações sobre os volume criados

ASMCMD> volinfo --all
no volumes found



Crie um volume ASM no diskgroup montado (ACFS_DG) com o comando ‘volcreate’ dentro do utilitário asmcmd

ASMCMD> volcreate -G acfs_dg -s 19G vol1



Cheque o nome do dispositivo do volume que foi criado:

ASMCMD> volinfo --all
Diskgroup Name: ACFS_DG
     Volume Name: VOL1
     Volume Device: /dev/asm/vol1-11
     State: ENABLED
     Size (MB): 19456
     Resize Unit (MB): 64
     Redundancy: UNPROT
     Stripe Columns: 8
     Stripe Width (K): 1024
     Usage:
     Mountpath:
ASMCMD> exit



Logue-se como ‘root’ user

[root@rac1-12c ~]# modprobe  oracleacfs
[root@rac1-12c ~]# modprobe  oracleadvm
[root@rac1-12c ~]# modprobe  oracleoks
[root@rac1-12c ~]# lsmod | grep oracle
oracleacfs            3307969  	1
oracleadvm            506254  	2
oracleoks             505749  	2 oracleacfs,oracleadvm



Logue-se como ‘oracle’ user e crie um file system como o comando ‘mkfs’ do ACFS.

[oracle@rac1-12c ~]$ mkfs -t acfs /dev/asm/vol1-11
mkfs.acfs: version                   	= 12.1.0.2.0
mkfs.acfs: on-disk version           	= 39.0
mkfs.acfs: volume                    	= /dev/asm/vol1-11
mkfs.acfs: volume size               	= 20401094656  (  19.00 GB )
mkfs.acfs: Format complete.
[oracle@rac1-12c ~]$



Logue-se como ‘root’ user e crie o diretório ‘/vol1’ e conceda os privilégios necessários

[root@rac1-12c ~]# cd /
[root@rac1-12c /]# mkdir vol1
[root@rac1-12c /]# chown -R oracle:oinstall /vol1
[root@rac1-12c /]# chmod -R 777 /vol1



Registre o file system com o comando ‘acfsutil registry’ e cheque com o comando ‘df –h’

[root@rac1-12c /]# acfsutil registry -a /dev/asm/vol1-11 /vol1
acfsutil registry: mount point /vol1 successfully added to Oracle Registry

[root@rac1-12c /]# acfsutil registry -c /dev/asm/vol1-11 /vol1 -u oracle
acfsutil registry: successfully modified ACFS registration for '/dev/asm/vol1-11'

[root@rac1-12c /]# mount -t acfs /dev/asm/vol1-11 /vol1

[root@rac1-12c /]# df -h
Filesystem                   		Size  	Used 	Avail 	Use% 	Mounted on
/dev/mapper/vg_rac1-lv_root   	 	35G   	 23G   	 11G  	67% 	/
tmpfs                        		3.9G  	630M  	3.3G  	16% 	/dev/shm
/dev/sda1                    		477M   	 55M  	397M  	13% 	/boot
/dev/asm/vol1-11              	 	19G  	115M   	 19G   	 1% 	/vol1
[root@rac1-12c /]#

[root@rac1-12c /]# mount | grep acfs
/dev/asm/vol1-11 on /vol1 type acfs (rw)



Cheque o volume do outro node (rac2-12c)

[root@rac1-12c /]# ssh rac2-12c
root@rac2-12c's password:

[root@rac2-12c ~]# df -h
Filesystem                   		Size  	Used 	Avail 	Use% 	Mounted on
/dev/mapper/vg_rac1-lv_root   		35G   	18G   	16G  	54% 	/
tmpfs                        		3.9G  	631M  	3.3G  	16% 	/dev/shm
/dev/sda1                    		477M   	55M  	397M  	13% 	/boot
/dev/asm/vol1-11              		19G  	115M   	19G   	1% 	/vol1
[root@rac2-12c ~]#




Coloque uma entrada no /etc/fstab nos nodes (rac1-12c e rac2-12c)

[root@rac1-12c /]# vi /etc/fstab
[root@rac1-12c /]# cat /etc/fstab
>
/dev/mapper/vg_rac1-lv_root /
   ext4
   defaults
   1 1
UUID=7a3d2b88-72a1-487b-90e0-8e0415ea454f /boot
   ext4
   defaults
   1 2
/dev/mapper/vg_rac1-lv_swap
   swap
   defaults
   0 0
tmpfs              /dev/shm
   tmpfs
   defaults
   0 0
devpts             /dev/pts
   devpts
   gid=5,mode=620
   0 0
sysfs              /sys
   sysfs
   defaults
   0 0
proc               /proc
   proc
   defaults
   0 0
/dev/asm/vol1-11   /vol1
   acfs
   defaults
   0 0
[root@rac2-12c ~]# vi /etc/fstab [root@rac2-12c ~]# cat /etc/fstab /dev/mapper/vg_rac1-lv_root / ext4 defaults 1 1 UUID=7a3d2b88-72a1-487b-90e0-8e0415ea454f /boot ext4 defaults 1 2 /dev/mapper/vg_rac1-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/asm/vol1-11 /vol1 acfs defaults 0 0



Logue-se como ‘root’ user e crie um application VIP usando ‘appvipcfg’

[root@rac1-12c ~]# . oraenv
ORACLE_SID = [+ASM1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle

[root@rac1-12c ~]# appvipcfg create 
-network=1 \
-ip=192.168.2.150 \
-vipname=xag.gg_1-vip.vip \
-user=oracle

[root@rac1-12c ~]# crsctl start resource xag.gg_1-vip.vip



Para validar quais VIPs estão rodando e em que nodes está rodando

 

Registro do Oracle GoldenGate com Bundled Agent (XAG)

  1. Oracle GoldenGate Administrator, oracle, cria o agente OGG com os comandos.
  2. Registre com o XAG no primário criando o VIP (como root) usando o comando agctl.
  3. Inicie o Extract usando o Agent Control.

[oracle@rac1-12c bin]$ ./agctl add goldengate gg_1 \
--gg_home /vol1/app/gggate \
--instance_type source \
--nodes rac1-12c,rac2-12c \
--vip_name xag.gg_1-vip.vip \
--filesystems ora.acfs_dg.vol1.acfs \
--databases ora.orcl.db \
--oracle_home /u01/app/oracle/product/12.1.0.2/db_1



Cheque o status do recurso (gg_1)

[oracle@rac1-12c bin]$ agctl status goldengate gg_1
Goldengate  instance 'gg_1' is not running



Configure o recurso (gg_1) usando o comando ‘config’

[oracle@rac1-12c bin]$ agctl config goldengate gg_1
GoldenGate location is: /vol1/app/gggate
GoldenGate instance type is: source
Configured to run on Nodes: rac1-12c rac2-12c
ORACLE_HOME location is: /u01/app/oracle/product/12.1.0.2/db_1
Databases needed: ora.orcl.db
File System resources needed: ora.acfs_dg.vol1.acfs
Extracts to monitor:
Replicats to monitor:
Critical extracts:
Critical replicats:
Autostart on DataGuard role transition to PRIMARY: no
Autostart JAgent: no
[oracle@rac1-12c bin]$




Sistema Destino – Configuração do XAG

[oracle@rac3-12c xag]$ unzip xagpack_72.zip
Archive:  xagpack_72.zip
   creating: xag/
   inflating: xag/agmysqlas.pm
   creating: xag/bin/
   inflating: xag/bin/oerr.pl
   creating: xag/template/
   inflating: xag/template/app.appvip.type
   inflating: xag/template/xag.goldengate.type
   inflating: xag/template/xag.mysql.type
   inflating: xag/template/xag.wl.type
   inflating: xag/template/xag.tomcat.type
   inflating: xag/template/xag.psoftapp.type
   inflating: xag/template/xag.siebgtwy.type
   inflating: xag/template/xag.apache.type
   inflating: xag/template/xag.psoftpia.type
   inflating: xag/template/xag.siebsrvr.type
(saída omitida)
[oracle@rac3-12c xag]$


Logue-se como ‘root’ user e crie o diretório nos rac3-12c e rac4-12c nodes para o XAG

[root@rac3-12c ~]# cd /u01/app/
[root@rac3-12c app]# mkdir xag
[root@rac3-12c app]# chown -R oracle:oinstall /u01/app/xag/
[root@rac3-12c app]# chmod -R 777 /u01/app/xag/

[root@rac3-12c app]# ssh rac4-12c
root@rac4-12c's password:
[root@rac4-12c ~]# cd /u01/app/
[root@rac4-12c app]# mkdir xag
[root@rac3-12c app]# chown -R oracle:oinstall /u01/app/xag/
[root@rac4-12c app]# chmod -R 777 /u01/app/xag/



Logue-se como ‘oracle’ user e configure o XAG nos nodes rac3-12c e rac4-12c (de uma só vez –all_nodes)

[oracle@rac3-12c xag]$ ./xagsetup.sh --install --directory /u01/app/xag --all_nodes
Installing Oracle Grid Infrastructure Agents on: rac3-12c
Installing Oracle Grid Infrastructure Agents on: rac4-12c
Done.
[oracle@rac3-12c xag]$

[root@rac3-12c ~]# cat /etc/hosts |tail
192.168.2.201           	rac3-12c.localdomain            	rac3-12c
192.168.2.202           	rac4-12c.localdomain            	rac4-12c
10.1.4.146              	rac3-12c-priv.localdomain       	rac3-12c-priv
10.1.4.147              	rac4-12c-priv.localdomain       	rac4-12c-priv
192.168.2.203           	rac3-12c-vip.localdomain        	rac3-12c-vip
192.168.2.204           	rac4-12c-vip.localdomain        	rac4-12c-vip
192.168.2.205           	rac-scan1.localdomain            	rac-scan1
192.168.2.206           	rac-scan1.localdomain            	rac-scan1
192.168.2.207           	rac-scan1.localdomain            	rac-scan1
192.168.2.160           	gg_2-vip.localdomain             	gg_2-vip

[root@rac4-12c ~]# cat /etc/hosts |tail
192.168.2.201           	rac3-12c.localdomain            	rac3-12c
192.168.2.202           	rac4-12c.localdomain            	rac4-12c
10.1.4.146              	rac3-12c-priv.localdomain       	rac3-12c-priv
10.1.4.147              	rac4-12c-priv.localdomain       	rac4-12c-priv
192.168.2.203           	rac3-12c-vip.localdomain        	rac3-12c-vip
192.168.2.204           	rac4-12c-vip.localdomain        	rac4-12c-vip
192.168.2.205           	rac-scan1.localdomain            	rac-scan1
192.168.2.206           	rac-scan1.localdomain            	rac-scan1
192.168.2.207           	rac-scan1.localdomain            	rac-scan1
192.168.2.160           	gg_2-vip.localdomain             	gg_2-vip



Logue-se como ‘oracle’ user na instance ASM e crie o volume para o ACFS

[oracle@rac3-12c ~]$.oraenv
ORACLE_SID = [orcldb1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac3-12c ~]$ asmcmd

ASMCMD> volinfo --all
no volumes found

ASMCMD> volcreate -G acfs_dg -s 14G vol1





Logue-se como ‘root’ user e faça o seguinte:

[root@rac3-12c ~]# modprobe  oracleacfs
[root@rac3-12c ~]# modprobe  oracleadvm
[root@rac3-12c ~]# modprobe  oracleoks

[root@rac3-12c ~]# lsmod | grep oracle
oracleacfs           	3307969  	2
oracleadvm            	506254  	7
oracleoks             	505749  	2 oracleacfs,oracleadvm
[root@rac3-12c ~]#


[root@rac3-12c ~]# appvipcfg create -network=1 -ip=192.168.2.160 
-vipname=xag.gg_2-vip.vip -user=oracle

[oracle@rac3-12c ~]$ cd /u01/app/xag/bin/

[oracle@rac3-12c bin]$ ./agctl add goldengate gg_2 \
--gg_home /vol1/app/ggate \
--instance_type source \
--nodes rac3-12c,rac4-12c \
--vip_name xag.gg_2-vip.vip \
--filesystems ora.acfs_dg.vol1.acfs \
--databases ora.orcldb.db \
--oracle_home /u01/app/oracle/product/12.1.0.2/db_1

[oracle@rac3-12c bin]$ ./agctl config goldengate gg_2
GoldenGate location is: /vol1/app/ggate
GoldenGate instance type is: source
Configured to run on Nodes: rac3-12c rac4-12c
ORACLE_HOME location is: /u01/app/oracle/product/12.1.0.2/db_1
Databases needed: ora.orcldb.db
File System resources needed: ora.acfs_dg.vol1.acfs
VIP name: xag.gg_2-vip.vip
EXTRACT groups to monitor:
REPLICAT groups to monitor:
Critical EXTRACT groups:
Critical REPLICAT groups:
Autostart on DataGuard role transition to PRIMARY: no
Autostart JAgent: no

[oracle@rac3-12c bin]$ ./agctl status goldengate
Goldengate  instance 'gg_2' is running on rac3-12c

[oracle@rac3-12c bin]$ ./agctl start goldengate gg_2
 (OR)
[oracle@rac3-12c bin]$ ./agctl start goldengate gg_2 --node rac3-12c



Checando o status do gg_1-vip (rac1-12c e rac2-12c) e gg_2-vip (rac3-12c e rac4-12c)

Checando VIP e o status do Oracle GoldenGate Agent status no sistema de origem



Checando VIP e o status do Oracle GoldenGate Agent status no sistema de destino




Checando o status do Volume os Sistemas de Origem e Destino

Sistema de Origem (rac1-12c e rac2-12c)



Sistem de Destino (rac3-12c e rac4-12c




Realocar o processo do Oracle GoldenGate (gg_1-vip) para outro node para testar um failover (rac1-12c para rac2-12c) no sistema de origem



Realocar o processo do Oracle GoldenGate (gg_2-vip) para um outro node para testar o failover (rac3-12c para rac4-12c) no sistema de destino



Como remover o gg_1 e um componente XAG:

[oracle@rac3-12c bin]$ agctl stop goldengate gg_1
Goldengate  instance 'gg_1' is not running

[oracle@rac3-12c bin]$ agctl status goldengate
Goldengate  instance 'gg_1' is not running

[oracle@rac3-12c bin]$ agctl remove goldengate gg_1

[root@rac3-12c ~]#.oraenv
ORACLE_SID = [root] ? +ASM1
The Oracle base has been set to /u01/app/oracle

[root@rac3-12c ~]# appvipcfg delete -vipname=xag.gg_1-vip.vip -force



Teste a funcionalidade do Oracle GoldenGate com XAG do sistema de origem (rac1-12c, rac2-12c) para o sistema de destino (rac3-12c, rac4-12c)

Faça um Insert na tabela ‘dept’ no schema scott no cluster de origem e commit a transação.



Cheque o processo do Oracle GoldenGate no sistema de origem



Cheque a transação no sistema de destino e o status do processo Replicat



Conclusão:

  1. O Oracle Clusterware XAG irá gerenciar o Oracle GoldenGate failover em um ambiente clusterizado.
  2. O processo do Oracle GoldenGate registrado com XAG irá lidar automaticamente com failover entre os nodes do RAC.
  3. O processo XAG realoca perfeitamente os processos do Oracle GoldenGate para qualquer node em um cluster.
  4. O XAG automaticamente faz o failover Oracle GoldenGate em caso de uma falha de instancia.


Y V Ravi Kumar é um Oracle ACE e Oracle Certified Master (OCM) com 18 anos de experiência em  instituições financeiras, serviços financeiros e seguros (BFSI) e atuou em diversos papeis como Senior Database Architect e Production DBA.  Ele também é OCP em Oracle 8i, 9i, 10g, 11g & 12c e Certificado em Golden Gate, RAC, Performance Tuning & Oracle Exadata. Ele continua motivando muitos DBAs e ajudando a Oracle Community publicando suas dicas /ideias/sugestões/soluções em seu blog. Ele escreveu 90+ artigos OTN sobre Oracle Exadata, Oracle RAC e Oracle GoldenGate para a OTN em Espanhol, OTN em Português e OTN em inglês e 19 artigos para a TOAD World, 2 Artigos para o UKOUG, 3 Artigos para OTech Magazine e 2 Artigos para a Redgate. Ele é membro do All India Oracle User Group (AIOUG) e frequente Oracle speaker in @NYOUG, @OTN, AIOUG, Sangam e IOUG. Ele desenha, projeta e implementa Core Banking System (CBS) Databases para o Central Banks em dois países – India e Mahe, Seychelles. 
Ele é Co-Founder do OraWorld (www.oraworld.com). Leia mais sobre o seu perfil na LaserSoft

Rodrigo Mufalani é um Oracle ACE e Oracle Certified Master (OCM) com mais de 14 anos de experiência, começou com o Oracle 8i, mas teve a oportunidade de dar suporte a Oracle 7.3.4 em diante. É especialista em banco de dados Oracle com foco principal em Performance & Tuning e RAC. É palestrante em eventos de Oracle como: OTN LAD TOUR e outros. Atualmente trabalha como consultor diversas empresas no segmento de variados ramos como: Educação, Saúde, Tecnologia, Seguros e etc. Foi o terceiro Oracle ACE a ser nomeado no Brasil e é OCP nas versões 10g, 11g e 12c. Atualmente é DBA na eProseed. Twitter @mufalani / blog www.mufalani.com.br/blog

Archana Durai tem mais 7+ anos de experiência como Oracle Database Administrator e tem expertise em vários Sistemas RDBMS. Ela tem experiência em muitos domínios como Life Sciences e Media & Communications. Ela é Oracle Certified Professional 9i, 10g, 11g e 12c e certificada em Oracle GoldenGate e Real Application Clusters (RAC), IBM DB2 Certified Administrator (v10.1). Além disso, ela possui a certifação Red Hat Certified Engineer (RHCE) e ITIL V3 Foundation.

Este artigo foi revisto pela equipe de produtos Oracle e está em conformidade com as normas e práticas para o uso de produtos Oracle.