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
                There are a number of reasons why this could fail:
courses.dmp) does already exist. Oracle
won'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 necessary 
rights to access the directoryread, write on dpump_dirIf 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.
It appears your error is occurring on the first ADDFILE call.
Try making your directory references upper case: directory => 'DPUMP_DIR'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With