Loading Data from File to Replicat

To use Replicat to establish the target data, you use an initial-load Extract to extract source records from the source tables and write them to an extract file in canonical format. From the file, an initial-load Replicat loads the data using the database interface. During the load, the change-synchronization groups extract and replicate incremental changes, which are then reconciled with the results of the load.

During the load, the records are applied to the target database one record at a time, so this method is considerably slower than any of the other initial load methods. This method permits data transformation to be done on either the source or target system.

You can also use the Microservices Architecture to load data from file to Replicat. See Instantiating Oracle GoldenGate Using Initial Load.

To Load Data From File to Replicat

  1. Make certain that you have addressed the requirements in Prerequisites for Initial Load.
  2. On the source and target systems, run GGSCI and start Manager.
    START MANAGER

    Note:

    In a Windows cluster, start the Manager resource from the Cluster Administrator.

  3. On the source system, issue the following command to create an initial-load Extract parameter file.
    EDIT PARAMS initial-load_Extract
    
  4. Enter the parameters in the same order as shown in the following example, starting a new line for each parameter statement. The following is a sample initial-load Extract parameter file for loading data from file to Replicat.
    SOURCEISTABLE
    SOURCEDB mydb, USERIDALIAS ogg
    RMTHOSTOPTIONS ny4387, MGRPORT 7888, ENCRYPT AES 192 KEYNAME mykey
    ENCRYPTTRAIL AES192
    RMTFILE /ggs/dirdat/initld, MEGABYTES 2, PURGE
    TABLE hr.*;
    TABLE sales.*;
    
    Parameter Description
    SOURCEISTABLE

    Designates Extract as an initial load process extracting records directly from the source tables.

    SOURCEDB dsn [, USERIDALIAS alias, options |
    , USERID user, options]

    Specifies database connection information.

    SOURCEDB specifies the source data source name (DSN).

    USERID and USERIDALIAS specify database credentials if required.

    RMTHOSTOPTIONS hostname,
    MGRPORT portnumber
    [, ENCRYPT algorithm KEYNAME keyname]

    Specifies the target system, the port where Manager is running, and optional encryption of data across TCP/IP.

    ENCRYPTTRAIL algorithm

    Encrypts the data in the remote file.

    RMTFILE path,
    [MEGABYTES n]
    
    • path is the relative or fully qualified name of the file.

    • MEGABYTES designates the size of each file.

    Specifies the extract file to which the load data will be written. Oracle GoldenGate creates this file during the load. Checkpoints are not maintained with RMTFILE.

    Note that the size of an extract file cannot exceed 2GB.

    TABLE container.owner.object;

    Specifies the fully qualified name of an object or a fully qualified wildcarded specification for multiple objects. If the database is an Oracle multitenant container database, the object name must include the name of the container or catalog unless SOURCECATALOG is used.

    See Specifying Object Names in Oracle GoldenGate Input for guidelines for specifying object names in parameter files.

    CATALOGEXCLUDE

    SCHEMAEXCLUDE

    TABLEEXCLUDE

    EXCLUDEWILDCARDOBJECTSONLY

    Parameters that can be used in conjunction with one another to exclude specific objects from a wildcard specification in the associated TABLE statement.

  5. Enter any appropriate optional Extract parameters listed in the Reference for Oracle GoldenGate.
  6. Save and close the parameter file.
  7. On the target system, issue the following command to create an initial-load Replicat parameter file.
    EDIT PARAMS initial-load_Replicat
    
  8. Enter the parameters listed in Table 7-1 in the order shown, starting a new line for each parameter statement. The following is a sample initial-load Replicat parameter file for loading data from file to Replicat.
    SPECIALRUN
    END RUNTIME
    TARGETDB mydb, USERIDALIAS ogg
    EXTFILE /ggs/dirdat/initld
    SOURCEDEFS /ggs/dirdef/source_defs
    MAP hr.*, TARGET hr.*;
    MAP sales.*, TARGET hr.*;
    

    Table 7-1 Initial-load Replicat parameters

    Parameter Description
    SPECIALRUN

    Implements the initial-load Replicat as a one-time run that does not use checkpoints.

    END RUNTIME

    Directs the initial-load Replicat to terminate when the load is finished.

    TARGETDB dsn 
    [, USERIDALIAS alias, options |
    , USERID user, options]

    Specifies database connection information.

    TARGETDB specifies the target data source name (DSN).

    USERID and USERIDALIAS specify database credentials if required.

    EXTFILE path
    • path is the relative or fully qualified name of the file.

    Specifies the input extract file specified with the Extract parameter RMTFILE.

    {SOURCEDEFS file} |
    ASSUMETARGETDEFS
    • Use SOURCEDEFS if the source and target tables have different definitions. Specify the relative or fully qualified name of the source-definitions file generated by DEFGEN.

    • Use ASSUMETARGETDEFS if the source and target tables have the same definitions.

    Specifies how to interpret data definitions.

    SOURCECATALOG

    Specifies a default source Oracle container. Enables the use of two-part names (schema.object) where three-part names otherwise would be required for those databases. You can use multiple instances of this parameter to specify different default containers or catalogs for different sets of MAP parameters.

    MAP container.owner.object,
    TARGET owner.object[, DEF template]
    ;

    Specifies a relationship between a source object or objects and a target object or objects. MAP specifies the source object, and TARGET specifies the target object.

    For the source object, specify the fully qualified name of the object or a fully qualified wildcarded specification for multiple objects. For an Oracle multitenant container database, the source object name must include the name of the container or catalog unless SOURCECATALOG is used.

    For the target object, specify only the owner.object components of the name, regardless of the database. Replicat can only connect to one Oracle container. Use a separate Replicat process for each container or catalog to which you want to load data.

    See Specifying Object Names in Oracle GoldenGate Input for guidelines for specifying object names in parameter files.

    The DEF option specifies a definitions template.

    CATALOGEXCLUDE

    SCHEMAEXCLUDE

    MAPEXCLUDE

    EXCLUDEWILDCARDOBJECTSONLY

    Parameters that can be used in conjunction with one another to exclude specific source objects from a wildcard specification in the associated MAP statement..

  9. Enter any appropriate optional Replicat parameters listed in the Reference for Oracle GoldenGate.
  10. Save and close the file.
  11. View the Replicat parameter file to make certain that the HANDLECOLLISIONS parameter is listed. If not, add the parameter to the file.
  12. On the source system, start change extraction.
    START EXTRACT group
    
  13. (Oracle, if replicating sequences) Issue the DBLOGIN command as the user who has EXECUTE privilege on update.Sequence.
    GGSCI> DBLOGIN USERID DBLOGINuser, PASSWORD password [encryption_options]
    
  14. (Oracle, if replicating sequences) Issue the following command to update each source sequence and generate redo. From the redo, Replicat performs initial synchronization of the sequences on the target. You can use an asterisk wildcard for any or all characters in the name of a sequence (but not the owner).
    FLUSH SEQUENCE owner.sequence
    
  15. From the directory where Oracle GoldenGate is installed on the source system, start the initial-load Extract.

    UNIX and Linux:

    $ /GGS directory/extract paramfile dirprm/initial-load_Extract.prm reportfile path
    

    Windows:

    C:\> GGS directory\extract paramfile dirprm\initial-load_Extract.prm reportfile path
    

    Where:

    initial-load_Extract is the name of the initial-load Extract that you used when creating the parameter file, and path is the relative or fully qualified name of the Extract report file.

  16. Verify the progress and results of the initial extraction by viewing the Extract report file using the operating system's standard method for viewing files.
  17. Wait until the initial extraction is finished.
  18. On the target system, start the initial-load Replicat.

    UNIX and Linux:

    $ /GGS directory/replicat paramfile dirprm/initial-load_Replicat.prm reportfile path
    

    Windows:

    C:\> GGS directory\replicat paramfile dirprm\initial-load_Replicat.prm reportfile path
    

    Where:

    initial-load_Replicat is the name of the initial-load Replicat that you used when creating the parameter file, and path is the relative or fully qualified name of the Replicat report file.

  19. When the initial-load Replicat is finished running, verify the results by viewing the Replicat report file using the operating system's standard method for viewing files.
  20. On the target system, start change replication.
    START REPLICAT group
    
  21. On the target system, issue the following command to verify the status of change replication.
    INFO REPLICAT group
    
  22. Continue to issue the INFO REPLICAT command until you have verified that Replicat posted all of the change data that was generated during the initial load. For example, if the initial-load Extract stopped at 12:05, make sure Replicat posted data up to that point.
  23. On the target system, issue the following command to turn off the HANDLECOLLISIONS parameter and disable the initial-load error handling.
    SEND REPLICAT group, NOHANDLECOLLISIONS
    
  24. On the target system, edit the Replicat parameter file to remove the HANDLECOLLISIONS parameter. This prevents HANDLECOLLISIONS from being enabled again the next time Replicat starts.

    Caution:

    Do not use the VIEW PARAMS or EDIT PARAMS command to view or edit an existing parameter file that is in a character set other than that of the local operating system (such as one where the CHARSET option was used to specify a different character set). View the parameter file from outside GGSCI if this is the case; otherwise, the contents may become corrupted.

  25. Save and close the parameter file.

    From this point forward, Oracle GoldenGate continues to synchronize data changes.