expdp/impdp可以基于table,schema,tablespace,database;
expdp的使用
1.选择合适的用户,具备一些特权,system用户即可
如果用其他用户,则需要赋予dba的权限 grant dba to
也需要grant read,write on directory ** to **
2.创建directory
在create directory ** as '/**/';之前要实际创建$mkdir /**/**
否则会报错:
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation
步骤:
mkdir
create directory ** as '/**/';
grant read,write on directory ** to **
导出整个数据库
expdp oracle/oracle directory=expdier dumpfile=file1_%U.dmp parallel=4 full=y;
导出schema
C:\Documents and Settings\Administrator>expdp system/oracle directory=dump_dir d
umpfile=schemascott.dmp schemas=scott
Export: Release 11.1.0.7.0 - Production on 星期三, 01 6月, 2011 15:04:46
Copyright (c) 2003, 2007, Oracle. All rights reserved.
连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=dump_dir dumpfi
le=schemascott.dmp schemas=scott
正在使用 BLOCKS 方法进行估计...
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 192 KB
处理对象类型 SCHEMA_EXPORT/USER
处理对象类型 SCHEMA_EXPORT/SYSTEM_GRANT
处理对象类型 SCHEMA_EXPORT/ROLE_GRANT
处理对象类型 SCHEMA_EXPORT/DEFAULT_ROLE
处理对象类型 SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE
处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/INDEX
处理对象类型 SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
处理对象类型 SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
. . 导出了 "SCOTT"."DEPT" 5.937 KB 4 行
. . 导出了 "SCOTT"."EMP" 8.570 KB 14 行
. . 导出了 "SCOTT"."SALGRADE" 5.867 KB 5 行
. . 导出了 "SCOTT"."BONUS" 0 KB 0 行
. . 导出了 "SCOTT"."FA" 0 KB 0 行
已成功加载/卸载了主表 "SYSTEM"."SYS_EXPORT_SCHEMA_01"
******************************************************************************
SYSTEM.SYS_EXPORT_SCHEMA_01 的转储文件集为:
D:\DUMP\SCHEMASCOTT.DMP
作业 "SYSTEM"."SYS_EXPORT_SCHEMA_01" 已于 15:05:18 成功完成
C:\Documents and Settings\Administrator>expdp scott/scott directory=dump_dir dum
pfile=tab.dmp tables=BONUS;
导入测试:
C:\Documents and Settings\Administrator>impdp system/oralce directory=dump_dir d
umpfile=tablespaces.dmp tablespaces=users;
Import: Release 11.1.0.7.0 - Production on 星期三, 01 6月, 2011 15:12:37
Copyright (c) 2003, 2007, Oracle. All rights reserved.
UDI-01017: 操作产生了 ORACLE 错误 1017
ORA-01017: invalid username/password; logon denied
用户名: system
口令:
连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31655: 尚未为作业选择数据或元数据对象
已成功加载/卸载了主表 "SYSTEM"."SYS_IMPORT_TABLESPACE_01"
启动 "SYSTEM"."SYS_IMPORT_TABLESPACE_01": system/******** directory=dump_dir du
mpfile=tablespaces.dmp tablespaces=users;
作业 "SYSTEM"."SYS_IMPORT_TABLESPACE_01" 已于 15:12:50 成功完成
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22821701/viewspace-661615/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22821701/viewspace-661615/