在AWS RDS Oracle DB中导入.dmp文件时出错

时间:2018-01-23 09:48:23

标签: oracle amazon-web-services oracle11g amazon-rds datapump

我已按照AWS Importing Data into RDS指南进行操作。

我已将.dmp文件从另一台计算机上的源Oracle实例复制到RDS实例上的DATA_DUMP_DIR

现在我尝试使用以下代码导入它:

DECLARE
hdnl NUMBER;
BEGIN
hdnl := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA', job_name=>null);
DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'sample_copied.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);
DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''CORE_API'',''CORE_DAP'', ''CORE_MD'', ''CORE_ST'', ''CORE_BI'', ''CORE_MAPI'', ''CORE_MAPI_LOG'', ''CORE_LEG'')');
DBMS_DATAPUMP.METADATA_REMAP(hdnl,'REMAP_TABLESPACE','LOG','STORAGE_DATA');
DBMS_DATAPUMP.METADATA_REMAP(hdnl,'REMAP_TABLESPACE','CORE_LEG_TBS','LEG_DATA');
dbms_datapump.metadata_transform ( hdnl, 'OID' , 0 , null ) ;
DBMS_DATAPUMP.START_JOB(hdnl);
END;
/ 

当我在sqlplus执行上面时,我得到:

DECLARE
*
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 3507
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3756
ORA-06512: at line 5

如何让上述功能完成? AWS Doc非常抽象而且非常抽象。我找到的其他东西也没有帮助。

1 个答案:

答案 0 :(得分:0)

1)使用Amazon RDS主用户帐户连接到RDS实例。

2)运行此pl / sql块

    DECLARE
    hdnl NUMBER;
    BEGIN
    hdnl := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA', job_name=>null);
    DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'sample_copied.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);
    DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''CORE_API'',''CORE_DAP'', ''CORE_MD'', ''CORE_ST'', ''CORE_BI'', ''CORE_MAPI'', ''CORE_MAPI_LOG'', ''CORE_LEG'')');
    DBMS_DATAPUMP.METADATA_REMAP(hdnl,'REMAP_TABLESPACE','LOG','STORAGE_DATA');
    DBMS_DATAPUMP.METADATA_REMAP(hdnl,'REMAP_TABLESPACE','CORE_LEG_TBS','LEG_DATA');
    DBMS_DATAPUMP.START_JOB(hdnl);
    END;

/ 

3)您可以从源Oracle实例开始导入。 示例

impdp RDS_master_user/password@rds_instance DUMPFILE=sample_copied.dmp   DIRECTORY=DATA_PUMP_DIR parfile=import_parfile

import_parfile

REMAP_TABLESPACE=LOG:STORAGE_DATA
REMAP_TABLESPACE=CORE_LEG_TBS:LEG_DATA
SCHEMAS =CORE_API,CORE_DAP,CORE_MD,CORE_ST,CORE_BI,CORE_MAPI,CORE_MAPI_LOG, CORE_LEG