exp-imp实现oracle不同表空间的迁移

原文链接;http://www.2cto.com/database/201308/235743.html

exp-imp实现oracle不同表空间的迁移

 
方法一:
 
--1、修改表空间名称(账号:sys/oracleas SYSDBA 登录)
 
?
1
2
3
alter tablespace CICHR rename to CICHR_BAK;
 
alter tablespace USERS rename to CICHR;

 

 
--2、导出用户
 
expcichr-20110804/cichr-20110804@db_192.168.196.232 file=cichr-232-20110804.dmplog=cichr-232-20110804-exp.log statistics = none
 
--此dmp文件表空间现在应该为CICHR
 
--3、将表空间名称修改回去(账号:sys/oracleas SYSDBA 登录)
 
?
1
2
3
4
alter tablespace CICHR rename to USERS;
     
 
alter tablespace CICHR_BAK rename to CICHR;

 

 
--4、导入到新创建用户cichr_test(默认表空间为CICHR,临时表空间为TEMP,connect\dba\resource权限,unlimited tablespace)
 
 
 
impcichr_test/cichr_test@db_192.168.196.232 file=c:\cichr-232-20110804.dmp full=ylog=c:\cichr_test-20110804-imp.log
 
或者:
 
impcichr_test/cichr_test@db_192.168.196.232 file=c:\cichr-232-20110804.dmpfromuser=cichr-20110804 touser=cichr_test tablespace=CICHRlog=c:\cichr_test-20110804-imp.log
 
至此所有数据迁移至新的表空间CICHR。
 
------------------------------------------
 
方法二:
 
1、通过PL/SQL,cichr-20110804/cichr-20110804登录,导出 数据库表结构(Tools-Export User Object),导出所有用户对象到D:\structs.sql;
 
2、使用EditPlus打开structs.sql对表空间名称进行整体替换(USERS替换为CICHR),对用户名进行整体替换(cichr-20110804替换为cichr_test);
 
3、Tools-Export Tables,导出D:/data.pde (PL/SQL Developer)-所有表数据;
 
4、创建用户cichr_test(默认表空间为CICHR,临时表空间为TEMP,connect\dba\resource权限,unlimited tablespace);
 
5、Command Window,执行命令:SQL>@D:structs.sql 回车,创建数据库表结构(所属表空间为CICHR);
 
6、导入数据表数据,Tools-Import Tables,选择刚刚导出的数据文件D:/data.pde。
 
至此所有数据迁移至新的表空间CICHR。
 
-------------------------------------------
 
方法三:
 
--1、修改表空间名称(账号:sys/oracleas SYSDBA 登录)
 
?
1
2
3
alter tablespace CICHR rename to CICHR_BAK;
 
alter tablespace USERS rename to CICHR;

 

 
--2、通过PL/SQL,cichr_test/cichr_test登录,
 
Tools-Export Tables,导出D:/data.dmp (oracle Export)-所有表结构及表数据,现在表数据所属表空间应该为CICHR。
 
--3、将表空间名称修改回去(账号:sys/oracleas SYSDBA 登录)
 
?
1
2
3
alter tablespace CICHR rename to USERS;
 
alter tablespace CICHR_BAK rename to CICHR;

 

 
--4、通过PL/SQL, cichr_test/cichr_test登录,
 
1)、删除Drop 所有tables;
 
2)、Tools-Import Tables,导入D:/data.dmp(oracle Export)-所有表结构及表数据。
 
至此所有数据迁移至新的表空间CICHR。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值