Oracle数据导入导出

http://www.dba-oracle.com/t_rman_173_impdp_remap.htm
https://oracle-base.com/articles/11g/data-pump-enhancements-11gr1
https://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_export.htm
https://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_import.htm

Export

-- 默认是SCHEMA模式,导出hr下的所有内容
-- DATA_PUMP_DIR是默认的导出目录
expdp hr/password DUMPFILE=DATA_PUMP_DIR:hr_20160229.dmp LOGFILE=DATA_PUMP_DIR:hr_20160229.log

Import

-- DIRECTORY, 使用IMPDP目录
-- REMAP_SCHEMA, schema映射,从prd_user到dev_user
-- REMAP_TABLESPACE, 表空间映射,从PRDDATA到USERS
-- TABLE_EXISTS_ACTION, 如果表已存在则REPLACE
impdp scott_dev DIRECTORY=IMPDP DUMPFILE=hr_20160229.dmp REMAP_SCHEMA=prd_user:dev_user REMAP_TABLESPACE=PRDDATA:USERS TABLE_EXISTS_ACTION=REPLACE LOGFILE=IMPDP:import_hr_20160229.log

-- TABLES,只导入SYS_SETTING表
impdp scott_dev TABLES=SYS_SETTING DIRECTORY=IMPDP DUMPFILE=hr_20160229.dmp TABLE_EXISTS_ACTION=REPLACE LOGFILE=IMPDP:SYS_SETTING.log

查看目录:

-- 查看目录
SELECT * FROM dba_directories;

-- 创建目录,并赋权限
CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
GRANT READ, WRITE ON DIRECTORY test_dir TO scott;

你可能感兴趣的:(Oracle数据导入导出)