问题
I have followed the AWS Importing Data into RDS guide.
I have copied the .dmp
file from Source Oracle Instance on another machine to the DATA_DUMP_DIR
on RDS Instance.
Now I am trying to import it using the code below:
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;
/
When I execute above in sqlplus
, I get:
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
How do I get the above to work? AWS Doc is very abstract & rest of the stuff I found isn't helping either.
回答1:
1)Connect to the RDS instance with the Amazon RDS master user account.
2) Run this pl/sql block
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) You can start importing from a Source Oracle Instance. Example
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
来源:https://stackoverflow.com/questions/48398623/error-importing-a-dmp-file-in-aws-rds-oracle-db