oracle10g怎麼備份和恢復資料庫

時間 2022-02-13 01:08:52

1樓:

oracle10g資料庫中,資料庫檔案的備份與恢復可以有很多的方式來實現,這裡介紹一種基於使用者管理的備份與恢復。基於使用者管理的備份是指使用os命令來備份資料庫物理檔案。

備份資料庫

資料庫一致性備份:關閉資料庫以後備份資料庫物理檔案,這時資料檔案scn值完全一致,所以稱之為資料庫的一致性備份或冷備份,適用於歸檔模式與非歸檔模式。

對基於使用者管理的冷備份的暫時理解:在資料庫shutdown狀態下使用os命令直接拷貝資料庫物理檔案。

資料庫非一致性備份:在open狀態下備份資料庫物理檔案,這時資料庫內容可能會改變導致資料檔案scn不一致,所以稱之為資料庫的非一致性備份或熱備份,只適用於歸檔模式。

基於使用者管理的完全恢復(歸檔模式下)

1.在open狀態下備份資料庫物理檔案(資料庫非一致性備份,熱備份,不影響業務執行)

2.刪除資料檔案來模擬檔案丟失(只是刪除了所有的資料檔案;控制檔案等其它檔案處於正常狀態)

3.對資料檔案進行恢復

4.應用歸檔日誌

5.檢視資料是否完全恢復

--sysdba執行備份

sql> conn / as sysdba

connected.

sql> select name from v$datafile;

name

/oracle/10g/oracle/product/10.2.0/oradata/oralife/system01.dbf

/oracle/10g/oracle/product/10.2.0/oradata/oralife/undotbs01.dbf

/oracle/10g/oracle/product/10.2.0/oradata/oralife/sysaux01.dbf

/oracle/10g/oracle/product/10.2.0/oradata/oralife/users01.dbf

/oracle/10g/oracle/product/10.2.0/oradata/oralife/example01.dbf

sql> alter database begin backup;

database altered.

sql> host cp /oracle/10g/oracle/product/10.2.0/oradata/oralife/*.

dbf /oracle/10g/oracle/bakup/database/ --備份所有資料檔案

sql> alter database backup controlfile to '/oracle/10g/oracle/bakup/database/oralife.ctl'; --備份控制檔案

database altered.

sql> alter system archive log current; --歸檔當前日誌組

system altered.

進行完全恢復

copy備份的資料檔案到指定的目標位置,進行恢復:

sql> recover database --open狀態

ora-00283: recovery session canceled due to errors

ora-01124: cannot recover data file 1 - file is in use or recovery

ora-01110: data file 1:

'/oracle/10g/oracle/product/10.2.0/oradata/oralife/system01.dbf'

sql> shutdown immediate --open狀態

ora-01122: database file 1 failed verification check

ora-01110: data file 1: '/oracle/10g/oracle/product/10.

2.0/oradata/oralife/system01.dbf'

ora-01208: data file is an old version - not accessing current version

sql> startup force mount; --進入mount狀態進行恢復

oracle instance started.

total system global area 528482304 bytes

fixed size 1220360 bytes

variable size 163578104 bytes

database buffers 356515840 bytes

redo buffers 7168000 bytes

database mounted.

sql> recover database

media recovery complete.

sql> alter database open;

database altered.

沒有出現應用歸檔日誌,應用歸檔日誌有幾種方式:

specify log:

當在open狀態下對資料檔案進行恢復時,應該將其offline,恢復完成後,再將其online;所有的恢復應該盡量在open狀態下完成。

2樓:

匯出(備份)

exp 使用者名稱/密碼@服務名 file=d:daochu.dmp (rows=no(匯出空結構))

匯入(恢復)

imp 使用者名稱/密碼@服務名 file=d:daochu.dmp fromuser=原使用者名稱 touser=新使用者名稱

3樓:第0387號上帝

一樓的回答好全面。

可以當資料收藏了。

oracle11g和oracle10g的區別是什麼

相對oracle10g而言,oracle 11g具有了與眾不同的特性。1 在oracle 11g中資料安全需求越來越高,擴充對lob和表空間的透明資料加密 transparent data encryption,即tde 特性來提高資料的安全性。2 oracle 11g新的securefile特性主...

oracle10g不能安裝,安裝oracle10g「程式異常終止

1 如果不能安裝oracle10g可以更換其它oracle版本。2 如果是win7系統安裝oracle10g,需要修改所支援的版本,方法如下 1 點選oracle安裝檔案,查詢refhost.xml檔案,一般10g版本有2處refhost.xml。第一處在db disk1 stage prereq ...

oracle 10g關於startup的問題

這是個windows下oracle假啟動問題,試試如下解決方法 開始 oracle oradb10g home1 configuration and migration tools administration assistant for windows 把選單全部開啟找到你的database下有你...

在linux下安裝oracle 10g資料庫總是出錯了,弄了

不知道你現在已經解決了你的問題沒,我也出現了和你一樣的問題,原因我知道了,就是在我們安裝資料庫的時候,我們沒有選擇建立資料庫例項導致我們缺少這個檔案,但是解決方法我還沒有找到,前提是不重新安裝資料庫。將 oracle base admin 資料庫名稱 pfile目錄下的init.ora.012009...

linu安裝oracle10g可用空間不足怎樣解決

空間不足,說明磁碟空間用完了,此時需要新增新的磁碟才行。1 取消安裝 2 新增一塊新盤,將新的磁碟格式化並新建分割槽,掛載到要安裝的目錄下。寫入開機啟動 3 重新安裝oracle 建議新增新盤之後重新安裝,否則裝好說不准出各種問題 調整啊。安裝系統的時候不要用推薦的安裝,最好自己定義一下個分割槽的大...