导入命令
impdp demo/demopassword DIRECTORY=dbbackup DUMPFILE=exp20121120.dmp SCHEMAS=mydemo table_exists_action=replace;
错误提示:
Import: Release 11.2.0.1.0 - Production on Wed Nov 14 18:06:28 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31634: job already exists
ORA-31664: unable to construct unique job name when defaulted
google了一通,大体结论是:
*************************************************************
DBA_DATAPUMP_JOBS记录了使用数据泵(impdp/expdp)时的一些错误信息。
解决方法有两种:
第一种:备份是指定一个不存在DBA_DATAPUMP_JOBS中的JOB_NAME
第二种:清理DBA_DATAPUMP_JOBS表
通过查询DBA_DATAPUMP_JOBS可以获得错误信息的具体情况:
SELECT 'DROP TABLE ' || OWNER_NAME ||'.'|| JOB_NAME ||';' FROM DBA_DATAPUMP_JOBS WHERE STATE='NOT RUNNING';
然后在执行以上生成的SQL语句,有174条,如:
DROP TABLE demo.BIN$zujqkd1z/8LgQAB/AQAT3A==$0 PURGE ; ; --purge 不放到回收站中,强制清除
*************************************************************
但是在执行DROP TABLE时就出错,无论是加引号,还是不加PURGE选项,都提示出错:
ORA-00933: SQL command not properly ended
最后执行了几十次 purge recyclebin 后,
SELECT owner_name, job_name, operation, job_mode,state, attached_sessions FROM dba_datapump_jobs WHERE STATE='NOT RUNNING';
再看看,世界终于清静了。但还是不知道为什么DROP会出错!!!