Skip to main content
GoldenGate

How to run multiple commands in a script like spool in Golden Gate

By November 3, 2021August 28th, 2022No Comments2 min read

In our setup, we have around 600 tables out of thousands of tables to enable Bi-Directional replication. To do that lot of manual work is involved in the case of Manual Conflict, Detection & Resolution.
For example, to enable trandata for the 600 tables, we can’t run them one by one manually. Instead, GGSCI allows you to run hundreds of commands using the script like we generally execute in SQL*Plus.

Let’s follow the below steps to execute hundreds or thousands of commands from the scripts.

  1. Prepare the script ex: /home/oracle/working/600_add_trandata.log To enable the trandata
  2. Run the ggsci with the below syntax and specify the log location
  3. The main script will be called using obey
ORA-X1:(oracle):PRODS:/home/oracle/working> /u01/app/oracle/product/OGG_19.1.0/ogghome_1/ggsci <<EOF>> /home/oracle/working/600_add_trandata.log
> obey /home/oracle/working/600_add_trandata.sql
> exit
> EOF

— Script sample /home/oracle/working/600_add_trandata.sql

dblogin userid ggadmin@PRODS, password Welcome1
add trandata SCOTT.TABABONDEMENT allcols
add trandata SCOTT.TABABONDEMENT_HISTO allcols 
add trandata SCOTT.TABABONDEMENT_TRANCHE allcols 
add trandata SCOTT.TABABONDEMENT_TRANCHE_HISTO allcols 
add trandata SCOTT.TABACTIVITE allcols 
add trandata SCOTT.TABACTIVITE_DN allcols

Contents of the log file /home/oracle/working/600_add_trandata.log

GGSCI (ORA-X1 as ggadmin@PRODS) 131> add trandata SCOTT.TABGARANTIE_PMVALUE_SUPPORTS allcols


2021-06-12 13:39:51 INFO OGG-15132 Logging of supplemental redo data enabled for table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS.

2021-06-12 13:39:51 INFO OGG-15133 TRANDATA for scheduling columns has been added on table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS.

2021-06-12 13:39:51 INFO OGG-15134 TRANDATA for all columns has been added on table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS.

2021-06-12 13:39:51 INFO OGG-15135 TRANDATA for instantiation CSN has been added on table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS.

2021-06-12 13:39:51 INFO OGG-10471 ***** Oracle Goldengate support information on table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS ***** 
Oracle Goldengate support native capture on table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS.
Oracle Goldengate marked following column as key columns on table SCOTT.TABGARANTIE_PMVALUE_SUPPORTS: ID_DOSSIER, ID_GAR_SUPP_SECURE.

 

 

Leave a Reply