oracle 11g data pump import and export data

--切换用户
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
create user trptdev identified by trptdev default tablespace trpt_dev temporary tablespace trpttemp_dev;

-- grant permission
grant connect ,resource to trptdev ; --Query

existing directories in the database
select * from dba_directories;

--impdp import data
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 
Description: DATA_PUMP_DIR is a database directory that has been created. If not, create one and give permission to
REMAP_SCHEMA=trpt:trptdev because the schema of the exported user and the target user are different
remap_tablespace=trpt:trpt_dev is because the exported tablespace is inconsistent with the imported tablespace

--expdp export data
expdp \'\/ as sysdba\' dumpfile=trpt_sqlbak01_20170328.dmp logfile=trpt_sqlbak01_20170328.log directory=expdir1 schemas=trpt

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326262695&siteId=291194637
Recommended