--users,sysaux,temp,sysaux表空间不能删除
-bash-3.00$ impdp system/system dumpfile=other:expdp_full_db.dmp full=y
Import: Release 10.2.0.2.0 - Production on Monday, 14 September, 2009 11:26:15
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-31626: job does not exist
ORA-04063: package body "SYS.DBMS_INTERNAL_LOGSTDBY" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_INTERNAL_LOGSTDBY"
ORA-06512: at "SYS.KUPV$FT", line 834
ORA-04063: package body "SYS.DBMS_LOGREP_UTIL" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_LOGREP_UTIL"
$sqlplus "/as sysdba"
SQL> startup upgrade
SQL > @?/rdbms/admin/catalog.sql
SQL > @?/rdbms/admin/catproc.sql
SQL > @?/rdbms/admin/utlrp.sql
---全库导入
expdp system/system dumpfile=other:exp_full_db.dmp full=y
impdp system/system dumpfile=other:exp_full_db.dmp full=y
---用户导入
expdp system/system schemas=mv dumpfile=other:exp_user_mv.dmp
drop user mv cascade --把哪个用户drop掉
impdp system/system schemas=mv dumpfile=other:exp_user_mv.dmp
---表空间导入
expdp system/system tablespaces=mv dumpfile=other:exp_tablespace_mv.dmp
drop tablespace mv including contents and datafiles;
create tablespace mv datafile '/oracle/mv.dbf' size 100m;---在导入前一定要先建表空间,不然会报错(根据select dbms_medata.get_ddl)
impdp system/system tablespaces=mv dumpfile=other:exp_tablespace_mv.dmp
---表导入
expdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp
conn mv/system
drop table sol purge;
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp
或者
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp content=metadata_only --只导入表结构
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp content=data_only --只导入表数据,这个适用于要导入的表结构已经存在
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp content=all --这也是默认值,就是导入表结构和表数据
--注意以下table_exists_action选项,处理数据依据dumpfile转储文件
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp table_exists_action=skip --用于表对象已在存在,不处理了
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp table_exists_action=append ---用于在原来表数据基础上添加数据
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp table_exists_action=replace ---先drop表,然后插入数据
impdp system/system tables=mv.sol dumpfile=other:exp_table_sol.dmp table_exists_action=truncate ---先truncate表数据,然后插入数据
--sqlfile的学习,用于impdp,就是把dumpfile转储文件中的ddl语句导入到指定的文件,另这个文件要存储在目录(directory)
expdp system/system schemas=mv dumpfile=dir:export_user_mv.dmp
impdp system/system schemas=mv dumpfile=dir:export_user_mv.dmp sqlfile=dir:ddl.sql
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-614569/
,如需转载,请注明出处,否则将追究法律责任。