使用impdp时,以下三个参数极大的增强了用户转换及表空间转换的操作:
REMAP_DATAFILE Redefine datafile references in all DDL statements.
REMAP_SCHEMA Objects from one schema are loaded into another schema.
REMAP_TABLESPACE Tablespace object are remapped to another tablespace.
1.REMAP_SCHEMA可以定义用户的切换,其格式为:
remap_schema=old_schema_name:new_schema_name
2.REMAP_TABLESPACE可以定义切换对象的不同表空间,其格式为:
remap_tablespace=old_tablespace_name:new_tablespace_name
3.以前类似IGNORE的忽略创建错误,可以使用CONTENT参数:
CONTENT Specifies data to load where the valid keywords are:
(ALL), DATA_ONLY, and METADATA_ONLY.
如果数据结构已经存在可以指定CONTENT=DATA_ONLY,仅导入数据。
4.而关于索引的排除,可以使用EXCLUDE参数:
EXCLUDE Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.
IMPDP导入时忽略索引可以使用类似: EXCLUDE=CONSTRAINT EXCLUDE=INDEX
如果导入时遇到如下错误,就需要调整REMAP_SCHEMA参数:
ORA-39146: schema "SMS_MT" does not exist
遇到如下错误,那就需要制定REMAP_TABLESPACE参数:
ORA-00959: tablespace 'SMS_MT' does not exist
今天使用的参数是:
impdp sms4/sms4 dumpfile=08.dmp directory=impdp TABLES=smsmg REMAP_SCHEMA=SMS:SMS4 REMAP_TABLESPACE=SMS_MT:SMS CONTENT=DATA_ONLY PARALLEL=8 EXCLUDE=CONSTRAINT EXCLUDE=INDEX
记录一下供参考。