Search code examples
oracle-databasedatapumpimpdp

Importing dump file in Oracle using impdp


I am facing troubles while using impdp in Oracle 11g. I am reading the documentation but still am missing some point.

I created a test database, along side with the oracle_home of orcl database. I created the directory as /home/oracle from orcl dabase and granted read write on that directory to hr user, which I wanted to export the schema. Export happened successfully. Then, I quit sql prompt from orcl database, change the oracle_sid (.oraenv and type test_database), and execute

impdp scott/scott directory=dump_dir dumpfile=hr.emp it does not work.

What point am I missing? I just want to export hr schema from hr user in orcl database and import it into scott user from test database.

Thanks.


Solution

  • The DIRECTORY object is local to the database; creating it in one database does not make it available to others, even if they share an ORACLE_HOME.

    You need to repeat your commands in the test database before running impdp:

    CREATE DIRECTORY dump_dir AS /home/orcl;
    GRANT read, write ON dump_dir TO hr;
    

    Your import command may also have a mistake; the dump file it probably hr.dmp rather than hr.emp.