oracle不同表空间的导入

1,用imp导出数据
cmd进入orcle安装目录bin下,输入以下命令:
exp u/p@bmnae file=c:\hysjb.dmp owner=magazine_hy rows=y
2, 用imp产生index.sql文件
imp <xe_username>/<password>@XE file=<filename.dmp> indexfile=index.sql full=y
3,修改index.sql文件
FIND: 'REM<SPACE>' REPLACE: <NOTHING>
FIND: '"<SOURCE_TABLESPACE>"' REPLACE: '"USERS"'
FIND: '...' REPLACE: 'REM ...'
FIND: 'CONNECT' REPLACE: 'REM CONNECT'
ps:查看表空间的语句:
select
df.tablespace_name "TABLESPACE_NAME",totalspace "TOTALSPACE/M",freespace "FREESPACE/M",round((1-freespace/totalspace)*100,2) "USED%"
from
(select tablespace_name,round(sum(bytes)/1024/1024) totalspace from dba_data_files group by tablespace_name) df,
(select tablespace_name,round(sum(bytes)/1024/1024) freespace from dba_free_space group by tablespace_name) fs
where df.tablespace_name=fs.tablespace_name;
4,使用sqlplus进入执行此sql生成表结构
sqlplus <xe_username>/<password>@XE @index.sql
5,进入数据库diasble掉依赖。
select 'ALTER TABLE '||table_name|| ' disable constraint '||constraint_name|| '; ' from user_constraints
where constraint_type = 'R';
导出csv文件为imp.sql,删除"号,执行。
6,导入数据,cmd下执行:
imp <xe_username>/<password>@XE file=<filename.dmp> fromuser=<original_username> touser=<xe_username> ignore=y
7,将imp.sql中的disable替换成enable执行。enable依赖

 

 

 

-----------------------------------------------------------------------------------
手机app、网站开发、系统定制 优惠中。。。
详情请登录http://www.junchuangsoft.com/

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值