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
- Make certain that you have addressed the requirements in Prerequisites for Initial Load.
- 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.
- On the source system, issue the following command to create an initial-load Extract parameter file.
EDIT PARAMSinitial-load_Extract - 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[, USERIDALIASalias, options| , USERIDuser,options]Specifies database connection information.
SOURCEDBspecifies the source data source name (DSN).USERIDandUSERIDALIASspecify database credentials if required.RMTHOSTOPTIONS
hostname, MGRPORTportnumber[, ENCRYPTalgorithmKEYNAMEkeyname]Specifies the target system, the port where Manager is running, and optional encryption of data across TCP/IP.
ENCRYPTTRAILalgorithmEncrypts the data in the remote file.
RMTFILE
path, [MEGABYTESn]-
pathis the relative or fully qualified name of the file. -
MEGABYTESdesignates 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
SOURCECATALOGis used.See Specifying Object Names in Oracle GoldenGate Input for guidelines for specifying object names in parameter files.
CATALOGEXCLUDESCHEMAEXCLUDETABLEEXCLUDEEXCLUDEWILDCARDOBJECTSONLYParameters that can be used in conjunction with one another to exclude specific objects from a wildcard specification in the associated
TABLEstatement. -
- Enter any appropriate optional Extract parameters listed in the Parameters and Functions Reference for Oracle GoldenGate.
- Save and close the parameter file.
- On the target system, issue the following command to create an initial-load Replicat parameter file.
EDIT PARAMSinitial-load_Replicat - Enter the parameters listed in Table 6-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 6-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[, USERIDALIASalias, options| , USERIDuser,options]Specifies database connection information.
TARGETDBspecifies the target data source name (DSN).USERIDandUSERIDALIASspecify database credentials if required.EXTFILEpath-
pathis the relative or fully qualified name of the file.
Specifies the input extract file specified with the Extract parameter
RMTFILE.{SOURCEDEFSfile} | ASSUMETARGETDEFS-
Use
SOURCEDEFSif the source and target tables have different definitions. Specify the relative or fully qualified name of the source-definitions file generated by DEFGEN. -
Use
ASSUMETARGETDEFSif the source and target tables have the same definitions.
Specifies how to interpret data definitions.
SOURCECATALOGSpecifies 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 ofMAPparameters.MAP
container.owner.object, TARGETowner.object[, DEFtemplate] ;Specifies a relationship between a source object or objects and a target object or objects.
MAPspecifies the source object, andTARGETspecifies 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
SOURCECATALOGis used.For the target object, specify only the
owner.objectcomponents 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
DEFoption specifies a definitions template.CATALOGEXCLUDESCHEMAEXCLUDEMAPEXCLUDEEXCLUDEWILDCARDOBJECTSONLYParameters that can be used in conjunction with one another to exclude specific source objects from a wildcard specification in the associated
MAPstatement.. -
- Enter any appropriate optional Replicat parameters listed in the Parameters and Functions Reference for Oracle GoldenGate.
- Save and close the file.
- View the Replicat parameter file to make certain that the
HANDLECOLLISIONSparameter is listed. If not, add the parameter to the file. - On the source system, start change extraction.
START EXTRACTgroup - (Oracle, if replicating sequences) Issue the
DBLOGINcommand as the user who hasEXECUTEprivilege onupdate.Sequence.GGSCI> DBLOGIN USERID DBLOGINuser, PASSWORD
password[encryption_options] - (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 SEQUENCEowner.sequence - 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 reportfilepathWindows:
C:\>
GGS directory\extract paramfile dirprm\initial-load_Extract.prm reportfilepathWhere:
initial-load_Extractis the name of the initial-load Extract that you used when creating the parameter file, andpathis the relative or fully qualified name of the Extract report file. - 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.
- Wait until the initial extraction is finished.
- On the target system, start the initial-load Replicat.
UNIX and Linux:
$ /
GGS directory/replicat paramfile dirprm/initial-load_Replicat.prm reportfilepathWindows:
C:\>
GGS directory\replicat paramfile dirprm\initial-load_Replicat.prm reportfilepathWhere:
initial-load_Replicatis the name of the initial-load Replicat that you used when creating the parameter file, andpathis the relative or fully qualified name of the Replicat report file. - 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.
- On the target system, start change replication.
START REPLICATgroup - On the target system, issue the following command to verify the status of change replication.
INFO REPLICATgroup - Continue to issue the
INFO REPLICATcommand 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. - On the target system, issue the following command to turn off the
HANDLECOLLISIONSparameter and disable the initial-load error handling.SEND REPLICATgroup, NOHANDLECOLLISIONS - On the target system, edit the Replicat parameter file to remove the
HANDLECOLLISIONSparameter. This preventsHANDLECOLLISIONSfrom being enabled again the next time Replicat starts.Caution:
Do not use the
VIEW PARAMSorEDIT PARAMScommand 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 theCHARSEToption 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. - Save and close the parameter file.
From this point forward, Oracle GoldenGate continues to synchronize data changes.
