入的。
3。data pump不支持XML schemas
4。使用前必须要先创建目录:
SQL> CREATE OR REPLACE DIRECTORY dpump_dir as '/oracle/oradata/ORCL10/pumpdata';
查询目录:dba_directories
Oracle数据泵为了提高性能,采用直接路径的方式,通过数据库建立的DIRECTORY将数据导入。
这造成了数据泵和IMP一个主要的区别。如果在客户端进行IMP导入,dmp文件是放在客户端的。但是如果通过数据泵的方式导入,数据泵文件总是放在数据库服务器端。
5。给导入导出的用户赋予目录的读写权限:
SQL> GRANT READ, WRITE ON DIRECTORY dpump_dir TO scott;
6。datapump是服务器端的JOB,所以可以在执行datapump以后,通过EXIT_CLIENT退出客户端。通过DBA_DATAPUMP_JOBS视图可以检查datapump作业的情况,也可以利用ATTACH重新连接上还在进行的JOB。每个datapump可以通过JOB_NAME参数指定名称,如果不指定,那么会有默认的名称,比如上贴中的例子,名称就是SYS_EXPORT_TABLE_01,通过V$SESSION_LONGOPS也可以查看长时间运行的datapump job的具体内容。
7.以下参数影响data pump的性能
disk_asynch_io = true
db_block_checking = false
db_block_checksum = false
8.以下参数设置越高,来允许最大的并行度
processes
sessions
parallel_max_servers
9. 以下参数应该被设置大点
shared_pool_size
undo_tablespace
实验以及例子:
==================================================================
创建目录,dumpdir是自己命名的名称
SQL> create directory dumpdir as 'e:datadump';
删除目录
SQL> drop directory dumpdir ;
SQL> grant read,write on directory dumpdir to scott;
//导出一个schema:scott
C:>expdp scott/tiger dumpfile=scott.dmp directory=dumpdir schemas=scott
SQL> create user lihui identified by lihui;
SQL> grant create session,resource to lihui;
SQL> grant read,write on directory dumpdir to lihui;
SQL> grant create database link, create synonym, create view to lihui;
SQL> grant imp_full_database to scott;
//导入到lihui这个schema下
C:>impdp scott/tiger directory=dumpdir dumpfile=scott.dmp logfile=scott.log remap_schema=scott:lihui
--参数remap_schema将scott下的内容导入导李辉这个schema下
提高impdp导入的的速度,与并行操作有关:
SQL> show parameter cpu
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cpu_count integer 2
parallel_threads_per_cpu integer 2
通过parallel参数导出使用一个以上的线程来显著的加速作业.每个线程创建一个单独的转储文件,
因此dumpfile应当拥有和并行度一样多的项目.可以使用通配符命名文件名,而不用显式的输入各个文件名,e.g
expdp lihui/lihui tables=(emp,dept) directory=dumpdir dumpfile=test_%U.dmp parallel=2 job_name=test
--%U是通配符,参数parallel并行度
数据库监控:
监控作业的主要视图:
dba_datapump_sessions,在执行任务的时候监控前台进程的会话.
dba_datapump_jobs,监控在作业上有多少个工作进程(degree列)在工作.
也可以通过alert日志文件查看到进程的信息.
处理特定对象:
e.g
只导出存储过程,而不导出其它对象:
expdp scott/tiger directory=dumpdir dumpfile=pros.dmp include=PROCEDURE
只导出一些特定的对象(比如函数FUNC1和过程PROC1)
expdp scott/tiger directory=dumpdir dumpfile=pro_fun.dmp include=PROCEDURE:"='PROC1'",FUNCTION:'='FUNC1'"
全库导出:
expdp system/sys directory=dumpdir dumpfile=full.dmp full=y job_name=expdpfull logfile=full.log//全库导出
//使用Ctrl+c 可以退出交互模式,但是expdp操作不会停止,因为expdp是数据库内部定义的任务已经与客户端无关。退出后可以查看其导出状态
Export> status
可以使用stop_job命令真正停止该操作。
expdp导出的时候取的是客户端的时间,而导入完成取的是服务器端的时间,应该算是个bug。
问题:
如果发现执行在语句正确,但是导出失败,报错误:
C:>expdp scott/tiger@ora10g dumpfile=scott.dp directory=dumpdir schemas=scott l
ogfile=scott.log
Export: Release 10.2.0.3.0 - Production on 星期四, 18 12月, 2008 14:05:46
Copyright (c) 2003, 2005, Oracle. All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-39002: 操作无效
ORA-39070: 无法打开日志文件。
ORA-29283: 文件操作无效
ORA-06512: 在"SYS.UTL_FILE", line 4