EXPDB BASIC

Oracle EXPDP (Data Pump Export) provides a powerful set of parameters for exporting Oracle database objects into a dump file, which can be later imported using IMPDP. Here’s a comprehensive list of the most useful EXPDP parameters, grouped by their purposes:

1. General Parameters

a. DIRECTORY

Example:
bash
Copy code
DIRECTORY=datapump_dir

b. DUMPFILE

Example:
bash
Copy code
DUMPFILE=full_exp_%U.dmp

c. LOGFILE

Example:
bash
Copy code
LOGFILE=expdp_full.log

d. JOB_NAME

Example:
bash
Copy code
JOB_NAME=my_expdp_job

e. VERSION

Example:
bash
Copy code
VERSION=12.2

2. Object-Level Filters

a. SCHEMAS

Example:
bash
Copy code
SCHEMAS=hr,scott

b. TABLES

Example:
bash
Copy code
TABLES=hr.employees,hr.departments

c. TABLESPACES

Example:
bash
Copy code
TABLESPACES=users,example

d. FULL

Example:
bash
Copy code
FULL=Y

e. INCLUDE and EXCLUDE

EXCLUDE specifies what type of objects should be excluded.
Examples:
bash
Copy code
INCLUDE=TABLE:"IN ('EMPLOYEES', 'DEPARTMENTS')"

EXCLUDE=INDEX:"LIKE 'EMP%'"

f. QUERY

Example:
bash
Copy code
QUERY=employees:"WHERE department_id=10"

3. Performance-Related Parameters

a. PARALLEL

Example:
bash
Copy code
PARALLEL=4

b. COMPRESSION

Example:
bash
Copy code
COMPRESSION=ALL

c. ESTIMATE_ONLY

Example:
bash
Copy code
ESTIMATE_ONLY=Y

d. ESTIMATE

Example:
bash
Copy code
ESTIMATE=BLOCKS

e. ACCESS_METHOD

Example:
bash
Copy code
ACCESS_METHOD=DIRECT_PATH


4. Data Handling Parameters

a. ENCRYPTION

Example:
bash
Copy code
ENCRYPTION=ALL

b. ENCRYPTION_PASSWORD

Example:
bash
Copy code
ENCRYPTION_PASSWORD=my_password

c. DATA_OPTIONS

Example:
bash
Copy code
DATA_OPTIONS=SKIP_CONSTRAINT_ERRORS

d. REUSE_DUMPFILES

Example:
bash
Copy code
REUSE_DUMPFILES=Y

e. FLASHBACK_TIME or FLASHBACK_SCN

Ensures the export represents the database at a consistent point in time using Oracle’s Flashback technology.
Examples:
bash
Copy code
FLASHBACK_TIME="TO_TIMESTAMP('2024-09-12 12:00:00', 'YYYY-MM-DD HH24:MI:SS')"

FLASHBACK_SCN=123456789

5. Job Management and Control

a. ATTACH

Example:
bash
Copy code
ATTACH=my_expdp_job


b. STATUS

Example:
bash
Copy code
STATUS=60


c. STOP_JOB and START_JOB

Example:
bash
Copy code
STOP_JOB=IMMEDIATE

START_JOB=Y

d. KEEP_MASTER

Example:
bash
Copy code
KEEP_MASTER=Y

6. Miscellaneous Parameters

a. METRICS

Example:
bash
Copy code
METRICS=

b. CONTENT

Example:
bash
Copy code
CONTENT=ALL

c. REMAP_TABLESPACE

Example:
bash
Copy code
REMAP_TABLESPACE=users:example

d. REMAP_SCHEMA

Example:
bash
Copy code
REMAP_SCHEMA=scott:hr

7. Monitoring and Logging Parameters

a. NOLOGFILE

Example:
bash
Copy code
NOLOGFILE=Y


b. TRACE

Example:
bash
Copy code
TRACE=480300

8. Example Commands Using Multiple Parameters

a. Full Database Export with Parallelism and Compression

bash

Copy code

expdp system/password FULL=Y DIRECTORY=dpump_dir DUMPFILE=full_db_%U.dmp LOGFILE=expdp_full.log PARALLEL=4 COMPRESSION=ALL


b. Schema Export with Flashback and Encryption

bash

Copy code

