oracle 数据迁移 之 data pump

Data pump 是一个服务器端的数据导入工具(只能在服务器端)
实例:
1、首先在数据库中创建一个目录对象,并且该对象与操作系统中物理文件夹对应,并给用户授予访问该文件夹的权限。
!host mkdir /u01/expdp/jack
Create directory "jack" as '/u01/expdp/jack'
Grant read,write on directory "jack" to "plubic"
做完之后可以查看目录对象:
Select * from dba_directories;
使用scott用户导出scott用户的数据
a、 导出scott用户的全部数据
$expdp scott/oracle@orcl dumpfile=scott.dmp logfile=scott.log directory=data_pump_test
也可以将参数文件放在'/u01/expdp/jack.dat'中
Vim /u01/expdp/hack.dat  写入:
dumpfile=scott.dmp logfile=scott.log directory=data_pump_test
$expdp scott/oracle@orcl parfile='/u01/expdp/jack.dat'
b、导出scott用户下的部分表和部分记录
dumpfile=scott.dmp logfile=scott.log directory=data_pump_test
Include=table:"like 'T_moo'", procedure:"like 'sp%'"
query=T_MOnitoritem_water:"where monitoritemid=001",t_moo_monitoritem_gas:"where monitoritemid=003"
Include参数制定有哪些对象需要导出
Query参数对导出的表中的记录进行筛选导出,
除此之外还有一个exclude蚕食,用于排除不想导出的表,但是include和exclude两个参数不能同时使用。
$expdp scott/oracle@orcl parfile='/u01/expdp/jack.dat'
C、其他
Vim /u01/expdp/hack.dat  写入:
dumpfile=scott.dmp logfile=scott.log directory=data_pump_test
*   schemas=scott,hr,dali_test      导出多个用户
*   tablespaces=users,tbs1,emp     导出多个表
$expdp system/oracle@orcl  parfile='/u01/expdp/jack.dat' ;


使用network_link方式将远程数据库中的数据导出到本地
建立本地到远程数据库的数据连接。
create database link orcl168_scott connect to scott indentified by "oracle" using 'orcl168';
注:此链接制定连接用户为scott,连接的用户密码为:oracle  
posted @ 2011-11-13 21:17    阅读(310)  评论(0编辑  收藏  举报