使用Oracle命令進行數(shù)據(jù)庫備份與還原
數(shù)據(jù)導出:
1、將數(shù)據(jù)庫orcl完全導出,用戶名system 密碼manager 導出到D:\daochu.dmp中
exp system/manager@orcl file=d:\daochu.dmp full=y
2、將數(shù)據(jù)庫中system用戶與sys用戶的表導出
exp system/manager@orcl file=d:\daochu.dmp owner=(system,sys)
3、將數(shù)據(jù)庫中的表table1 、table2導出
exp system/manager@orcl file=d:\daochu.dmp tables=(table1,table2)
4、將數(shù)據(jù)庫中的表table1中的字段filed1以"00"打頭的數(shù)據(jù)導出
exp system/manager@orcl file=d:\daochu.dmp tables=(table1)query=\" where filed1 like '00%'\"
上面是常用的導出,對于壓縮我不太在意,用winzip把dmp文件可以很好的壓縮。
不過在上面命令后面 加上 compress=y
就可以了
數(shù)據(jù)導入:
1、將D:\daochu.dmp 中的數(shù)據(jù)導入 orcl數(shù)據(jù)庫中。
imp system/manager@orcl file=d:\daochu.dmp
上面可能有點問題,因為有的表已經(jīng)存在,然后它就報錯,對該表就不進行導入。
在后面加上 ignore=y
就可以了。
2、將d:\daochu.dmp中的表table1 導入
imp system/manager@orcl file=d:\daochu.dmp tables=(table1)
基本上上面的導入導出夠用了。不少情況我是將表徹底刪除,然后導入。
注意:
你要有足夠的權(quán)限,權(quán)限不夠它會提示你。
數(shù)據(jù)庫時可以連上的??梢杂?code>tnsping orcl 來獲得數(shù)據(jù)庫orcl
能否連上
附錄:
給用戶增加導入數(shù)據(jù)權(quán)限的操作
- 第一,啟動sql*puls
- 第二,以system/manager登陸
- 第三,create user 用戶名 IDENTIFIED BY 密碼 (如果已經(jīng)創(chuàng)建過用戶,這步可以省略)
- 第四,
GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW , DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE, DBA,CONNECT,RESOURCE,CREATE SESSION TO 用戶名字
- 第五, 運行-cmd-進入dmp文件所在的目錄,?
imp userid=system/manager full=y file=*.dmp
或者
imp userid=system/manager full=y file=filename.dmp
到此這篇關(guān)于使用Oracle命令進行數(shù)據(jù)庫備份與還原的文章就介紹到這了。希望對大家的學習有所幫助,也希望大家多多支持本站。
版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。