手机版
你好,游客 登录 注册
背景:
阅读新闻

Oracle不同表空间之间的数据迁移

[日期:2013-01-29] 来源:Linux社区  作者:Linux [字体:大 中 小]

--将数据库为testdb,用户名为testuser中默认(users)表空间里的数据迁移至表空间(newtablespace)

--1.用system用户登陆testdb数据库,创建directory(testdir)并将读、写权限授予testuser用户

create or replace directory testdir as 'e:\temp';
grant read, write on directory testdir to testuser;
--使用expdp命令导出testuser用户的数据
expdp system/aaaaaa@testdb directory=testdir dumpfile=testdb.dmp schemas=testuser;

--2.创建表空间newtablespace
create tablespace newtablespace
logging
datafile 'E:\Oracle\product\10.2.0\oradata\oa\newtablespace.dbf'
size 100m
autoextend on
next 200m maxsize 2048m
extent management local;

--3.将testuser的表空间修改为newtablespace
alter user testuser default tablespace newtablespace;

--4.将testuser用户下面的表、序列等删除

--5.导入数据
impdp system/aaaaaa@testdb directory=testdir dumpfile=testdb.dmp remap_tablespace=users:newtablespace

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款