expdp导出失败

上一篇 / 下一篇  2014-05-29 15:41:01

相同的导出脚本,相同的数据源,用expdp方式导出,指定了导出表。
expdp username/password directory=××× dumpfile=exp.dmp tables=×××
拷贝文件到异机oracle帐号目录下恢复,没有问题。
 
昨天把该文件拷贝到另一个数据库上,用的非oracle帐号test下,导入的时候,用类似如下命令,却报错。
impdp username/password directory=××× dumpfile=×××.dmp tables=××× TABLE_EXISTS_ACTION=REPLACE REMAP_SCHEMA=A:B REMAP_TABLESPACE=AB:DB
 
错误信息如下:
Import: Release 10.2.0.5.0 - 64bit Production on Tuesday, 26 April, 2011 17:32:51
Copyright (c) 2003, 2007, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
 
网上看了一下,有的说是directory指定目录不存在,有的说的是当前用户权限问题,自己反复检查,发现没有问题,然后,有个朋友提醒了我:目录下是否生成了导入log文件,如果没有,就肯定是目录读写权限问题
 
马上检测directory对应目录"/export/bakdata"的权限
bash-3.00$ ls -la /export/bakdata
total 725958
drwxr-xr-x   2 test    oinstall     512 Apr 26 18:32 .
drwxr-xr-x   6 test    dba          512 Apr 26 15:46 ..
-rw-r--r--   1 test    oinstall 42094592 Apr 26 17:18 testdata.dmp
 
尝试把该目录的权限放大试试
bash-3.00$ chmod  -R 777 /export/bakdata
bash-3.00$ ls -la /export/bakdata
total 725958
drwxrwxrwx   2 test    oinstall     512 Apr 26 18:32 .
drwxr-xr-x   6 test    dba          512 Apr 26 15:46 ..
-rwxrwxrwx   1 test    oinstall 42094592 Apr 26 17:18 testdata.dmp
 
再次执行导入,还是报错,但错误信息不一样了。
Import: Release 10.2.0.5.0 - 64bit Production on Tuesday, 26 April, 2011 18:41:56
Copyright (c) 2003, 2007, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORA-31655: no data or metadata objects selected for job
Master table "ORCL"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "ORCL"."SYS_IMPORT_TABLE_01":  orcl/******** directory=imp_dir dumpfile=×××.dmp tables=××× logfile=imp.log TABLE_EXISTS_ACTION=REPLACE REMAP_SCHEMA=A:B REMAP_TABLESPACE=AB:DB
Job "ORCL"."SYS_IMPORT_TABLE_01" successfully completed at 18:41:58

再次查看导入目录,确实生成了导入log文件imp.log,看来前面确实是目录读写权限有问题了。
 
再来看后面的错误,按网友说的在directory上加双引号,还是报同样的错误,再在dumpfile上加双引号,还是报同样的错误,崩溃。。。
实在没办法了,抱着试试看的心理,删除impdp语句中的tables参数,结果导入成功了。
impdp username/password directory=××× dumpfile=×××.dmp TABLE_EXISTS_ACTION=REPLACE REMAP_SCHEMA=A:B REMAP_TABLESPACE=AB:DB
 
记录一下,给遇到类似问题的人多一个参考。

TAG:

 

评分:0

我来说两句

Open Toolbar