Golden Gate: Instalação e Configuração
O Oracle Golden Gate é um produto de replicação de dados muito flexível e poderoso. Ele pode ser utlizado para uma migração entre versões e/ou plataformas do Oracle Database praticamente sem downtime, ou mesmo uma migração entre Oracle e Sybase com o mesmo objetivo de disponibilidade, além de poder ser utilizado para consolidação de todos os bancos de dados da empresa em um grande BI ou até uma replicação Ativo-Ativo. A lista de possibilidades é exaustiva.
Este é um guia rápido para uma implementação de replicação simples, de um único SCHEMA entre dois servidores Linux x86-64, utilizando Oracle Database 11gR2.
A instalação do Oracle Golden Gate é simples, basicamente apenas uma descompactação.
Execute o procedimento abaixo nos dois servidores.
[oracle@nerv07 ~]$ ls -lh
total 86M
-rw-r--r--. 1 oracle oinstall 86M Jul 4 12:45 ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
[oracle@nerv07 ~]$ mkdir OGG
[oracle@nerv07 ~]$ cp ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip OGG
[oracle@nerv07 ~]$ cd OGG
[oracle@nerv07 OGG]$ unzip ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
Archive: ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar
inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.1.pdf
inflating: Oracle GoldenGate 11.2.1.0.1 README.txt
inflating: Oracle GoldenGate 11.2.1.0.1 README.doc
[oracle@nerv07 OGG]$ tar xf fbo_ggs_Linux_x64_ora11g_64bit.tar
Em seguida, utilizamos o shell principal do Golden Gate (o ggsci), para a criação da estrutura de diretórios necessária.
Execute o procedimento abaixo nos dois servidores.
[oracle@nerv07 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 (nerv07.localdomain) 1> create subdirs
Creating subdirectories under current directory /home/oracle/OGG
Parameter files /home/oracle/OGG/dirprm: already exists
Report files /home/oracle/OGG/dirrpt: created
Checkpoint files /home/oracle/OGG/dirchk: created
Process status files /home/oracle/OGG/dirpcs: created
SQL script files /home/oracle/OGG/dirsql: created
Database definitions files /home/oracle/OGG/dirdef: created
Extract data files /home/oracle/OGG/dirdat: created
Temporary files /home/oracle/OGG/dirtmp: created
Stdout files /home/oracle/OGG/dirout: created
GGSCI (nerv07.localdomain) 2> exit
Agora vamos configurar os pré-requisitos no Oracle Database necessários para o Golden Gate, como modo ARCHIVELOG (que você já deve estar utilizando) e desabilitação da RECYCLE BIN.
Execute o procedimento apenas no servidor origem.
[oracle@nerv07 OGG]$ sqlplus / AS SYSDBA
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jul 10 12:00:28 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 939526256 bytes
Database Buffers 654311424 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> ALTER DATABASE ARCHIVELOG;
Database altered.
SQL> ALTER DATABASE OPEN;
Database altered.
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
SQL> ALTER SYSTEM SET RECYCLEBIN=OFF SCOPE=SPFILE;
System altered.
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 939526256 bytes
Database Buffers 654311424 bytes
Redo Buffers 7360512 bytes
Database mounted.
Database opened.
SQL>
Agora vamos criar o usuário no Oracle Database que o Golden Gate utilizará para extração e inserção de dados, e executar os scripts que preparam este usuário para estas operações. Repare que o nome do SCHEMA criado para o Golden Gate (OGG) será solicitado durante a execução dos scripts.
Execute o procedimento apenas no servidor origem.
SQL> CREATE USER OGG IDENTIFIED BY Nerv2012 DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
User created.
SQL> GRANT CONNECT, RESOURCE, UNLIMITED TABLESPACE TO OGG;
Grant succeeded.
SQL> GRANT EXECUTE ON UTL_FILE TO OGG;
Grant succeeded.
SQL> @/home/oracle/OGG/marker_setup.sql
Marker setup script
You will be prompted for the name of a schema for the Oracle GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter Oracle GoldenGate schema name:OGG
Marker setup table script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to OGG
MARKER TABLE
-------------------------------
OK
MARKER SEQUENCE
-------------------------------
OK
Script complete.
SQL> @/home/oracle/OGG/ddl_setup.sql
Oracle GoldenGate DDL Replication setup script
Verifying that current user has privileges to install DDL Replication...
You will be prompted for the name of a schema for the Oracle GoldenGate database objects.
NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter Oracle GoldenGate schema name:OGG
Working, please wait ...
Spooling to file ddl_setup_spool.txt
Checking for sessions that are holding locks on Oracle Golden Gate metadata tables ...
Check complete.
Using OGG as a Oracle GoldenGate schema name.
Working, please wait ...
DDL replication setup script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to OGG
CLEAR_TRACE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
CREATE_TRACE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
TRACE_PUT_LINE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
INITIAL_SETUP STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDLVERSIONSPECIFIC PACKAGE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDLREPLICATION PACKAGE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDLREPLICATION PACKAGE BODY STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDL IGNORE TABLE
-----------------------------------
OK
DDL IGNORE LOG TABLE
-----------------------------------
OK
DDLAUXPACKAGE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDLAUX PACKAGE BODY STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
SYS.DDLCTXINFOPACKAGE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
SYS.DDLCTXINFOPACKAGE BODY STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDL HISTORY TABLE
-----------------------------------
OK
DDL HISTORY TABLE(1)
-----------------------------------
OK
DDL DUMP TABLES
-----------------------------------
OK
DDL DUMP COLUMNS
-----------------------------------
OK
DDL DUMP LOG GROUPS
-----------------------------------
OK
DDL DUMP PARTITIONS
-----------------------------------
OK
DDL DUMP PRIMARY KEYS
-----------------------------------
OK
DDL SEQUENCE
-----------------------------------
OK
GGS_TEMP_COLS
-----------------------------------
OK
GGS_TEMP_UK
-----------------------------------
OK
DDL TRIGGER CODE STATUS:
Line/pos Error
---------- -----------------------------------------------------------------
No errors No errors
DDL TRIGGER INSTALL STATUS
-----------------------------------
OK
DDL TRIGGER RUNNING STATUS
-----------------------------------
ENABLED
STAYMETADATA IN TRIGGER
-----------------------------------
OFF
DDL TRIGGER SQL TRACING
-----------------------------------
0
DDL TRIGGER TRACE LEVEL
-----------------------------------
0
LOCATION OF DDL TRACE FILE
------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/orcl/ORCL/trace/ggs_ddl_trace.log
Analyzing installation status...
STATUS OF DDL REPLICATION
------------------------------------------------------------------------------------------------------------------------
SUCCESSFUL installation of DDL Replication software components
Script complete.
SQL> @/home/oracle/OGG/role_setup.sql
GGS Role setup script
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:OGG
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO
where is the user assigned to the GoldenGate processes.
SQL> GRANT GGS_GGSUSER_ROLE TO OGG;
Grant succeeded.
SQL> @/home/oracle/OGG/ddl_enable.sql
Trigger altered.
SQL> EXIT;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Agora iremos configurar o processo Manager do Golden Gate, um processo necessário que controla todos os outros processos do Golden Gate.
Execute o procedimento abaixo nos dois servidores.
[oracle@nerv07 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 (nerv07.localdomain) 1> edit params mgr
Este comando irá abrir com o editor do ambiente (no caso do Red Hat Enterprise Linux, o vi) o arquivo de configuração invocado, onde a seguinte linha deve ser adicionada:
PORT 7809
Este é o parâmetro mínimo que o Golden Gate precisa para funcionar. Em seguida, salve o arquivo e prossiga com o início do Manager.
Execute o procedimento abaixo nos dois servidores.
GGSCI (nerv07.localdomain) 2> start manager
Manager started.
GGSCI (nerv07.localdomain) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
GGSCI (nerv07.localdomain) 4>
Agora vamos configurar o processo EXTRACT que como nome sugere, extrai os comandos SQL do banco de dados origem.
Execute o procedimento abaixo apenas no servidor origem.
GGSCI (nerv07.localdomain) 4> add extract ext1, tranlog, begin now
EXTRACT added.
GGSCI (nerv07.localdomain) 5> add exttrail /home/oracle/OGG/dirdat/lt, extract ext1
EXTTRAIL added.
GGSCI (nerv07.localdomain) 6> edit params ext1
Este comando irá abrir com o editor do ambiente (no caso do Red Hat Enterprise Linux, o vi) o arquivo de configuração invocado, onde as seguintes linhas devem ser adicionadas:
extract ext1
userid OGG, password Nerv2012
rmthost nerv08, mgrport 7809
rmttrail /home/oracle/OGG/dirdat/lt
ddl include mapped objname SOE.*;
table SOE.*;
Com o arquivo de configuração criado, confira a criação do processo EXTRACT com o comando info all.
Execute o procedimento abaixo apenas no servidor origem.
GGSCI (nerv07.localdomain) 7> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:03:05
GGSCI (nerv07.localdomain) 8>
Este é o momento de duplicar seu banco de dados do servidor origem para o destino.
Qualquer método para isto é válido neste momento. Pode ser um BACKUP e RESTORE / RECOVER via RMAN, BEGIN BACKUP, ou mesmo um EXP / IMP ou EXPDP / IMPDP, e há também alguns métodos para fazer isso diretamente pelo Golden Gate. O Golden Gate irá replicar a diferença entre os dois bancos. No meu caso, utilizei o procedimento por RMAN.
Após ter uma cópia estática do banco de dado origem no destino, precisamos fazer a configuração do processo REPLICAT no destino, que faz a aplicação das alterações executadas na origem.
Execute o procedimento abaixo apenas no servidor destino.
[oracle@nerv08 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 (nerv08.localdomain) 1> edit params ./GLOBAL
Este comando irá abrir com o editor do ambiente (no caso do Red Hat Enterprise Linux, o vi) o arquivo de configuração invocado, onde as seguintes linhas devem ser adicionadas:
Execute o procedimento abaixo apenas no servidor destino.
GGSCHEMA OGG CHECKPOINTTABLE OGG.checkpoint
Em seguida, prossiga com a configuração do processo EXTRACT.
Execute o procedimento abaixo apenas no servidor destino.
GGSCI (nerv08.localdomain) 2> dblogin userid OGG
Password:
Successfully logged into database.
GGSCI (nerv08.localdomain) 3> add checkpointtable OGG.checkpoint
Successfully created checkpoint table OGG.checkpoint.
GGSCI (nerv08.localdomain) 4> add replicat rep1, exttrail /home/oracle/OGG/dirdat/lt,checkpointtable OGG.checkpoint
REPLICAT added.
GGSCI (nerv08.localdomain) 5> edit params rep1
Este comando irá abrir com o editor do ambiente (no caso do Red Hat Enterprise Linux, o vi) o arquivo de configuração invocado, onde as seguintes linhas devem ser adicionadas:
Execute o procedimento abaixo apenas no servidor destino.
replicat rep1 ASSUMETARGETDEFS userid OGG, password Nerv2012 discardfile /home/oracle/OGG/discard/rep1_discard.txt, append, megabytes 10 DDL map SOE.*, target SOE.*;
Com o arquivo de configuração criado, confira a criação do processo REPLICAT com o comando info all.
Execute o procedimento abaixo apenas no servidor origem.
GGSCI (nerv08.localdomain) 6> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP1 00:00:00 00:07:01
GGSCI (nerv08.localdomain) 7>
Após termos configurado os dois lados, é hora de iniciar os processos EXTRACT (na origem) e REPLICAT (no destino).
Vamos primeiro iniciar o REPLICAT.
Execute o procedimento abaixo apenas no servidor origem.
[oracle@nerv07 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 (nerv07.localdomain) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:33:22
GGSCI (nerv07.localdomain) 2> start extract ext1
Sending START request to MANAGER ...
EXTRACT EXT1 starting
GGSCI (nerv07.localdomain) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:36:35
GGSCI (nerv07.localdomain) 4>
O início e execução do processo EXTRACT pode ser acompanhado no log do Golden Gate, como está abaixo.
[oracle@nerv07 ~]$ tail -f /home/oracle/OGG/ggserr.log 2012-07-10 12:17:44 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start manager.
2012-07-10 12:17:44 INFO OGG-00983 Oracle GoldenGate Manager for Oracle, mgr.prm: Manager started (port 7809).
2012-07-10 12:18:13 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): add extract ext1 tranlog, begin now.
2012-07-10 12:19:03 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): add exttrail /home/oracle/OGG/dirdat/lt extract ext1.
2012-07-10 12:19:18 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): edit params ext1.
2012-07-10 12:54:44 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start extract ext1.
2012-07-10 12:54:44 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm: Command received from GGSCI on host nerv07 (START EXTRACT EXT1 ).
2012-07-10 12:54:44 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: EXTRACT EXT1 starting.
2012-07-10 12:54:45 INFO OGG-00992 Oracle GoldenGate Capture for Oracle, ext1.prm: EXTRACT EXT1 starting.
2012-07-10 12:54:45 INFO OGG-03035 Oracle GoldenGate Capture for Oracle, ext1.prm: Operating system character set identified as UTF-8. Locale: pt_BR, LC_ALL:.
2012-07-10 12:54:45 INFO OGG-03500 Oracle GoldenGate Capture for Oracle, ext1.prm: WARNING: NLS_LANG environment variable does not match database character set, or not set. Using database character set value of WE8MSWIN1252.
2012-07-10 12:54:45 INFO OGG-01635 Oracle GoldenGate Capture for Oracle, ext1.prm: BOUNDED RECOVERY: reset to initial or altered checkpoint.
2012-07-10 12:54:45 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, ext1.prm: Virtual Memory Facilities for: BR
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/home/oracle/OGG/BR/EXT1.
2012-07-10 12:54:45 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, ext1.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/home/oracle/OGG/dirtmp.
2012-07-10 12:54:46 WARNING OGG-01423 Oracle GoldenGate Capture for Oracle, ext1.prm: No valid default archive log destination directory found for thread 1.
2012-07-10 12:54:46 INFO OGG-01515 Oracle GoldenGate Capture for Oracle, ext1.prm: Positioning to begin time 10/07/2012 12:18:13.
2012-07-10 12:54:46 INFO OGG-01516 Oracle GoldenGate Capture for Oracle, ext1.prm: Positioned to Sequence 2, RBA 32793616, SCN 0.0, 10/07/2012 12:18:13.
2012-07-10 12:54:46 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, ext1.prm: EXTRACT EXT1 started.
2012-07-10 12:54:51 INFO OGG-01226 Oracle GoldenGate Capture for Oracle, ext1.prm: Socket buffer size set to 27985 (flush size 27985).
2012-07-10 12:54:51 INFO OGG-01052 Oracle GoldenGate Capture for Oracle, ext1.prm: No recovery is required for target file /home/oracle/OGG/dirdat/lt000000, at RBA 0 (file not opened).
2012-07-10 12:54:51 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, ext1.prm: Output file /home/oracle/OGG/dirdat/lt is using format RELEASE 11.2.
2012-07-10 12:54:52 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, ext1.prm: Position of first record processed Sequence 2, RBA 32793616, SCN 0.960029, 10/07/2012 12:18:18.
Agora vamos iniciar o REPLICAT no servidor destino.
Execute o procedimento abaixo apenas no servidor destino.
[oracle@nerv08 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 (nerv08.localdomain) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP1 00:00:00 00:23:51
GGSCI (nerv08.localdomain) 2> start replicat rep1
Sending START request to MANAGER ...
REPLICAT REP1 starting
GGSCI (nerv08.localdomain) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:01
GGSCI (nerv08.localdomain) 4>
Da mesma forma, podemos acompanhar o início e execução com sucesso do processo REPLICAT no servidor destino através do log do Golden Gate.
[oracle@nerv08 ~]$ tail -f /home/oracle/OGG/ggserr.log
2012-07-10 13:04:43 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start replicat rep1.
2012-07-10 13:04:43 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm: Command received from GGSCI on host nerv08 (START REPLICAT REP1 ).
2012-07-10 13:04:43 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: REPLICAT REP1 starting.
2012-07-10 13:04:43 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, rep1.prm: REPLICAT REP1 starting.
2012-07-10 13:04:43 INFO OGG-03035 Oracle GoldenGate Delivery for Oracle, rep1.prm: Operating system character set identified as UTF-8. Locale: pt_BR, LC_ALL:.
2012-07-10 13:04:43 INFO OGG-03501 Oracle GoldenGate Delivery for Oracle, rep1.prm: WARNING: NLS_LANG environment variable is invalid or not set. Using operating system character set value of AL32UTF8.
2012-07-10 13:04:43 INFO OGG-01815 Oracle GoldenGate Delivery for Oracle, rep1.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/home/oracle/OGG/dirtmp.
2012-07-10 13:04:44 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rep1.prm: REPLICAT REP1 started.
Para acompanhar o LAG (atraso) do processo EXTRACT, utilize o comando lag no servidor origem.
[oracle@nerv07 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 (nerv07.localdomain) 1> lag extract *
Sending GETLAG request to EXTRACT EXT1 ...
Last record lag: 34 seconds.
GGSCI (nerv07.localdomain) 2>
Para acompanhar o LAG (atraso) do processo REPLICAT, utilize o comando lag no servidor destino.
[oracle@nerv08 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 (nerv08.localdomain) 1> lag replicat *
Sending GETLAG request to REPLICAT REP1 ...
Last record lag: 79 seconds.
GGSCI (nerv08.localdomain) 2>
Para conferir o volume replicado, o comando STATS informa diversas estatísticas do processo EXTRACT, ao ser executado no servidor origem.
GGSCI (nerv07.localdomain) 2> stats extract *
Sending STATS request to EXTRACT EXT1 ...
Start of Statistics at 2012-07-10 13:16:05.
DDL replication statistics (for all trails):
*** Total statistics since extract started ***
Operations 16.00
Mapped operations 9.00
Unmapped operations 2.00
Other operations 5.00
Excluded operations 7.00
Output to /home/oracle/OGG/dirdat/lt:
Extracting from OGG.GGS_MARKER to OGG.GGS_MARKER:
*** Total statistics since 2012-07-10 12:54:54 ***
No database operations have been performed.
*** Daily statistics since 2012-07-10 12:54:54 ***
No database operations have been performed.
*** Hourly statistics since 2012-07-10 13:00:00 ***
No database operations have been performed.
*** Latest statistics since 2012-07-10 12:54:54 ***
No database operations have been performed.
Extracting from SOE.ORDER_ITEMS to SOE.ORDER_ITEMS:
*** Total statistics since 2012-07-10 12:54:54 ***
Total inserts 2893406.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 2893406.00
*** Daily statistics since 2012-07-10 12:54:54 ***
Total inserts 2893406.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 2893406.00
*** Hourly statistics since 2012-07-10 13:00:00 ***
Total inserts 2893406.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 2893406.00
*** Latest statistics since 2012-07-10 12:54:54 ***
Total inserts 2893406.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 2893406.00
End of Statistics.
GGSCI (nerv07.localdomain) 3>
Para conferir o volume replicado, o comando STATS informa diversas estatísticas do processo REPLICAT, ao ser executado no servidor destino.
GGSCI (nerv08.localdomain) 2> stats replicat *
Sending STATS request to REPLICAT REP1 ...
Start of Statistics at 2012-07-10 13:15:17.
DDL replication statistics:
*** Total statistics since replicat started ***
Operations 9.00
Mapped operations 9.00
Unmapped operations 0.00
Other operations 0.00
Excluded operations 0.00
Errors 0.00
Retried errors 0.00
Discarded errors 0.00
Ignored errors 0.00
Replicating from SOE.ORDER_ITEMS to SOE.ORDER_ITEMS:
*** Total statistics since 2012-07-10 13:13:55 ***
Total inserts 739819.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 739819.00
*** Daily statistics since 2012-07-10 13:13:55 ***
Total inserts 739819.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 739819.00
*** Hourly statistics since 2012-07-10 13:13:55 ***
Total inserts 739819.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 739819.00
*** Latest statistics since 2012-07-10 13:13:55 ***
Total inserts 739819.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 739819.00
End of Statistics.
GGSCI (nerv08.localdomain) 3>
Após iniciar uma boa carga de dados na origem (um IMP de 1GB), posso conferir no log do Golden Gate do servidor origem a criação de arquivos STAGE e sua utilização.
2012-07-10 13:16:12 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /home/oracle/OGG/dirdat/lt000005.
2012-07-10 13:16:36 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /home/oracle/OGG/dirdat/lt000006.
2012-07-10 13:17:00 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /home/oracle/OGG/dirdat/lt000007.
2012-07-10 13:17:23 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /home/oracle/OGG/dirdat/lt000008.
2012-07-10 13:17:49 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /home/oracle/OGG/dirdat/lt000009.
2012-07-10 13:18:09 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext1.prm: Rolling over remote file /home/oracle/OGG/dirdat/lt000010.
E no servidor destino posso conferir, também pelo log do Golden Gate, a abertura e utilização dos arquivos STAGE replicados.
2012-07-10 13:17:30 INFO OGG-01669 Oracle GoldenGate Collector for Oracle: Opening /home/oracle/OGG/dirdat/lt000010 (byte -1, current EOF 0).
2012-07-10 13:17:52 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000010 to disk.
2012-07-10 13:17:52 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000010 to disk.
2012-07-10 13:17:52 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /home/oracle/OGG/dirdat/lt000010.
2012-07-10 13:17:52 INFO OGG-01669 Oracle GoldenGate Collector for Oracle: Opening /home/oracle/OGG/dirdat/lt000011 (byte -1, current EOF 0).
2012-07-10 13:18:23 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000011 to disk.
2012-07-10 13:18:24 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000011 to disk.
2012-07-10 13:18:24 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /home/oracle/OGG/dirdat/lt000011.
2012-07-10 13:18:24 INFO OGG-01669 Oracle GoldenGate Collector for Oracle: Opening /home/oracle/OGG/dirdat/lt000012 (byte -1, current EOF 0).
2012-07-10 13:18:44 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000012 to disk.
2012-07-10 13:18:44 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000012 to disk.
2012-07-10 13:18:44 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /home/oracle/OGG/dirdat/lt000012.
2012-07-10 13:18:46 INFO OGG-01669 Oracle GoldenGate Collector for Oracle: Opening /home/oracle/OGG/dirdat/lt000013 (byte -1, current EOF 0).
2012-07-10 13:19:13 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000013 to disk.
2012-07-10 13:19:13 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /home/oracle/OGG/dirdat/lt000013 to disk.
2012-07-10 13:19:13 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /home/oracle/OGG/dirdat/lt000013.
Bem, é isso. Esta foi uma forma simples de fazer uma replicação via Golden Gate e verificar o seu funcionamento. Espero que ajude!