Ben the DBA

Oracle Data Pump

Introduction to Oracle Data Pump

Oracle Data Pump is a powerful set of tools provided by Oracle Database for fast and efficient data movement. It includes:

These tools are commonly used for database migrations, backups, and data transfer between different environments (e.g., development, testing, and production).

Key Features of Oracle Data Pump

Getting Started

Here is the process to perform an expdp/impdp between two servers:

List the Schemas for the Application

The first step is to identify the schemas that need to be exported from the source server. You can use this command to retrive the exact schemas, you have to ask the application manager for them or aks to check if you found the right ones.


SELECT username, account_status, expiry_date FROM dba_users;

Identify or Create Data Pump Directory

To identify the data pump directory you can use this query:


SELECT * FROM all_directories;

If there is no directory for the data pump, you can use this query to create one. Make sure that the directory already existe.


create or replace directory DATA_PUMP_DIR as '/u03/FRA/dump';

Create the Parameter File (.par)

Place yourself in the DATA_PUMP_DIR, it's not required but it make the things easier.


cd /u03/FRA/dump
vi expdp_instance1.par

Create a parfile with your parameters like bellow.


schemas=user1,user2,user3
directory=DATA_PUMP_DIR 
dumpfile=instance1_09082024.dmp 
logfile=instance1_09082024.log
flashback_time=systimestamp

Verify Available Disk Space

First you have to connect localy, you can use the user system or as sysdba, it's not recommended but this is what we're doing when we don't have the password. Set the ORACLE_SID


. oraenv

start the estimation:


expdp \"/ as sysdba\" estimate_only=y parfile=expdp_instance1.par

After having the estimation. let's check if you have enough space on the disk.


df -h

Run expdp

If you have enough space, we can start the export:


expdp \"/ as sysdba\" parfile=expdp_instance1.par

Transfert the file

There is few ways to transfert the file: On linux you can use sftp or scp. On windows you can copy past from the RDP session or via SMB.

Identify or Create Data Pump Directory

You have to do as I showed you above, it's exacly the same on the destination server. Place the dump in this directory.

Create the Parameter File (.par)

Place yourself in the DATA_PUMP_DIR, it's not required but it make the things easier.


cd /u03/FRA/dump
vi impdp_instance1.par

Create a parfile with your parameters like bellow.


schemas=user1,user2,user3
directory=DATA_PUMP_DIR 
dumpfile=instance1_09082024.dmp 
logfile=instance1_09082024.log

Verify Available Disk Space

Make sure that you have enouth space to import the data. If the FRA in enabled it will create ot of archivelogs and can saturate the filesystem.


archive log list

enlarge the FRA or disable IT temporary.


ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '' scope=both;

RMAN will continue to access the files located in the flash recovery area for backup and recovery purposes.

Run impdp


expdp \"/ as sysdba\" parfile=impdp_instance1.par

Validate the Import


SELECT object_name, object_type FROM all_objects WHERE status = 'INVALID';


sqlplus / as sysdba @$ORACLE_HOME/rdbms/adminutlrp.sql

Cleanup

On both servers:


rm /u03/FRA/dump/instance1_09082024.dmp

TOC

Introduction to Oracle Data Pump
Getting Started
List the Schemas for the Application
Identify or Create Data Pump Directory
Create the Parameter File (.par)
Verify Available Disk Space
Run expdp
Transfert the file
Identify or Create Data Pump Directory
Create the Parameter File (.par)
Verify Available Disk Space
Run impdp
Validate the Import
Cleanup