1.使用expdp要先在数据库中创建directory,并给相应的用户read,write权限.
SQL>create directory db_bak_dir as '/home/oracle/db_bk';
SQL>GRANT READ, WRITE ON DIRECTORY db_bak_dir TO trs;
SQL>select * from all_directories
2.常用导出方法:
$expdp trs/XXXX@XXX DUMPFILE=trsdb.dmp DIRECTORY=db_bak_dir SCHEMAS=trs content=ALL
CONTENT={ALL?|?DATA_ONLY?|?METADATA_ONLY}?
当设置CONTENT为ALL?时,将导出对象定义及其所有数据.为DATA_ONLY时,只导出对象数据,为METADATA_ONLY时,只导出对象定义?
3.导入
impdp trs/XXXX directory=db_bak_dir dumpfile=SGDB20170724.DUMP
其他用法参考:
expdp piner/piner directory=dump_test dumpfile=user.dmp 导出用户的数据
expdp piner/piner directory=dump_test dumpfile=table.dmp tables=test1,test2 导出表数据
impdp piner/piner directory=dump_test dumpfile=user.dmp 导入该用户数据
impdp piner/piner directory=dump_test dumpfile=table.dmp 导出表数据
来自 Oracle 官网:
Performing a Schema-Mode Export
expdp hr DUMPFILE=dpump_dir1:expschema.dmp LOGFILE=dpump_dir1:expschema.log
Performing a Parallel Full Database Export
expdp hr FULL=YES DUMPFILE=dpump_dir1:full1%U.dmp, dpump_dir2:full2%U.dmp
FILESIZE=2G PARALLEL=3 LOGFILE=dpump_dir1:expfull.log JOB_NAME=expfull