场景描述:每天晚上一个定时脚本,导出的备份空间不足,手动导出报如下错误:
ORA-31634: job already exists(JOB已经存在)
ORA-31664: unable to construct unique job name when defaulted(采用默认方式,不能创建唯一JOB名)
解决方法:
第一步:查询生成清理DBA_DATAPUMP_JOBS的SQL语句
SELECT 'DROP TABLE' || OWNER_NAME ||'.'|| JOB_NAME ||';' FROM DBA_DATAPUMP_JOBS WHERE STATE='NOT RUNNING';
复制生成的处理SQL语句,进行对表DBA_DATAPUMP_JOBS进行清理,例句如下:
...............
drop table CONOW.SYS_EXPORT_SCHEMA_06;
drop table CONOW.SYS_EXPORT_SCHEMA_40;
drop table CONOW.SYS_EXPORT_SCHEMA_07;
drop table CONOW.SYS_EXPORT_SCHEMA_82;
...............
第二步:清理后再次查询确认DBA_DATAPUMP_JOBS是否清理完毕
SELECT OWNER_NAME, JOB_NAME, OPERATION, JOB_MODE,STATE, ATTACHED_SESSIONS FROM DBA_DATAPUMP_JOBS ORDER BY 1,2;
第三步:如果清理失败,则执行如下语句进行处理
EXEC DBMS_DATAPUMP.STOP_JOB(DBMS_DATAPUMP_ATTACH(‘SYS_EXPORT_SCHEMA_02’,’OAK’));
ORA-31634: job already exists(JOB已经存在)
ORA-31664: unable to construct unique job name when defaulted(采用默认方式,不能创建唯一JOB名)
解决方法:
第一步:查询生成清理DBA_DATAPUMP_JOBS的SQL语句
SELECT 'DROP TABLE' || OWNER_NAME ||'.'|| JOB_NAME ||';' FROM DBA_DATAPUMP_JOBS WHERE STATE='NOT RUNNING';
复制生成的处理SQL语句,进行对表DBA_DATAPUMP_JOBS进行清理,例句如下:
...............
drop table CONOW.SYS_EXPORT_SCHEMA_06;
drop table CONOW.SYS_EXPORT_SCHEMA_40;
drop table CONOW.SYS_EXPORT_SCHEMA_07;
drop table CONOW.SYS_EXPORT_SCHEMA_82;
...............
第二步:清理后再次查询确认DBA_DATAPUMP_JOBS是否清理完毕
SELECT OWNER_NAME, JOB_NAME, OPERATION, JOB_MODE,STATE, ATTACHED_SESSIONS FROM DBA_DATAPUMP_JOBS ORDER BY 1,2;
第三步:如果清理失败,则执行如下语句进行处理
EXEC DBMS_DATAPUMP.STOP_JOB(DBMS_DATAPUMP_ATTACH(‘SYS_EXPORT_SCHEMA_02’,’OAK’));