Oracle 数据泵导出脚本失败
我正在尝试对表空间上的元数据进行数据泵导出(课程)。我走在正确的轨道上吗?我的数据泵目录创建为:
CREATE DIRECTORY dpump_dir AS '/mydata/data';
请记住我是初学者。这可能是也可能不是最好的方法,但我想尝试让它发挥作用。非常感谢。
declare
dp_handle number;
begin
dp_handle := dbms_datapump.open(
operation => 'EXPORT',
job_mode => 'TABLESPACE');
dbms_datapump.add_file(
handle => dp_handle,
filename => 'courses.dmp',
directory => 'dpump_dir');
dbms_datapump.add_file(
handle => dp_handle,
filename => 'courses.log',
directory => 'dpump_dir',
filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
dbms_datapump.metadata_filter(
handle => dp_handle,
name => 'TABLESPACE_EXPR',
value => '''COURSE''');
dbms_datapump.start_job(dp_handle);
dbms_datapump.detach(dp_handle);
end;
/
ERROR at line 1:
ORA-39001: invalid argument value
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 2926
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3162
ORA-06512: at line 8
I'm trying to do a data pump export for metadata on a tablespace (COURSE). Am I on the right track? My data pump directory was created as:
CREATE DIRECTORY dpump_dir AS '/mydata/data';
Please keep in mind that I'm a beginner. This may or may not be the best way to go about this, but I'd like to try to get this working. Thanks very much.
declare
dp_handle number;
begin
dp_handle := dbms_datapump.open(
operation => 'EXPORT',
job_mode => 'TABLESPACE');
dbms_datapump.add_file(
handle => dp_handle,
filename => 'courses.dmp',
directory => 'dpump_dir');
dbms_datapump.add_file(
handle => dp_handle,
filename => 'courses.log',
directory => 'dpump_dir',
filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
dbms_datapump.metadata_filter(
handle => dp_handle,
name => 'TABLESPACE_EXPR',
value => '''COURSE''');
dbms_datapump.start_job(dp_handle);
dbms_datapump.detach(dp_handle);
end;
/
ERROR at line 1:
ORA-39001: invalid argument value
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 2926
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3162
ORA-06512: at line 8
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
失败的原因有很多:
courses.dmp
) 确实已经存在。甲骨文不会覆盖该文件。 (是的,错误消息非常蹩脚)
/mydata/data
确实不存在。/mydata/data
确实存在,但是Oracle没有必要的访问目录的权限
授予在
dpump_dir
上读取、写入
如果这些要点没有帮助,您可以首先打开 (
add_file
) *.log 文件,然后 *.dmp 文件。希望 Oracle 能够在 *.log 文件中写入一些有意义的内容。There are a number of reasons why this could fail:
courses.dmp
) does already exist. Oraclewon't override the file. (Yes, the error message is pretty lame)
/mydata/data
does not exist./mydata/data
does exist, but Oracle does not have the necessaryrights to access the directory
granted
read, write
ondpump_dir
If these points don't help, you might first open (
add_file
) the *.log file, then the *.dmp file. Hopefully, Oracle will write something meaningful into the *.log file.看来您的错误是在第一次 ADDFILE 调用时发生的。
尝试将目录引用设置为大写:directory => 'DPUMP_DIR'
It appears your error is occurring on the first ADDFILE call.
Try making your directory references upper case: directory => 'DPUMP_DIR'
试试这个:
嗯......远程调试其他人的代码是SO最不有趣的方面之一。无论如何,让我们再猜一下。
你有一个名为
/mydata/data
的操作系统目录吗? Oracle有读写权限吗? CREATE DIRECTORY语句只创建一个指针,它不创建底层操作系统目录。Try this:
Hmmm.... Remote debugging of other people's code is one of the least fun aspects of SO. Anyway, let's give it another guess.
Do you have an OS directory called
/mydata/data
which Oracle has read and write privileges on? The CREATE DIRECTORY statement only creates a pointer, it doesn't create the underlying OS directory.