1 說明
dmp文件為oracle數據庫的數據備份文件,執行oracle數據庫導出dmp文件,相當於執行數據庫備份;執行導入dmp文件,相當於數據庫還原。
2 導出dmp文件
在dos控制台下執行如下指令:
su -oracle
exp iflashbuy/password@width246 file=iflashbuy20140121.dmp owner=iflashbuy246
其中:
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系統的終端執行數據庫恢復和備份。
bout to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user IFLASHBUY
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user IFLASHBUY
About to export IFLASHBUY's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
EXP-00056: ORACLE error 1652 encountered
ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
EXP-00000: Export terminated unsuccessfully
原因:臨時表空間不夠