oracle 11g 数据泵导入导出数据

--切换用户
su - oracle

--连接oracle用户
oracle@djjsdev:/$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 29 11:23:26 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

--创建表空间
create tablespace trpt_dev
datafile '/u01/app/oracle/oradata/orcl/trpt_dev.dbf'
size 100m
autoextend on
next 20m
extent management local;


--创建临时表空间
create temporary tablespace trpttemp_dev
tempfile '/u01/app/oracle/oradata/orcl/trpttemp_dev.dbf'
size 50m
autoextend on
next 20m 
extent management local;

--创建用户
create user trptdev identified by trptdev default tablespace trpt_dev temporary tablespace trpttemp_dev;

--赋权限
grant connect,resource to trptdev ;

--查询数据库已经有的目录
select * from dba_directories;

--impdp导入数据
impdp  \'\/ as sysdba\' directory=DATA_PUMP_DIR REMAP_SCHEMA=trpt:trptdev  remap_tablespace=trpt:trpt_dev dumpfile=trpt_sqlbak01_20170328.dmp logfile=trpt_sqlbak01_20170329.log 
说明:DATA_PUMP_DIR是已经创建的数据库目录,如果没有就创建一个,并赋予权限就可以
REMAP_SCHEMA=trpt:trptdev是因为导出的用户和目标用户的schema不一样
remap_tablespace=trpt:trpt_dev是因为导出的表空间和导入表空间不一致

--expdp导出数据
expdp \'\/ as sysdba\'  dumpfile=trpt_sqlbak01_20170328.dmp logfile=trpt_sqlbak01_20170328.log directory=expdir1 schemas=trpt

你可能感兴趣的:(oracle)