单刀刑天 发表于 2013-1-14 08:39:38

Oracle导入导出dmp文件

1        说明

dmp文件为oracle数据库的数据备份文件,执行oracle数据库导出dmp文件,相当于执行数据库备份;执行导入dmp文件,相当于数据库还原。
2        导出dmp文件

在dos控制台下执行如下指令:
exp  user/password@orcl   file=d:\xxx.dmp
其中:
user        //导出数据库表空间的用户名
password   //对应的密码
orcl        //数据库服务名(SID)
file        //导出的dmp文件存放路径
 
执行过程中,控制台输出:
 
Export: Release 10.1.0.2.0 - Production on星期一 4月 9 15:16:33 2012
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user MEDICINE
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user MEDICINE
About to export MEDICINE's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export MEDICINE's tables via Conventional Path ...
. . exporting table        CERTIFICATEVERRELATION         20 rows exported
. . exporting table ENTERPRISEAPTITUDESVERRELATION         4 rows exported
. . exporting table             SELLAPPROVECONFIG          0 rows exported
. .……
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
3        导入dmp文件

3.1     环境准备

使用sys用户,以dba角色登录oracle数据库的em,创建表空间以及访问该表空间的用户名,并赋予用户如下角色:
1)   connect
2)   dba
3)   EXP_FULL_DATABASE
4)   IMP_FULL_DATABASE
5)   RESOURCE
并赋予下列权限
 
3.2     执行导入

系统控制台下输入:
imp user/psw@sid
其中:
user——数据库表空间的用户名
psw——数据库表空间的密码
sid——数据库服务名(sid)
 
执行后窗体提示输入dmp文件路径:
 
输入dmp文件路径后,后面提示选项使用默认值即可,具体界面如下:
 
3.3     指令解释

1)         imp          user/psw@sid 执行导入指令;
2)         EXPDAT.DMP >                  提示输入dmp文件路径;
3)         enter       insert        buffer       size  (min is 8192) 30720:提示最小设置为8192,建议设置30720,可以使用30720即可;
4)         list    contents  of      import      file    only,提示输入no。
5)         后面的4个输入,均使用默认值;
6)         username:输入导出dmp文件的用户名,这样将导入该用户名关联的所有表对象;
7)         if       done:输入回车;
8)         执行导入…
注意:数据库中已经有的对象,执行导入的时候不覆盖,提示对象已经存在而执行失败的错误,输入如下:
 
4        注意事项

4.1     linux环境下数据库恢复操作

不能通过ssh登录远程linux执行数据库恢复、备份,必须通过远程桌面,在linux系统的终端执行数据库恢复和备份。
 
本文为转发, 原文地址:http://blog.csdn.net/kuangkunkui/article/details/7814004
页: [1]
查看完整版本: Oracle导入导出dmp文件