ORA-31634: job already exists

来源:互联网 发布:苏州科达算法笔试题 编辑:程序博客网 时间:2023/11/29 03:52


You are running a DataPump job (export or import) and this fails with the following errors:

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


This can occur when either running a single DataPump jobs or when you are executing multiple jobs at the same time.


This can happen when you do not specify a unique JOB_NAME for the DataPump job (using a default name) and for some reason that JOB_NAME already exists, or if you are running many jobs at the same time (more than 99 jobs) and DataPump cannot build a unique name.


1. If you are just running a single job then there are probably old job names that are still found in the database and this is creating the conflict. You could try to remove these job using the steps in the following 
Note 336014.1 - How To Cleanup Orphaned DataPump Jobs In DBA_DATAPUMP_JOBS ? 

Step 4. Determine in SQL*Plus the related master tables:

-- locate Data Pump master tables: 

SELECT o.status, o.object_id, o.object_type, 
       o.owner||'.'||object_name "OWNER.OBJECT" 
  FROM dba_objects o, dba_datapump_jobs j 
 WHERE o.owner=j.owner_name AND o.object_name=j.job_name 
   AND j.job_name NOT LIKE 'BIN$%' ORDER BY 4,2; 

------- ---------- ------------ ------------------------- 
VALID   593041                 TABLE               SYSTEM.SYS_EXPORT_SCHEMA_97                                                                                                                                     
VALID   593522                 TABLE               SYSTEM.SYS_EXPORT_SCHEMA_98  

Step 5. For jobs that were stopped in the past and won't be restarted anymore, delete the master table. E.g.:


-- For systems with recycle bin additionally run:
purge dba_recyclebin;

2. If you are running lots of jobs (more than 99) at a time, then the problem is that DataPump cannot build more than 99 consecutive jobnames when using the default job_name because the default job_name is system-generated in the form SYS_EXPORT_<mode>_NN, where NN expands to a 2-digit incrementing integer starting at 01, therefore the largest value for NN would be 99. 

From Oracle Database Utilities guide:

Default: system-generated name of the form SYS_EXPORT_<mode>_NN

Used to identify the export job in subsequent actions, such as when the ATTACH parameter is used to attach to a job, or to identify the job using the DBA_DATAPUMP_JOBS or USER_DATAPUMP_JOBS views.

Syntax and Description

The jobname_string specifies a name of up to 30 bytes for this export job. The bytes must represent printable characters and spaces. If spaces are included, then the name must be enclosed in single quotation marks (for example, 'Thursday Export'). The job name is implicitly qualified by the schema of the user performing the export operation. The job name is used as the name of the master table, which controls the export job.

The default job name is system-generated in the form SYS_EXPORT_<mode>_NN, where NN expands to a 2-digit incrementing integer starting at 01. An example of a default name is 'SYS_EXPORT_TABLESPACE_02'.

The following example shows an export operation that is assigned a job name of exp_job:

#> expdp hr DIRECTORY=dpump_dir1 DUMPFILE=exp_job.dmp JOB_NAME=exp_job NOLOGFILE=YES

To avoid this issue, please use the job_name DataPump parameter to create unique job names that will not conflict with any other job names in the database instead of using the default job_name.

0 0