top of page

Goldengate Initial Load with Datapump

OmerNarman
Mar 8
3 min read

Updated: Oct 24

Start Extract and Pump processes on the source database


A. Export Schema on Source Database

— Create Directory

SQL

SQL> create directory init_load_dir as '/u02/install/init_load_dir';

Directory created.

SQL> !mkdir -p /u02/install/init_load_dir

SQL> exit


— Get current_scn of the source database

SQL

select current_scn from v$database;


— Export Parameter File: Add flashback_scn parameter with the value from current_scn

Shell

[oracle@srvogg1 init_load_dir]$ cat init_load_hr_exp.par

DUMPFILE=init_load_exp_hr.dmp

LOGFILE=init_load_exp_hr.log

flashback_scn=2240100

SCHEMAS=HR

DIRECTORY=init_load_dir


— Set Env Variables to PDB

Shell

export ORACLE_PDB_SID=MADRIDPDB


— Initiate the export

SQL

Export: Release 19.0.0.0.0 - Production Version 19.23.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

FLASHBACK automatically enabled to preserve database integrity.

Starting "SYS"."SYS_EXPORT_SCHEMA_01": "/******** AS SYSDBA" parfile=init_load_hr_exp.par

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type SCHEMA_EXPORT/STATISTICS/MARKER

Processing object type SCHEMA_EXPORT/USER

Processing object type SCHEMA_EXPORT/SYSTEM_GRANT

Processing object type SCHEMA_EXPORT/ROLE_GRANT

Processing object type SCHEMA_EXPORT/DEFAULT_ROLE

Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE

Processing object type SCHEMA_EXPORT/TABLE/PROCACT_INSTANCE

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/COMMENT

Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE

Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE

Processing object type SCHEMA_EXPORT/VIEW/VIEW

Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/TRIGGER

. . exported "HR"."EMPLOYEES" 17.08 KB 107 rows

. . exported "HR"."LOCATIONS" 8.437 KB 23 rows

. . exported "HR"."JOB_HISTORY" 7.195 KB 10 rows

. . exported "HR"."JOBS" 7.109 KB 19 rows

. . exported "HR"."DEPARTMENTS" 7.125 KB 27 rows

. . exported "HR"."COUNTRIES" 6.367 KB 25 rows

. . exported "HR"."REGIONS" 5.546 KB 4 rows

Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded

******************************************************************************

Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:

/u02/install/init_load_dir/init_load_exp_hr.dmp

Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed


— Copy the pump to the target

Shell

[oracle@srvogg1 init_load_dir]$ scp *.dmp oracle@srvogg2:/u02/install/init_load_dir

oracle@srvogg2's password:

init_load_exp_hr.dmp 100% 716KB 75.9MB/s 00:00

[oracle@srvogg1 init_load_dir]$


B. Import Schema on Target Database

— Create directory

SQL

SQL> create or replace directory init_load_dir as '/u02/install/init_load_dir';

Directory created.

SQL>


— Import Parameter File

Shell

[oracle@srvogg2 init_load_dir]$ cat init_load_hr_imp.par

DUMPFILE=init_load_exp_hr.dmp

LOGFILE=init_load_imp_hr.log

SCHEMAS=HR

DIRECTORY=init_load_dir


— Initiate the import

SQL

[oracle@srvogg2 init_load_dir]$ impdp \'/as sysdba\' parfile=init_load_hr_imp.par

Import: Release 19.0.0.0.0 - Production Version 19.23.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Master table "SYS"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded

Starting "SYS"."SYS_IMPORT_SCHEMA_01": "/******** AS SYSDBA" parfile=init_load_hr_imp.par

Processing object type SCHEMA_EXPORT/USER

Processing object type SCHEMA_EXPORT/SYSTEM_GRANT

Processing object type SCHEMA_EXPORT/ROLE_GRANT

Processing object type SCHEMA_EXPORT/DEFAULT_ROLE

Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE

Processing object type SCHEMA_EXPORT/TABLE/PROCACT_INSTANCE

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "HR"."EMPLOYEES" 17.08 KB 107 rows

. . imported "HR"."LOCATIONS" 8.437 KB 23 rows

. . imported "HR"."JOB_HISTORY" 7.195 KB 10 rows

. . imported "HR"."JOBS" 7.109 KB 19 rows

. . imported "HR"."DEPARTMENTS" 7.125 KB 27 rows

. . imported "HR"."COUNTRIES" 6.367 KB 25 rows

. . imported "HR"."REGIONS" 5.546 KB 4 rows

Processing object type SCHEMA_EXPORT/TABLE/COMMENT

Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE

Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE

Processing object type SCHEMA_EXPORT/VIEW/VIEW

Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/TRIGGER

Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type SCHEMA_EXPORT/STATISTICS/MARKER

Job "SYS"."SYS_IMPORT_SCHEMA_01" successfully completed


C. Start Replicat with the scn from flashback_scn

SQL

GGSCI (srvogg2) 74> start replicat REP_HR aftercsn 2240100

-- Check Lag

GGSCI (srvogg2) 76> lag replicat REP_HR

Sending GETLAG request to REPLICAT REP_HR ...

Last record lag: 5 seconds.

Low watermark lag: 1 second.

High watermark lag: 9 seconds.

Low watermark position: 2509308.

High watermark position: 2509643.

At EOF, no more records to process

GGSCI (srvogg2) 77>

Recent Posts

See All

Comments


bottom of page