Wednesday, October 12, 2016

Import Error - ORA-31634: job already exists ORA-31664: unable to construct unique job name when defaulted



I was getting below error while i was trying to import a schema from 11gr2 database to another same version database.

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
ORA-31634: job already exists
ORA-31664: unable to construct unique job name when defaulted



To resolve this error  just drop the import tables which  got created previously while imports  run. You can find all the tables using below query and then you can get rid of them (drop table )


SELECT o.status, o.object_id, o.object_type,
          o.owner||'.'||object_name "OWNER.OBJECT",o.created,j.state
     FROM dba_objects o, dba_datapump_jobs j
    WHERE o.owner=j.owner_name AND o.object_name=j.job_name
   and o.owner='&SCHEMA' and j.state='NOT RUNNING' ORDER BY 4,2;


This will drop all the import tables for schema which you are using to do the import and import job having status as "NOT RUNNING".