Oracle 把一个用户的数据导入另一个用户 (数据泵)

发布时间:2020-06-06 23:38:49 作者:crazy_charles
来源:网络 阅读:7291

192.168.0.1——server1


1. 导出数据

 

[expdp版本]


使用expdp之前,需要现在Oracle里面建directory

1 、create directory dump as '/u01/dump';

 

授予用户对directory的read/write权限


2、grant read,write on directory  dump to [wyb];


用户需要resource或者dba的权限,才能expdp


3、grant resource to [wyb] ;


4、expdp wyb/123456 dumpfile= dump1.dmp logfile=expdp.log directory=dump1


192.168.0.1_server2


导入之前,清空目标用户所有的对象

最简单的办法,把目标用户删了再重建,或者新建


1、drop   user   sam   cascade; 同时会删除表空间数据

 

再创建用户//创建临时表空间//授予权限


2、CREATE TABLESPACE   sam  DATAFILE  'sam.dbf' 

SIZE 200M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;


3、CREATE USER  sam IDENTIFIED BY 123456 DEFAULT TABLESPACE sam ;


 

4、grant connect,dba to [sam] ;


 导入数据


[impdp版本]

同样,使用impdp之前,需要现在Oracle里面建directory,如果有directory不需要在创建


1、create directory dump as '/u01/dump';


授予用户对directory的read/write权限


2、grant read,write on directory  dump to [sam];


授予用户dba权限

grant dba to [sam] ;


impdp user/password dumpfile=temp.dmp directory=dump remap_tablespace=[old_table_space]:[new_table_space]  ; old是指server1机器上的tablespace_name,new是指server2上的


impdp sam/123456  dumpfile=wyb-15032501.dmp directory=dump1 remap_tablespace=wyb:sam remap_schema=wyb:sam logfile=wyb-15032501.log


//导入数据后取消DBA权限


revoke dba from [sam];


//List directories

SELECT * FROM dba_directories;


如果出现tablespace存在,则先删除表空间

DROP TABLESPACE  xxb0001  INCLUDING CONTENTS AND DATAFILES;

推荐阅读:
  1. ORACLE数据库EXPDP/IMPDP常用参数
  2. Oracle数据泵

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

oracle dump 数据泵

上一篇:php编译可扩展模块

下一篇:Activity横竖屏切换的问题

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》