Oracle Export Specific Tablespace And Import

Specific Table only Guide – Step-by-Step

Tutorial

In this guide, we will learn how to use expdp (Data Pump Export) and impdp (Data Pump Import) in Oracle Database to back up specific tablespace and restore the required table only.

To create a backup, first we have to set up a physical backup location.

Creating a Backup location:

On Linux server:

mkdir -p /data/backup



On Oracle Database:

Command:

create a directory TEST_DIR2 as '/data/backup';

Here, TEST_DIR2 is a logical directory pointing to the physical backup location.

To verify the directory:

SELECT * FROM dba_directories WHERE directory_name = 'TEST_DIR2';






Exporting a Tablespace using expdp:

To backup the Tablespace USERS, 

expdp tablespaces=USERS directory='TEST_DIR2' dumpfile=TBS.dump logfile=TBS.log

Note

Dump File (.dump): A binary file generated by expdp that contains exported schema objects, data, and metadata. It is used for backup and migration.

Log File (.log): A text file that records details of the export/import process, including progress, errors, and warnings. It helps in troubleshooting.

After running the command, you will be prompted to connect the database.

Connect using sys user and press enter when asked for a password.

Export Tablespace USERS completes successfully.







Before importing specific table U1.T1 we must drop the same table if already exists.
Why? If the schema already exists, we cannot re-import the same table without errors.









Now Import the Schema using impdb:

impdp Table U1.T1 directory=TEST_DIR2 dumpfile=TBS.dump logfile=TBSimport.log

Connected using the sys user when prompted.

Imported successfully.







Below is the table U1.T1 from the tablespace USERS.






Summary of Steps

✔ Created a backup directory (/data/backup) on the Linux server.

✔ Created a logical directory (TEST_DIR2) in the Oracle Database.

✔ Exported Tablespace USERS using expdp.

✔ Deleted the existing U1.T1 before importing.

✔ Restored U1.T1 using impdp and verified the object.

Final Thoughts

By following these steps, you can successfully back up and restore specific table from the tablespace backup in Oracle using Data Pump Export (expdp) and Import (impdp). This method is useful for migrating data between servers or restoring accidental deletions.

👉"Did this guide help you? Have questions? Drop a comment below, and I'll be happy to help!"

👉"Want more Oracle database tutorials? Follow this blog for the latest updates!"

Note: This scenario (restoring specific table from the tablespace) is one of the interview question.

More useful links:

[Oracle Export Schema or User And Import Schema or User Guide – Step-by-Step Tutorial]: (https://arbnumberone.blogspot.com/2025/03/oracle-database-schema-export-and.html)

[Oracle Export Specific Tablespace And Import Specific Table only Guide – Step-by-Step Tutorial]: (https://arbnumberone.blogspot.com/2025/03/oracle-export-specific-tablespace-and.html)




Comments

Popular posts from this blog