一、问题描述
在执行EXPDP导出时候报如下错误:
[oracle@localhost]$ expdp rui/rui DIRECTORY=dmp_dir dumpfile=studyfull_expdp.dmp FULL=y logfile=studyfullexpdp.log job_name=expdp_job
Export: Release 11.2.0.4.0 - Production on Mon Feb 24 10:18:57 2025
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, 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
二、问题分析及处理
出现上述错误,常见原因有:
- 指定的逻辑目录不存在
- 指定的逻辑目录存在,但实际物理路径不存在
- 指定的逻辑目录及关联的实际物理路径均存在,但用户权限不够
- 指定的逻辑目录及关联的实际物理路径均存在,但物理路径的属组和权限不对
所以可通过如下思路处理问题。
1.查询指定的逻辑目录是否存在
SQL> select * from dba_directories where DIRECTORY_NAME = 'DMP_DIR';
no rows selected
所以,命令中使用的逻辑目录不存在。
2.创建逻辑目录及赋权
SQL> create directory dmp_dir as '/Data/dmp_dir';
Directory created.
将逻辑目录的读写权限赋给用户rui
SQL> grant read,write on directory dmp_dir to rui;
Grant succeeded.
3.修改物理路径的属组和权限
# chown oracle:oinstall /Data/dmp_dir
# chmod 777 /Data/dmp_dir
4.再次执行expdp命令
此时再次执行expdp命令,会发现上述错误已消除。