expdp system/password SCHEMAS=hr DIRECTORY=dpump_dir DUMPFILE=hr_exp.dmp LOGFILE=hr_exp.log ENCRYPTION=ALL ENCRYPTION_PASSWORD=my_password FLASHBACK_TIME="TO_TIMESTAMP('2024-09-12 12:00:00', 'YYYY-MM-DD HH24:MI:SS')"


c. Export Only Data from Specific Tables

bash

Copy code

expdp system/password TABLES=hr.employees,hr.departments DIRECTORY=dpump_dir DUMPFILE=tables_exp.dmp LOGFILE=tables_exp.log CONTENT=DATA_ONLY



These EXPDP parameters provide Oracle DBAs with great flexibility in controlling the export process, whether it's for full database backups, schema migrations, or selective data extraction. Proper use of these options ensures efficient and optimized backups that meet specific requirements.

IMPDP Basic

IMPDP (Data Pump Import) is the utility used in Oracle to import data and database objects from dump files created by EXPDP (Data Pump Export). It is a more flexible and high-performance tool than the traditional IMP utility. Here’s a basic overview of IMPDP and its essential concepts and parameters.

1. Basic Syntax of IMPDP

The basic syntax for running the IMPDP command is:

bash

Copy code

impdp <username>/<password> DIRECTORY=<directory_object> DUMPFILE=<dumpfile_name> [options]


2. Basic Parameters

a. DIRECTORY

Example:
bash
Copy code
DIRECTORY=datapump_dir


b. DUMPFILE

Example:
bash
Copy code
DUMPFILE=full_db_exp.dmp

c. LOGFILE

Example:
bash
Copy code
LOGFILE=impdp_full.log

d. SCHEMAS

Example:
bash
Copy code
SCHEMAS=hr,scott

e. TABLES

Example:
bash
Copy code
TABLES=hr.employees,hr.departments

f. FULL

Example:
bash
Copy code
FULL=Y


3. Commonly Used Parameters for IMPDP

a. REMAP_SCHEMA

Example:
bash
Copy code
REMAP_SCHEMA=scott:hr

b. REMAP_TABLESPACE

Example:
bash
Copy code
REMAP_TABLESPACE=users:example


c. CONTENT

Example:
bash
Copy code
CONTENT=DATA_ONLY

d. EXCLUDE and INCLUDE

INCLUDE: Specifies the type of objects to include in the import process.
Example for excluding indexes:
bash
Copy code
EXCLUDE=INDEX

e. PARALLEL

Example:
bash
Copy code
PARALLEL=4

f. TABLE_EXISTS_ACTION

Example:
bash
Copy code
TABLE_EXISTS_ACTION=REPLACE

g. TRANSFORM

Example to disable segment creation:
bash
Copy code
TRANSFORM=SEGMENT_ATTRIBUTES:N


4. Monitoring and Managing the Import Job

a. STATUS

Example:
bash
Copy code
STATUS=60

b. JOB_NAME

Example:
bash
Copy code
JOB_NAME=my_import_job

c. ATTACH

Example:
bash
Copy code
ATTACH=my_import_job


5. Basic Example Commands

a. Schema Import

Importing the hr schema from the full_db_exp.dmp dump file:

bash

Copy code

impdp system/password DIRECTORY=datapump_dir DUMPFILE=full_db_exp.dmp SCHEMAS=hr LOGFILE=impdp_hr.log


b. Full Database Import

Importing the entire database from the dump file:

bash

Copy code

impdp system/password DIRECTORY=datapump_dir DUMPFILE=full_db_exp.dmp FULL=Y LOGFILE=impdp_full.log


c. Table-Level Import

Importing specific tables from the dump file:

bash

Copy code

impdp system/password DIRECTORY=datapump_dir DUMPFILE=full_db_exp.dmp TABLES=hr.employees,hr.departments LOGFILE=impdp_tables.log


d. Importing with Schema and Tablespace Remapping

Importing the scott schema into the hr schema and remapping the users tablespace to example:

bash

Copy code

impdp system/password DIRECTORY=datapump_dir DUMPFILE=full_db_exp.dmp REMAP_SCHEMA=scott:hr REMAP_TABLESPACE=users:example LOGFILE=impdp_remap.log


Conclusion

IMPDP is a highly flexible and efficient tool for importing Oracle database objects from dump files created by EXPDP. By understanding and using the appropriate parameters, you can control how data is imported, manage resources effectively, and optimize performance.