在Oracle的備份與恢復的知識點中,經常會出現Restore 和 Recovery兩個詞。
由於這兩個詞在字典中的解釋很接近,Oracle的官方文檔中看到了以下解釋。
Restoration:A corrupted data file is overwritten from a backup of the data file .The data file is at a prior point of time than the
current database.
Recovery:Recovery applies the changes to the individual blocks,using archive and redo information,to move the database
forward to the current point in time.
從原理上解釋,Restore是使用備份文件,將數據庫還原到過去的某個狀態。
Recovery是使用redo日志和歸檔日志將數據庫向前恢復,一步步的恢復到現在這個時點。
舉個例子。
某生產環境的數據庫,每天凌晨一點會作一次備份。某天下午兩點時數據庫文件損害,同時數據庫宕機。
接着DBA開始恢復數據庫。
1.首先,使用最近一次的備份文件還原數據庫到當天凌晨一點的狀態。但是凌晨一點到下午兩點的數據丟失了。
2.接着,使用redo日志和歸檔日志,把當天凌晨一點開始的數據庫操作重做一遍,直到下午兩點數據庫宕機前。
這樣數據庫就一點都不差的被恢復起來了。
所以,把Restore翻譯為還原。Recovery翻譯為恢復比較好。
Oracle rman中recover和restore的區別:
restore just copy the physical file, recover will consistent the database.
restore 是還原,文件級的恢復。就是物理文件還原。
recover 是恢復,數據級的恢復。邏輯上恢復,比如應用歸檔日志、重做日志,全部同步,保持一致。
1、restore 命令:用於還原已經備份的數據文件。
(1)、restore database 還原所有的數據文件。
(2)、restore tablespace 還原特定表空間的數據文件。
(3)、restore datafile 還原特定的數據文件。
(4)、restore controlfile 還原控制文件。
(5)、restore archivelog 還原歸檔日志文件。
2、recover 命令:當數據庫需要應用歸檔日志文件恢復數據文件時,使用recover命令。使用該命令數據庫系統會自動應用歸檔的日志文件。
(1)、recover database 恢復所有的數據文件。
(2)、recover tablespace 恢復特定表空間的數據文件。
(3)、recover datafile 恢復特定的數據文件。