Full export using expdp export utility in Data Pump.
Data pump in oracle database is a server based technology which enables very high speed movement of data and metadata from one database to another.
Component of Data pump in Oracle Database
Data pump is made up of 3 components
- The Command-line clients, expdp and impdp
- The DBMS_DATAPUMP PL/SQL package ( a.k.a. Data Pump API )
- The DBMS_METADATAPL/SQL package ( a.k.a. metadata API )
How Data pump works (Working of Data pump)
The command-line client expdp
use the procedures provided in the DBMS_DATAPUMP
PL/SQL package to execute export and import commands using the parameters entered at the command line. These parameters enable the exporting and importing of data and metadata for a complete database or for subsets of a database.
Similarly when metadata is moved, Data pump uses functionality provided by the DBMS_METADATA
PL/SQL package. This package provides a centralized facility for the extraction, manipulation, and re –creation of dictionary metadata.
PL/SQL packages can be used independently of the Data Pump clients.
Exporting Data using Data pump in Oracle Database (expdp Intro)
utility provided by data pump we can export data or say unload data or metadata from one database to another. Using this utility you can either export the complete database or a subset of database such as Database Schema, Tablespaces or even individual tables.
Types of Export in Data Pump
There are 4 types of export which you can perform using export (expdp) utility provided by Data pump in Oracle Database. These exports are as follows:
- Full Export
- Schema Export
- Table Export
- Tablespace Export
Steps for performing Full Database export
Step1. Make a Directory or Create a Folder
Note here that this step must be performed by privileged user such as sys or system and directory must be created on server system rather than client system.
Just make a folder anywhere in your system and give it some logical name. If this export is a part of your backup strategy then it’s advisable to avoid making the folder on the same partition which also contains your Oracle home directory or OS bootable files.
For the demonstration I have created a directory by the name of full export inside the directory Data pump in D drive. This full export folder will contain all the files created by expdp utility of data pump.
D:\Data Pump\Full Export
Step 2: Making Directory Object and Granting Privileges
This step 2 is divided into few sub steps which you have to follow. Moreover it should be done by privileged users such as sys on server side.
2.1. Log on to database as sys user
For making a directory object log onto your database as sys user with sysdba privileges
C:\> sqlplus / as sysdba
2.3. Grant Read and Write Privilege on The Directory
The next thing after creating a directory object is to grant read and write privileges on the directory to the user who wants to perform the export of data. Let’s see how
SQL> GRANT read, write ON DIRECTORY orcl_full TO hr;
2.4. Grant mandatory Role to the user
To perform a full export, you must have the DATAPUMP_EXP_FULL_DATABASE role. Thus we need to grant this role to our user HR.
SQL> GRANT DATAPUMP_EXP_FULL_DATABASE TO hr;
Step 3: Export the Data
Now that we have done all the required settings, we are good to go.
C:\>expdp hr/hr@ORCL DIRECTORY=orcl_full DUMPFILE=orclfull.dmp
expdp is a utility for unloading the data and metadata into a set of operating system files called dump file sets.
Parameters used in above EXPDP command.
The first parameter is a user login. Here you provide the login information of that user using which you want to perform the export. As here in my case I have provided the login of my hr user (Hr/Hr) accompanied with the SID of my database which is ORCL.
Using DIRECTORY parameter you specify the default location to which Export can write the dump file set and the log file. Here in my case DIRECTORY parameter is set on the directory object orcl_full which we just created.
Using DUMPFILE parameter you specify the names, and optionally, the directory objects of dump files for an export job.
The dump file is made up of one or more disk files that contain table data, database object’s metadata and control information. These files are written in binary format and dump files can be imported only by data pump impdp import utility. As these files are written in binary format by server using expdp export utility thus they should not be tampered. Changing information in these files might compromise the data consistency which may cause an error while importing.
You can supply multiple file names here separated by comma. Dot dmp is the default extension for dump file. If no extension is given then expdp export utility will use this default extension. Though you can specify whatever extension you want but it’s always advisable to use the oracle recommended extensions.
Using log file parameter expdp export utility will generate a human readable log file for you which are very helpful in tracking the status of your export.
This parameter full indicates that you want to perform a full database export. This parameter can have YES or NO values. If you set this parameter to YES that means expdp utility will export all the data and metadata of the database.
Restrictions with Full Database export.
- A full export does not export system schemas that contain Oracle-managed data and metadata. Examples of system schemas that are not exported include SYS, ORDSYS, and MDSYS.
- Grants on objects owned by the SYS schema are never exported.
- If you are exporting data that is protected by a realm, then you must have authorization for that realm.
That’s it friends. Hope this information was helpful. Kindly please share this on your social network & help me reach more people. Thanks & have a wonderful day!
SQL Script and Presentation used
You can DOWNLOAD SQL script and presentation used in the Video and in this article.
No SQL Script used in this Video and in this article
I have used copy cloud to share these resourses. You can also join copy cloud and get 15GB free cloud storage for lifetime. If you will use this referal link https://copy.com?r=j7eYO7
You will get 5GB extra free cloud storage means total 20GB free cloud storage.