Oracle Goldengate 11g Complete Cookbook
上QQ阅读APP看书,第一时间看更新

Configuring an Extract process to read from an Oracle ASM instance

If your source database is on ASM and the archive logs reside in an ASM diskgroup, the GoldenGate extract requires some additional configuration to be able to read them. In this recipe we will look at the additional parameters that you need to specify in the extract parameter file for this.

How to do it…

The setup required for reading archive logs from ASM depends on the version of the source database.

For Oracle 10gR2 (10.2.0.5 or later) / Oracle 11gR2 (11.2.0.2 or later):

  1. Modify the extract parameter files to use the TRANSLOGOPTIONS parameter:
    ./ggsci
    EDIT PARAMS EGGTEST1
    EXTRACT EGGTEST1
    USERID GGATE_ADMIN@DBORATEST, PASSWORD AADAAAAAAAAAAAFAQCFIIDLCUELFNFECLITBSCAHYBBHHEUGKDNICDCCDCFELJDJFFEAUHUBFGWIUJGCAJJDNDPDZEOHGILBIIWCUIBHHGPBKBHB, AES256, ENCRYPTKEY dbkey1
    EXTTRAIL /u01/app/ggate/dirdat/st
    TRANSLOGOPTIONS DBLOGREADER
    TABLE scott.*;
  2. Save the file and exit the editor window.
  3. Start the Extract process:
    GGSCI> START EGGTEST1

For Oracle 10gR2 (10.2.0.4 or earlier) / Oracle 11gR2(11.2.0.1 or earlier):

  1. Add the following entry to tnsnames.ora to enable a bequeath connection for ASM:
    ASM = 
    (DESCRIPTION = 
    (ADDRESS = (PROTOCOL = BEQ) 
    (PROGRAM = <ORACLE_HOME>/bin/oracle) 
    (ARGV0 = oracle+ASM1) 
    (ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))') 
    (ENVS = 'ORACLE_HOME=<ORACLE_HOME>/asm,ORACLE_SID=+ASM1')
    ) 
    (CONNECT_DATA = 
    (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM1)))
  2. Encrypt the ASM sys user password:
    ./ggsci
    encrypt password helloworld AES256, encryptkey dbkey1
    Encrypted password:  AADAAAAAAAAAAAKAHBABQBPFFEVGRHGIFFBAQHSHGDCHKCTFFCQHKCPCFCKJSGPIPJWDQAGHRCQBZEQFOGUELCTDPDEJMBDJBJWAOGEJJEQHBCEF
    Algorithm used:  AES256
  3. Modify the process parameter files to use the TRANSLOGOPTIONS parameter with an encrypted password:
    ./ggsci
    EDIT PARAMS EGGTEST1
    EXTRACT EGGTEST1
    USERID GGATE_ADMIN@DBORATEST, PASSWORD AADAAAAAAAAAAAFAQCFIIDLCUELFNFECLITBSCAHYBBHHEUGKDNICDCCDCFELJDJFFEAUHUBFGWIUJGCAJJDNDPDZEOHGILBIIWCUIBHHGPBKBHB, AES256, ENCRYPTKEY dbkey1
    EXTTRAIL /u01/app/ggate/dirdat/st
    TRANLOGOPTIONS ASMUSER SYS@ASM, ASMPASSWORD AADAAAAAAAAAAAFAQCFIIDLCUELFNFECLITBSCAHYBBHHEUGKDNICDCCDCFELJDJFFEAUHUBFGWIUJGCAJJDNDPDZEOHGILBIIWCUIBHHGPBKBHB, AES256, ENCRYPTKEY dbkey1
    TABLE scott.*;
  4. Save the file and exit the editor window.
  5. Start the Extract process:
    GGSCI> START EGGTEST1

How it works…

For the newer Oracle 10gR2 and 11gR2 versions, GoldenGate connects through the database instance to read the archived log files in the ASM diskgroup. This enables the Extract process to read the archived logs in a much more efficient way than the old way of accessing it directly through an ASM instance.

If your database is on Oracle 10gR2 (10.2.0.5 or earlier) or 11g (11.2.0.1 or earlier), then you must configure an ASM user with sysdba privileges in the extract configuration to enable it to login to an ASM instance and read the redo/archived logs. You can specify the ASM user password in the extract configuration file, however, the best practice is to encrypt the password using the encrypt tool, as done in step 2 in the previous section, and specify the generated key in the parameter files.

Tip

Although in the newer Oracle releases you don't need to configure the ASM user in the extract configuration, it is recommended to configure both the ways to enable the extract to continue processing archived logs in the event of a database instance not being available.

TRANSLOGOPTIONS DBLOGREADER
-- TRANSLOGOPTIONS ASMUSER SYS@ASM, PASSWORD *****

If the source database instance is not available and you still have archived logs which have not yet been mined, you can swap the TRANSLOGOPTIONS parameters to allow extract to access the ASM instance directly.