日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 編程語言 正文

使用Oracle命令進(jìn)行數(shù)據(jù)庫備份與還原_oracle

更新時間: 2021-11-25 編程語言

數(shù)據(jù)導(dǎo)出:

1、將數(shù)據(jù)庫orcl完全導(dǎo)出,用戶名system 密碼manager 導(dǎo)出到D:\daochu.dmp中

exp system/manager@orcl file=d:\daochu.dmp full=y

2、將數(shù)據(jù)庫中system用戶與sys用戶的表導(dǎo)出

exp system/manager@orcl file=d:\daochu.dmp owner=(system,sys)

3、將數(shù)據(jù)庫中的表table1 、table2導(dǎo)出

exp system/manager@orcl file=d:\daochu.dmp tables=(table1,table2)

4、將數(shù)據(jù)庫中的表table1中的字段filed1以"00"打頭的數(shù)據(jù)導(dǎo)出

exp system/manager@orcl file=d:\daochu.dmp tables=(table1)query=\" where filed1 like '00%'\"

上面是常用的導(dǎo)出,對于壓縮我不太在意,用winzip把dmp文件可以很好的壓縮。

不過在上面命令后面 加上 compress=y 就可以了

數(shù)據(jù)導(dǎo)入:

1、將D:\daochu.dmp 中的數(shù)據(jù)導(dǎo)入 orcl數(shù)據(jù)庫中。

imp system/manager@orcl file=d:\daochu.dmp

上面可能有點問題,因為有的表已經(jīng)存在,然后它就報錯,對該表就不進(jìn)行導(dǎo)入。

在后面加上 ignore=y 就可以了。

2、將d:\daochu.dmp中的表table1 導(dǎo)入

imp system/manager@orcl file=d:\daochu.dmp tables=(table1)

基本上上面的導(dǎo)入導(dǎo)出夠用了。不少情況我是將表徹底刪除,然后導(dǎo)入。

注意:

你要有足夠的權(quán)限,權(quán)限不夠它會提示你。

數(shù)據(jù)庫時可以連上的。可以用tnsping orcl 來獲得數(shù)據(jù)庫orcl能否連上

附錄:

給用戶增加導(dǎo)入數(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-進(jìn)入dmp文件所在的目錄,?
imp userid=system/manager full=y file=*.dmp

或者

imp userid=system/manager full=y file=filename.dmp

原文鏈接:https://blog.csdn.net/weixin_42290280/article/details/93725795

欄目分類
最近更新