expdp/impdp的使用

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 system/oracle directory=dump_dir d
umpfile=tablespaces.dmp tablespaces=users

Export: Release 11.1.0.7.0 - Production on 星期三, 01 6月, 2011 15:07:53

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_TABLESPACE_01":  system/******** directory=dump_dir du
mpfile=tablespaces.dmp tablespaces=users
正在使用 BLOCKS 方法进行估计...
处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 192 KB
处理对象类型 TABLE_EXPORT/TABLE/TABLE
处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . 导出了 "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_TABLESPACE_01"
******************************************************************************
SYSTEM.SYS_EXPORT_TABLESPACE_01 的转储文件集为:
  D:\DUMP\TABLESPACES.DMP
作业 "SYSTEM"."SYS_EXPORT_TABLESPACE_01" 已于 15:08:15 成功完成
导出表

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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值