使用数据泵导出时无法 remap_data

Unable to remap_data while using datapump export

任何人都可以帮助我导出数据泵。我试过很多组合。但是,我总是得到:

ORA-39001: invalid argument value
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4932
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5768
ORA-06512: at line 38

对此有何建议?

CREATE TABLE foo
(
  bar VARCHAR2(10)
);

INSERT INTO FOO VALUES('hello');
INSERT INTO FOO VALUES('world');
COMMIT;


create or replace package pkg
 is
  function tst(p_val varchar2) return varchar2;
end pkg;
/

create or replace package body pkg
 as
function tst(p_val varchar2) return varchar2 is
begin
 return p_val;
end;
end pkg;
/



DECLARE 
  h1 NUMBER;
  l_status varchar2(200);
BEGIN

    h1 := DBMS_DATAPUMP.OPEN(
      operation => 'EXPORT', 
      job_mode => 'TABLE', 
      remote_link => NULL,
      job_name => 'exp_1', 
      version => 'LATEST'
    );

    DBMS_DATAPUMP.ADD_FILE(
      handle => h1, 
      filename => 'export.dmp', 
      reusefile => 1,
      directory => 'DBOUT',
      filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
      
    DBMS_DATAPUMP.ADD_FILE(
      handle => h1, 
      filename => 'export.log', 
      reusefile => 1,
      directory => 'DBOUT',
      filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE
    );

    DBMS_DATAPUMP.METADATA_FILTER(
      handle => h1,
      name => 'NAME_EXPR',
      value => 'IN (SELECT table_name FROM user_tables WHERE table_name LIKE ''FOO%'')',
      object_type => 'TABLE'
    );

    DBMS_DATAPUMP.DATA_REMAP(
      handle => h1, 
      name => 'COLUMN_FUNCTION', 
      table_name => 'FOO', 
      column => 'BAR', 
      function => 'pkg.tst'
    );

    
   DBMS_DATAPUMP.start_job(h1);
   DBMS_DATAPUMP.wait_for_job(h1, l_status);
   dbms_output.put_line( l_status );

END;
/

关于文档,它应该有效。没有?

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/arpls/DBMS_DATAPUMP.html#GUID-2C61513F-9040-4CE3-8C22-ED1FA5FF81DD

非常欢迎任何建议,

此致,

FUNCTION 参数必须是正确的大小写,并且 SCHEMA 参数必须包含并且也必须是正确的大小写。这个过程调用对我有用:

DBMS_DATAPUMP.DATA_REMAP(
  handle => h1, 
  name => 'COLUMN_FUNCTION', 
  table_name => 'FOO', 
  column => 'BAR', 
  function => 'PKG.TST',
  schema => user
);

None 文档中提到了这些限制,所以我会说您的原始代码是正确的,并且此行为是一个错误。