Oracle导入导出数据库(exp/imp和expdp/impdp的区别)
目录索引
1、exp和expdp的区别
2、expdp导出数据库流程
一、↓↓exp和expdp的区别↓↓
1、exp和expdp最明显的区别就是导出速度的不同。expdp导出是并行导出(如果把exp导出比喻为一个工人在挖土,那么expdp就相当于一个挖掘机在挖土)
2、exp和expdp导出不止是速度的不同,同事导出机制也完全不同,所有用expdp导出的dmp文件只能用impdp的方式导入。
二、↓↓expdp导出流程↓↓
1、创建dmp导出目录
create directory 目录名 as '目录路径'
--例:create directory expdp_dmp as 'D:/expdp_dmp'
2、查看当前创建的所有dmp导出目录 (验证看是否创建成功)
select * from dba_directories
--例:select * from dba_directories
3、为创建的目录赋权限
grant read,write on directory 目录名 to 需要赋值的用户名
--例:grant read,write on directory expdp_dmp to aaa;
4、导出
expdp 用户名/密码@数据库实例名 directory=导出目录 dumpfile=导出的文件名.dmp logfile=导出的日志名.log
--例:expdp aaa/aaaa@orcl directory=expdp_dmp dumpfile=aaa20170417.dmp logfile=aaa20170417.log
分类: 《Oracle》
https://www.cnblogs.com/yginuo/p/6721844.html
Oracle基础 exp/imp和expdp/impdp的区别:
一、exp/imp和expdp/impdp在功能上的区别:
1、把用户usera的对象导入到userb
emp/imp用法:
formuser=usera touser=userb;
empdp/impdp用法:
remap_schema='usera':'userb'
例如:
imp system/password fromuser=usera touser=userb file=back.dmp log=backlog.log;
impdp system/password directory=expdp dumpfile=back.dmp remap_schema='usera':'userb' logfile=backlog.log
2、更改表空间
用exp/imp,想要更改表空间,需要手动处理,如alter table xxx move tablespace_new之类的操作,而是用impdp只要用:
remap_tablespace='tablespace_old' : 'tablespace_new'
3、当制定多个表的时候
exp/imp用法:tables('table1','table2','table3')
expdp/impdp用法:tables='table1','table2','table3'
4、是否要导出数据行
exp rows=y,导出数据行,rows=n不导出数据行
expdp content(all:对象+数据行,data_only:只导出对象,metadata_only:只导出数据的记录)
Oracle10g提出的数据泵技术,在以下几个方面优于exp/imp命令:
1、数据泵工具运行于服务器端,相比客户端的exp/imp其性能更好,并能实现exp/imp的全部功能。
2、通过使用exclude,include,content等参数,数据泵可以为数据及数据对象提供更细微级别的选择性。
3、通过设定数据库版本号,数据泵可以兼容老版本的数据库系统。
4、并行执行。
5、通过estimate_only参数,数据泵可以预估导出作业所需的磁盘空间。
6、支持分布式环境中通过数据库连接实现导入\导出。
7、支持导入时重新映射功能(即将对象导入到新的目标数据文件、架构及表空间等)。
8、支持元数据压缩及数据采样。
https://www.cnblogs.com/zhengcheng/p/4201567.html
浅谈exp与expdp的区别
2012年11月19日 09:19:58 cunxiyuan108 阅读数:18902更多
个人分类: Oracle DBA
1:把用户usera的对象导到用户userb,用法区别在于fromuser=usera touser=userb ,remap_schema='usera':'usera' 。例如
imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log;
impdp system/passwd directory=expdp dumpfile=expdp.dmp remap_schema='usera':'userb' logfile=/oracle/exp.log;
2:更换表空间,用exp/imp的时候,要想更改表所在的表空间,需要手工去处理一下,
如alter table xxx move tablespace_new之类的操作。
用impdp只要用remap_tablespace='tabspace_old':'tablespace_new'
3:当指定一些表的时候,使用exp/imp 时,tables的用法是 tables=('table1','table2','table3')。
expdp/impdp的用法是tables='table1','table2','table3'
4:
是否要导出数据行
exp (ROWS=Y 导出数据行,ROWS=N 不导出数据行)
expdp content(ALL:对象+导出数据行,DATA_ONLY:只导出对象,METADATA_ONLY:只导出数据的记录)
注:1、IMP只适用于EXP导出文件,不适用于EXPDP导出文件;IMPDP只适用于EXPDP导出文件,而不适用于EXP导出文件
2、expdp/impdp是数据泵,是Oracle 10g 以后才有,expdp只能在服务器执行;导入导出速度比较快
https://blog.csdn.net/cunxiyuan108/article/details/8197968
exp/imp与expdp/impdp区别
分类: Oracle
2012-05-18 16:45:20
在平常备库和数据库迁移的时候,当遇到大的数据库的时候在用exp的时候往往是需要好几个小时,耗费大量时间。oracle10g以后可以用expdp来导出数据库花费的时间要远小于exp花费的时间,而且文件也要小很多。
1.使用expdp要先在数据库中创建directory,并给相应的用户read,write权限.
SQL>create dexp和empdp的区别irectory dmpdir as ‘/u01/dmdir’;
SQL>grant read,write on directory to test;
2.常用导出方法
$expdp scott/tiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=test
$expdp scott/tiger DUMPFILE=tmp_dump.dmp DIRECTORY=dmpdir TABLES=(tmp_test:p1,tmp_test:p2) JOB_NAME=tmp_dump LOGFILE=tmp_dump.log
$expdp scott/tiger DUMPFILE=full.dmp DIRECTORY=dmpdir FULL=Y JOB_NAME=full
$expdp scott/timer DUMPFILE=tmp_200703.dmp DIRECTORY=dmpdir TABLES=tmp QUERY=\”where to_char\(create_time,\’yyyy-mm-dd\’\)\<\'2007-04\'\"
常用一些参数说明:
SCOTT/TIGER:用户/密码(*)
DUMPFILE:导出后的文件名(*)
DIRECTORY:导出文件存放位置(位于服务器端)(*)
CONTENT:导出文件中包含的内容(默认为:ALL,可选DATA_ONLY/METADATA_ONLY)
FILESIZE:指定导出文件大小(单位为bytes).
JOB_NAME:此次导出进程使用的名称,方便跟踪查询(可选)
LOGFILE:日志文件名(默认为:export.log)
INCLUDE:导出时包含指定的类型
(例:INCLUDE=TABLE_DATA,
INCLUDE=TABLE:"LIKE 'TAB%'"
INCLUDE=TABLE:”NOT LIKE ‘TAB%’”…)
EXCLUDE:导出时排除的数据类型(例:EXCLUDE=TABLE:EMP)
FULL:全库导出时使用(同EXP的FULL,默认为N)
SCHEMA:导出某一个SCHEMA下的所有数据
TABLES:按表导出(这里的方法和EXP一样)
TABLESPACE:指定一个表空间导出.
QUERY:按表导出时,使用条件语句限定导出范围(同exp中的QUERY)
TRANSPORT_FULL_CHECK:
TRANSPORT_TABLESPACES:
FLASHBACK_SCN:
FLASHBACK_TIME:
PARALLEL:并行操作
PARFILE:
NETWORK_LINK:
当 Data Pump Export (DPE) 运行时,按 Control-C;它将阻止消息在屏幕上显示,但不停止导出进程本身。相反,它将显示 DPE 提示符(如下所示)。进程现在被认为处于“交互式”模式:
Export>
这种方法允许在这个 DPE 作业上输入命令查询及控制当前作业。
3.您可以通过 PARALLEL 参数为导出使用一个以上的线程来显著地加速作业。每个线程创建一个单独的转储文件,因此参数 dumpfile 应当拥有和并行度一样多的项目。您可以指定通配符作为文件名,而不是显式地输入各个文件名,例如:
expdp ananda/abc123 tables=CASES directory=DPDATA1 dumpfile=expCASES_%U.dmp parallel=4 job_name=Cases_Export
注意:dumpfile 参数拥有一个通配符 %U,它指示文件将按需要创建,格式将为expCASES_nn.dmp,其中nn 从 01 开始,然后按需要向上增加。
在并行模式下,状态屏幕将显示四个工作进程。(在默认模式下,只有一个进程是可见的)所有的工作进程同步取出数据,并在状态屏幕上显示它们的进度。
分离访问数据文件和转储目录文件系统的输入/输出通道是很重要的。否则,与维护 Data Pump 作业相关的开销可能超过并行线程的效益,并因此而降低性能。并行方式只有在表的数量多于并行值并且表很大时才是有效的。
4.exp/imp与expdp/impdp区别:
(1) 把用户usera的对象导到用户userb,用法区别在于fromuser=usera touser=userb ,remap_schema=’usera’:'usera’ 。例如:imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log;
impdp system/passwd directory=expdp dumpfile=expdp.dmp remap_schema=’usera’:'userb’ logfile=/oracle/exp.log;
(2) 更换表空间,用exp/imp的时候,要想更改表所在的表空间,需要手工去处理一下,
如alter table xxx move tablespace_new之类的操作。
用impdp只要用remap_tablespace=’tabspace_old’:'tablespace_new’
(3) 当指定一些表的时候,使用exp/imp 时,tables的用法是 tables=(‘table1′,’table2′,’table3′)。
expdp/impdp的用法是tables=’table1′,’table2′,’table3′
(4) 是否要导出数据行
exp (ROWS=Y 导出数据行,ROWS=N 不导出数据行)
expdp content(ALL:对象+导出数据行,DATA_ONLY:只导出对象,METADATA_ONLY:只导出数据的记录)
(5) expdp是[10g]的新特性而且只能在服务器执行。而exp/imp是通用的。
(6) oracle11g中有个新特性,当表无数据时,不分配segment,以节省空间,所以exp导不出空表。解决的办法是用expdp, 当然也可以设置deferred_segment_creation 参数 或者 insert一行,再rollback,但是这样很麻烦。
http://blog.chinaunix.net/uid-16844439-id-3213672.html
expdp导出
2017年12月21日 15:48:47 elementf 阅读数:229更多
个人分类: Oralce
《Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)》
《Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)》
目的:指导项目侧自行进行简单的数据泵迁移工作。
本文实验环境:Oracle 11.2.0.4,利用数据库自带的scott示例用户进行试验测试。
- 2.1 只导出scott用户的元数据,且不包含统计信息;
- 2.2 只导出scott用户的数据;
- 2.3 只导出scott用户下的emp,dept表及数据;
- 2.4 只导出scott用户下的emp,dept表结构;
- 2.5 导出scott用户下所有的内容;
- 2.6 并行导出scott用户下所有的内容;
特别注意:如果后续要导入的数据库版本低,所有导出命令就需要在后面加一个version=指定版本。
例如11g -> 10g,假设10g具体版本为10.2.0.1,那么就加一个版本的参数version=10.2.0.1
。
1. 首先需要创建Directory
这里目录名字定义为"jy",
若是windows平台,对应系统目录为"E:\jingyu";
create or replace directory jy as 'E:\jingyu';
若是Unix/Linux平台,对应系统目录为"/tmp/jingyu".
create or replace directory jy as '/tmp/jingyu';
注意:目录在系统上需要真实存在(mkdir -p /tmp/jingyu),且有访问的权限。
drwxr-xr-x. 2 oracle oinstall 4.0K May 22 16:48 jingyu
2. 使用expdp导出用户数据
2.1 只导出scott用户的元数据,且不包含统计信息;
expdp system directory=jy schemas=scott content=metadata_only exclude=statistics dumpfile=scott_meta.dmp logfile=scott_meta.log
-
$ expdp system directory=jy schemas=scott content=metadata_only exclude=statistics dumpfile=scott_meta.dmp logfile=scott_meta.log
-
Export: Release 11.2.0.4.0 - Production on Fri May 22 16:57:59 2015
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
Password:
-
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
-
and Real Application Testing options
-
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=jy schemas=scott content=metadata_only exclude=statistics dumpfile=scott_meta.dmp logfile=scott_meta.log
-
Processing object type SCHEMA_EXPORT/USER
-
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
-
Processing object type SCHEMA_EXPORT/ROLE_GRANT
-
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
-
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
-
Processing object type SCHEMA_EXPORT/TABLE/TABLE
-
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
-
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
-
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
-
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
-
******************************************************************************
-
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
-
/tmp/jingyu/scott_meta.dmp
-
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri May 22 16:58:13 2015 elapsed 0 00:00:11
2.2 只导出scott用户的数据;
expdp system directory=jy schemas=scott content=data_only dumpfile=scott_data.dmp logfile=scott_data.log
-
$ expdp system directory=jy schemas=scott content=data_only dumpfile=scott_data.dmp logfile=scott_data.log
-
Export: Release 11.2.0.4.0 - Production on Fri May 22 16:58:47 2015
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
Password:
-
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
-
and Real Application Testing options
-
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=jy schemas=scott content=data_only dumpfile=scott_data.dmp logfile=scott_data.log
-
Estimate in progress using BLOCKS method...
-
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
-
Total estimation using BLOCKS method: 192 KB
-
. . exported "SCOTT"."DEPT" 5.929 KB 4 rows
-
. . exported "SCOTT"."EMP" 8.484 KB 12 rows
-
. . exported "SCOTT"."SALGRADE" 5.859 KB 5 rows
-
. . exported "SCOTT"."BONUS" 0 KB 0 rows
-
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
-
******************************************************************************
-
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
-
/tmp/jingyu/scott_data.dmp
-
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri May 22 16:58:57 2015 elapsed 0 00:00:07
2.3 只导出scott用户下的emp,dept表及数据;
这里如果用scott用户导出,需要注意scott用户对于directory的权限问题:需要dba用户赋予scott用户read,write目录的权限。
即:grant read, write on directory jy to scott;
-
SQL> grant read, write on directory jy to scott;
-
Grant succeeded.
expdp scott directory=jy tables=emp,dept dumpfile=scott_emp_dept.dmp logfile=scott_emp_dept.log
-
$ expdp scott directory=jy tables=emp,dept dumpfile=scott_emp_dept.dmp logfile=scott_emp_dept.log
-
Export: Release 11.2.0.4.0 - Production on Fri May 22 17:13:55 2015
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
Password:
-
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
-
and Real Application Testing options
-
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=jy tables=emp,dept dumpfile=scott_emp_dept.dmp logfile=scott_emp_dept.log
-
Estimate in progress using BLOCKS method...
-
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
-
Total estimation using BLOCKS method: 128 KB
-
Processing object type TABLE_EXPORT/TABLE/TABLE
-
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
-
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
-
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
-
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
-
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
-
. . exported "SCOTT"."DEPT" 5.929 KB 4 rows
-
. . exported "SCOTT"."EMP" 8.484 KB 12 rows
-
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
-
******************************************************************************
-
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
-
/tmp/jingyu/scott_emp_dept.dmp
-
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Fri May 22 17:14:04 2015 elapsed 0 00:00:06
2.4 只导出scott用户下的emp,dept表结构;
expdp scott directory=jy tables=emp,dept content=metadata_only dumpfile=scott_emp_dept_meta.dmp logfile=scott_emp_dept_meta.log
-
$ expdp scott directory=jy tables=emp,dept content=metadata_only dumpfile=scott_emp_dept_meta.dmp logfile=scott_emp_dept_meta.log
-
Export: Release 11.2.0.4.0 - Production on Fri May 22 17:14:51 2015
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
Password:
-
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
-
and Real Application Testing options
-
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=jy tables=emp,dept content=metadata_only dumpfile=scott_emp_dept_meta.dmp logfile=scott_emp_dept_meta.log
-
Processing object type TABLE_EXPORT/TABLE/TABLE
-
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
-
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
-
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
-
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
-
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
-
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
-
******************************************************************************
-
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
-
/tmp/jingyu/scott_emp_dept_meta.dmp
-
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Fri May 22 17:15:01 2015 elapsed 0 00:00:07
2.5 导出scott用户下所有的内容;
expdp system directory=jy schemas=scott dumpfile=scott_all.dmp logfile=scott_all.log
-
$ expdp system directory=jy schemas=scott dumpfile=scott_all.dmp logfile=scott_all.log
-
Export: Release 11.2.0.4.0 - Production on Fri May 22 17:15:52 2015
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
Password:
-
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
-
and Real Application Testing options
-
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=jy schemas=scott dumpfile=scott_all.dmp logfile=scott_all.log
-
Estimate in progress using BLOCKS method...
-
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
-
Total estimation using BLOCKS method: 192 KB
-
Processing object type SCHEMA_EXPORT/USER
-
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
-
Processing object type SCHEMA_EXPORT/ROLE_GRANT
-
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
-
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
-
Processing object type SCHEMA_EXPORT/TABLE/TABLE
-
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
-
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
-
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
-
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
-
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
-
. . exported "SCOTT"."DEPT" 5.929 KB 4 rows
-
. . exported "SCOTT"."EMP" 8.484 KB 12 rows
-
. . exported "SCOTT"."SALGRADE" 5.859 KB 5 rows
-
. . exported "SCOTT"."BONUS" 0 KB 0 rows
-
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
-
******************************************************************************
-
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
-
/tmp/jingyu/scott_all.dmp
-
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri May 22 17:16:06 2015 elapsed 0 00:00:11
2.6 并行导出scott用户下所有的内容;
expdp system directory=jy schemas=scott dumpfile=scott_all%U.dmp logfile=scott_all.log parallel=2
-
$ expdp system directory=jy schemas=scott dumpfile=scott_all%U.dmp logfile=scott_all.log parallel=2
-
Export: Release 11.2.0.4.0 - Production on Fri May 22 16:55:13 2015
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
Password:
-
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
-
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
-
and Real Application Testing options
-
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=jy schemas=scott dumpfile=scott_all%U.dmp logfile=scott_all.log parallel=2
-
Estimate in progress using BLOCKS method...
-
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
-
Total estimation using BLOCKS method: 192 KB
-
Processing object type SCHEMA_EXPORT/USER
-
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
-
Processing object type SCHEMA_EXPORT/ROLE_GRANT
-
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
-
. . exported "SCOTT"."DEPT" 5.929 KB 4 rows
-
. . exported "SCOTT"."EMP" 8.484 KB 12 rows
-
. . exported "SCOTT"."SALGRADE" 5.859 KB 5 rows
-
. . exported "SCOTT"."BONUS" 0 KB 0 rows
-
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
-
Processing object type SCHEMA_EXPORT/TABLE/TABLE
-
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
-
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
-
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
-
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
-
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
-
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
-
******************************************************************************
-
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
-
/tmp/jingyu/scott_all01.dmp
-
/tmp/jingyu/scott_all02.dmp
-
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri May 22 16:56:12 2015 elapsed 0 00:00:54
3. 查询当前用户用到的表空间
-
select tablespace_name from user_tables union
-
select tablespace_name from user_tab_partitions union
-
select tablespace_name from user_indexes union
-
select tablespace_name from user_ind_partitions;
Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)
转载自:http://www.cnblogs.com/jyzhao/p/4522868.html
https://blog.csdn.net/elementf/article/details/78864608
exp和expdp 导出性能比较
[日期:2016-08-03] | 来源:Linux社区 作者:Linux | [字体:大 中 小] |
EXP常规模式、EXP直接路径模式和EXPDP三种方式导出的性能对比
1.首先是EXP的常规路径导出:
exp linuxidc/zhejiang file=/data1/zj_regular.dmp buffer=20480000
常规EXP导出方式执行了1小时24分钟。
2.直接路径导出方式:
exp linuxidc/zhejiang file=/data1/zj_direct.dmp buffer=20480000
recordlength=65535 direct=y
直接路径导入用时18分钟,比常规路径导出速度有一个明显的提高。
3.数据泵的导出速度。
expdp linuxidc/zhejiang dumpfile=zj_datapump.dp directory=d_test schemas=linuxidc
数据泵的导出时间仅用了14分钟,比直接路径导入方式还快了20%多。而且观察三个导出文件的大小可以发现,导出速度越快对应的文件也越小,其中数据泵的导出方式得到的文件要比EXP方式小将近1.5G。
IMP和IMPDP导入性能对比
1.IMP的导入速度:
imp linuxidc/zhejiang file=/data1/zj_regular.dmp full=y buffer=20480000 log=/data1/zj_regular.log
IMP导入花费了3小时17分钟,
2.IMPdp的导入速度:
impdp linuxidc/zhejiang DUMPFILE=zj_datapump.dp DIRECTORY=d_test FULL=y LOGFILE=zj_datapump.log
数据泵的导入操作居然花了3个小时8分钟的时间,和IMP的导入速度十分接近,看来并非所有情况下都像Oracle描述的那样,数据泵的导入比普通导入效率有大幅度的提高。
上面一篇文章的测试中发现IMPDP的导入速度和IMP导入速度相差无几。而Oracle在介绍数据泵的时候,提到IMPDP的导入速度最高是IMP的10倍。不过好在IMPDP还是可以优化调整的,那就是通过设置PARALLEL来提高IMPDP的并行度。
首先还是看一下CPU的数量:
SQL> show parameter cpu
由于数据库服务器的CPU个数为2,下面尝试设置PARALLEL为2来进行导入
impdp linuxidc/zhejiang DUMPFILE=zj_datapump.dp DIRECTORY=d_test FULL=y LOGFILE=zj_datapump.log parallel=2
采用并行度为2的导入方式,发现速度果然提高了很多。并行度为1的导入速度是3小时8分钟,而现在用了不到2个半小时。
由于并行度设置不应该超过CPU数的2倍,因此尝试平行度3和4的导入,导入时间和并行度2十分接近。看来已经无法再使用通过提高并行度的方法来提高性能了。
1.先看直接导出的性能:
$ expdp linuxidc/zhejiang directory=d_test dumpfile=linuxidc.dp
整个导出操作大概用了14分半,
2.尝试使用并行度2进行导出,这时仍然设置一个导出的数据文件:
$ expdp linuxidc/zhejiang directory=d_test dumpfile=linuxidc_p2_1file.dp parallel=2
整个导入过程不到14分钟,不过这个性能的提升实在不是很明显。不过这是有原因的,由于设置了并行度,两个进程在同时执行导出操作,但是二者要将导出的数据写入同一个数据文件中,因此必然会导致资源的争用
3.仍然使用并行度2,但是同时设置两个数据文件再次检查导出性能:
$ expdp linuxidc/zhejiang directory=d_test dumpfile=linuxidc_p2_2file1.dp,linuxidc_p2_2file2.dp parallel=2
这次导出仅仅用了10分半,导出的效率大大的提高。
4.测试一下并行度4,分别导出到4个数据文件中:
用了9分钟整导出完成,设置成并行度4仍然可以获得一定的性能提升,但是并不明显了,这主要是由于整个性能的瓶颈已经不是单个进程的处理能力,多半性能的瓶颈已经变成了磁盘IO瓶颈,此时单单靠增加并行度已经无法明显提升性能了。
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-08/133896.htm
https://www.linuxidc.com/Linux/2016-08/133896.htm
oracle导出dmp文件的2种方法
使用exp和expdp导出数据
1.exp导出数据命令
exp gd_base/11@192.168.13.211/oanet file=D:\export\gd_base.dmp log=D:\export\gd_base.log full=y
2.expdp导出数据
(1)cmd窗口连接数据库,进入sqlplus页面
sqlplus sys/sys@192.168.13.211/oanet as sysdba
(2)创建目录对象(使用管理员账号登录创建)
SQL> create or replace directory dump_dir as 'D:\fzb';
创建好后,退出sqlplus
(3)在操作系统上创建相应的目录,如在D盘目录下建立文件夹fzb
(4)连接数据库执行导出命令
把base库和dbwizard库全部导入
expdp system/123123@192.168.13.211/oanet directory=dump_dir dumpfile=XX.dmp schemas=gd_base,gd_dbwizard;
把该实例下所有数据库导出
expdp system/123123@192.168.13.211/oanet directory=dump_dir dumpfile=XX.dmp Full=y;
分类: 08.Oracle相关
https://www.cnblogs.com/hanmk/p/7238713.html