[[email protected] ~]$ mkdir datadump
[[email protected] ~]$ cd datadump/
[[email protected] 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.
导出表中指定行
[[email protected] datadump]$ expdp scott/tiger directory = dir_dp dumpfile = emp.dmp tables = emp query = "‘where deptno = 30 ‘"
[[email protected] 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导出表中指定行,用参数文件的好处是,特殊字符不用转义,密码也相对隐藏
[[email protected] datadump]$ vi par.txt
userid=scott/tiger
directory=dir_dp
dumpfile=emp30_2.dmp
logfile=emp30_2.log
tables=emp
query=‘where deptno = 30‘
[[email protected] datadump]$ expdp parfile=par.txt
[[email protected] datadump]$ ls
emp30_2.dmp emp30_2.log emp.dmp export.log par.txt
导出表
[[email protected] datadump]$ rm *
[[email protected] datadump]$ ls
[[email protected] datadump]$ expdp scott/tiger directory = dir_dp dumpfile = emp.dmp tables = emp
[[email protected] datadump]$ ls
emp.dmp export.log
导出表空间
[[email protected] datadump]$ expdp system/oracle directory = dir_dp dumpfile = emp.tbp tablespaces = users
导出schema
[[email protected] datadump]$ expdp scott/tiger directory = dir_dp dumpfile = emp.scm schemas = scott