首页 > 代码库 > 『ORACLE』 数据泵Data Pump中expdp导出(11g)

『ORACLE』 数据泵Data Pump中expdp导出(11g)

[oracle@enmo1 ~]$ mkdir datadump
[oracle@enmo1 ~]$ cd datadump/
[oracle@enmo1 datadump]$ pwd
/home/oracle/datadump

SQL> create or replace directory dir_dp as ‘/home/oracle/datadump‘;

Directory created.

SQL> grant read,write on directory dir_dp to scott;

Grant succeeded.

导出表中指定行

[oracle@enmo1 datadump]$ expdp scott/tiger directory = dir_dp dumpfile = emp.dmp tables = emp  query = "‘where deptno = 30 ‘"

[oracle@enmo1 datadump]$ ll
total 136
-rw-r----- 1 oracle oinstall 131072 May 24 21:21 emp.dmp
-rw-r--r-- 1 oracle oinstall 1244     May 24 21:21 export.log

parfile导出表中指定行,用参数文件的好处是,特殊字符不用转义,密码也相对隐藏

[oracle@enmo1 datadump]$ vi par.txt

userid=scott/tiger
directory=dir_dp
dumpfile=emp30_2.dmp
logfile=emp30_2.log
tables=emp
query=‘where deptno = 30‘

[oracle@enmo1 datadump]$ expdp parfile=par.txt

[oracle@enmo1 datadump]$ ls
emp30_2.dmp emp30_2.log emp.dmp export.log par.txt

导出表

[oracle@enmo1 datadump]$ rm *
[oracle@enmo1 datadump]$ ls
[oracle@enmo1 datadump]$ expdp scott/tiger directory = dir_dp dumpfile = emp.dmp tables = emp

[oracle@enmo1 datadump]$ ls
emp.dmp export.log

导出表空间

[oracle@enmo1 datadump]$ expdp system/oracle directory = dir_dp dumpfile = emp.tbp tablespaces = users

导出schema

[oracle@enmo1 datadump]$ expdp scott/tiger directory = dir_dp dumpfile = emp.scm schemas = scott

『ORACLE』 数据泵Data Pump中expdp导出(11g)