Oracle Data Pump: export and import data with expdp and impdp
Understand the basic flow of moving data between Oracle schemas using Data Pump.
You are reading a translated version.
When the Data Pump is needed
Data Pumps are useful when moving large amounts of data between Oracle servers, creating schema copies for staging environments, or backing up the structure and contents of tables before large migrations.
Exporting schema
expdp diarycoding/password@ORCLPDB \
schemas=DIARYCODING \
directory=DATA_PUMP_DIR \
dumpfile=diarycoding_%U.dmp \
logfile=export_diarycoding.log
directory refers to the object DIRECTORY which is already registered in Oracle and points to the physical folder on the server where the dump file is stored.
Creating directory object
CREATE OR REPLACE DIRECTORY data_pump_dir AS '/u01/app/oracle/dpdump';
GRANT READ, WRITE ON DIRECTORY data_pump_dir TO diarycoding;
Importing to destination scheme
impdp diarycoding/password@ORCLPDB \
directory=DATA_PUMP_DIR \
dumpfile=diarycoding_%U.dmp \
remap_schema=DIARYCODING:DIARYCODING_STAGING \
logfile=import_diarycoding.log
remap_schema moving objects to another schema without renaming the objects in the dump file, useful when copying production data to a staging environment with a different schema name.
Partial import only
Use parameters tables to import only certain tables, or query to filter imported rows without importing the entire contents of the table.
practice;
Try exporting only one table using parameters tables=NAMA_TABEL, then compare the size of the dump file with the export results of the entire scheme.
