13、Oacle导入导出dmp文件

oracle11有个新特点,在做dmp文件导入导出时,如果是空表,则无法导入导出,因此需要做一些特殊操作

1、导出

第一:给空表拼接alter table tableName allocate extent;语句

cmd -> sqlplus bldb/[email protected]:1521/orcl
spool d:\1.sql;
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0;
spool off;
exit;

第二:整理1.sql文件,然后用plsql打开1.sql文件并执行,这一步执行后,空表就可以导出到dmp文件中了

第三:执行导出命令:cmd->exp bldb/[email protected]:1521/orcl file=d:\bldb.dmp

2、导入

第一:执行一个sql语句防止空表不新建的问题,即设置deferred_segment_creation的属性为false;

alter system set deferred_segment_creation=false;

第二:执行导入命令:imp bldb/[email protected]:1521/orcl file=D:\bldb.dmp full=y ignore=y

猜你喜欢

转载自www.cnblogs.com/wf2010517141/p/10368066.html
今日推荐