閃回還原點restore point
閃回還原點flashback restore point有兩種,一種是正常還原點normal restore point,一種是擔保還原點guaranteed restore point。
正常還原點和擔保還原點的資訊都是儲存在控制檔案中的,針對這點,二者又是存在區別的:正常還原點的資訊如果不手動刪除,控制檔案是可以自動管理刪除的,而擔保還原點的資訊如果不手動刪除,就會一直儲存在控制檔案中,是不會自動刪除的。也就是說,只要建立了擔保還原定並且沒有手動刪除掉,那麼資料庫就可以恢復到這個還原點的狀態。
如果擔保還原點和flashback database一起使用,那麼資料庫就可以恢復到擔保還原點和之後的任何時間點。
擔保還原點必須在資料庫處於flashback on 的情況下才可以定義,擔保還原點可以保證準確地將資料庫flashback到定義的還原點。
在flashback on 狀態下建立還原點:
normal restore point
建立一個normal restore point:
檢視v$restore_point這個檢視就可以看到建立的還原點:
SYS@orcl 19-OCT-14>desc v$restore_point
Name Null? Type
----------------------------------------- -------- ----------------------------
SCN NUMBER
DATABASE_INCARNATION# NUMBER
GUARANTEE_FLASHBACK_DATABASE VARCHAR2(3)
STORAGE_SIZE NUMBER
TIME TIMESTAMP(9)
RESTORE_POINT_TIME TIMESTAMP(9)
PRESERVED VARCHAR2(3)
NAME VARCHAR2(128)
Name Null? Type
----------------------------------------- -------- ----------------------------
SCN NUMBER
DATABASE_INCARNATION# NUMBER
GUARANTEE_FLASHBACK_DATABASE VARCHAR2(3)
STORAGE_SIZE NUMBER
TIME TIMESTAMP(9)
RESTORE_POINT_TIME TIMESTAMP(9)
PRESERVED VARCHAR2(3)
NAME VARCHAR2(128)
SYS@orcl 19-OCT-14>col name for a30
SYS@orcl 19-OCT-14>select scn,name,guarantee_flashback_database,time from v$restore_point;
SCN NAME GUA TIME
---------- --------------------- --------- --- ---------------------------------------------------------------------------
2218982 NORMAL_POINT NO 19-OCT-14 06.14.36.000000000 PM
SCN NAME GUA TIME
---------- --------------------- --------- --- ---------------------------------------------------------------------------
2218982 NORMAL_POINT NO 19-OCT-14 06.14.36.000000000 PM
可以看到,名為normal_point的還原點是一個正常還原點,而不是擔保還原點。
將使用者切換到hh,建立一張測試表以模擬誤操作:
下面切換到sys使用者,使用還未建立表t1時建立的restore point來還原資料庫(注意,此時要關閉資料庫,重啟到mount狀態):
HH@orcl 19-OCT-14>conn /as sysdba
Connected.
SYS@orcl 19-OCT-14>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl 19-OCT-14>startup mount;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
Connected.
SYS@orcl 19-OCT-14>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl 19-OCT-14>startup mount;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
將資料庫還原到還原點normal_point:
使用resetlogs開啟資料庫:
SYS@orcl 19-OCT-14>alter database open resetlogs;
Database altered.
切換到hh,檢視錶t1是否還存在:
SYS@orcl 19-OCT-14>conn hh/hh
Connected.
HH@orcl 19-OCT-14>select * from t1;
select * from t1
*
ERROR at line 1:
ORA-00942: table or view does not exist
Connected.
HH@orcl 19-OCT-14>select * from t1;
select * from t1
*
ERROR at line 1:
ORA-00942: table or view does not exist
可以看到,表t1已經不存在了,說明此時資料庫已經回退到建立的還原點normal_point了。
guaranteed restore point
建立一個guaranteed restore point:
SYS@orcl 19-OCT-14>create restore point guaranteed_point guarantee flashback database;
Restore point created.
SYS@orcl 19-OCT-14>create restore point guaranteed_point guarantee flashback database;
Restore point created.
檢視檢視v$restore_point:
SYS@orcl 19-OCT-14>select scn,name,guarantee_flashback_database,time from v$restore_point;
SCN NAME GUA TIME
---------- ------------------------------ --- ---------------------------------------------------------------------------
2219342 GUARANTEED_POINT YES 19-OCT-14 06.30.26.000000000 PM
2218982 NORMAL_POINT NO 19-OCT-14 06.14.36.000000000 PM
SCN NAME GUA TIME
---------- ------------------------------ --- ---------------------------------------------------------------------------
2219342 GUARANTEED_POINT YES 19-OCT-14 06.30.26.000000000 PM
2218982 NORMAL_POINT NO 19-OCT-14 06.14.36.000000000 PM
可以看到,建立了一個擔保還原點guaranteed_point。
切換到使用者hh,建立一個測試表t2以模擬誤操作:
SYS@orcl 19-OCT-14>conn hh/hh
Connected.
HH@orcl 19-OCT-14>create table t2 (id int,name char(10));
Table created.
Connected.
HH@orcl 19-OCT-14>create table t2 (id int,name char(10));
Table created.
切換到sys使用者,透過將資料庫回退到還原點guaranteed_point來將資料庫還原到還未建立表t2的時刻:
同上,要將資料庫關閉,重啟到mount:
HH@orcl 19-OCT-14>conn /as sysdba
Connected.
SYS@orcl 19-OCT-14>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl 19-OCT-14>startup mount;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
SYS@orcl 19-OCT-14>flashback database to restore point guaranteed_point;
Flashback complete.
Connected.
SYS@orcl 19-OCT-14>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl 19-OCT-14>startup mount;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
SYS@orcl 19-OCT-14>flashback database to restore point guaranteed_point;
Flashback complete.
切換到hh使用者檢視錶t2是否還存在:
SYS@orcl 19-OCT-14>conn hh/hh
Connected.
HH@orcl 19-OCT-14>select * from t2;
select * from t2
*
ERROR at line 1:
ORA-00942: table or view does not exist
Connected.
HH@orcl 19-OCT-14>select * from t2;
select * from t2
*
ERROR at line 1:
ORA-00942: table or view does not exist
刪除還原點:
SYS@orcl 19-OCT-14>drop restore point normal_point;
Restore point dropped.
SYS@orcl 19-OCT-14>drop restore point guaranteed_point;
Restore point dropped.
Restore point dropped.
SYS@orcl 19-OCT-14>drop restore point guaranteed_point;
Restore point dropped.
非flashback on狀態下建立還原點:
YS@orcl 19-OCT-14>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl 19-OCT-14>startup mount;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
SYS@orcl 19-OCT-14>alter database flashback off;
Database altered.
SYS@orcl 19-OCT-14>alter database open;
Database altered.
SYS@orcl 19-OCT-14>select open_mode,flashback_on from v$database;
OPEN_MODE FLASHBACK_ON
-------------------- ------------------
READ WRITE NO
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcl 19-OCT-14>startup mount;
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 641732176 bytes
Database Buffers 201326592 bytes
Redo Buffers 5132288 bytes
Database mounted.
SYS@orcl 19-OCT-14>alter database flashback off;
Database altered.
SYS@orcl 19-OCT-14>alter database open;
Database altered.
SYS@orcl 19-OCT-14>select open_mode,flashback_on from v$database;
OPEN_MODE FLASHBACK_ON
-------------------- ------------------
READ WRITE NO
建立正常還原點:
建立擔保還原點:
SYS@orcl 19-OCT-14>create restore point guarantee_point guarantee flashback database;
Restore point created.
Restore point created.
SYS@orcl 19-OCT-14>select flashback_on from v$database;
FLASHBACK_ON
------------------
RESTORE POINT ONLY
FLASHBACK_ON
------------------
RESTORE POINT ONLY
可以看到當我們在flashback_on為no的情況下去建立擔保還原點,flashback_on的狀態就會變成restore point noly
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28211342/viewspace-2129317/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Orace Flash Restore Point(閃回還原點)REST
- restore point特色二&閃回資料庫特性(三)REST資料庫
- 【PDB】pdb閃回,Oracle還原點Oracle
- 還原點和閃回資料庫資料庫
- 利用可靠還原點進行資料庫閃回資料庫
- RESTORE POINTREST
- 【備份恢復】閃回資料庫(四)基於可靠還原點閃回資料庫資料庫
- Backup And Recovery User's Guide-使用閃回資料庫和還原點-正常的還原點GUIIDE資料庫
- Backup And Recovery User's Guide-理解閃回資料庫、還原點和保證還原點GUIIDE資料庫
- Backup And Recovery User's Guide-使用閃回資料庫和還原點-閃回資料庫GUIIDE資料庫
- Backup And Recovery User's Guide-使用閃回資料庫和還原點-保證的還原點GUIIDE資料庫
- oracle小知識點3--有保證的復原點guaranteed restore pointOracleREST
- Backup And Recovery User's Guide-使用閃回資料庫和還原點-閃回資料庫的限制GUIIDE資料庫
- Backup And Recovery User's Guide-使用閃回資料庫和還原點-閃回資料庫視窗GUIIDE資料庫
- Backup And Recovery User's Guide-使用閃回資料庫和還原點-保證還原點與儲存快照對比GUIIDE資料庫
- 閃回和drop原 undo tbs的一點分析
- restore point -特色的SCN標誌(一)REST
- Backup And Recovery User's Guide-閃回資料庫日誌和保證的還原點GUIIDE資料庫
- rman 還原歸檔日誌(restore archivelogRESTHive
- rman 還原歸檔日誌(restore archivelog)RESTHive
- Oracle10GR2 中的RESTORE POINTOracleREST
- Backup And Recovery User's Guide-閃回資料庫和保證還原點的先決條件GUIIDE資料庫
- Backup And Recovery User's Guide-具有保證還原點定義的閃回資料庫日誌GUIIDE資料庫
- [20171204]guaranteed restore point.txtREST
- 閃回表、閃回查詢
- Backup And Recovery User's Guide-閃回日誌關閉時的保證的還原點的日誌GUIIDE
- oracle 還原點Oracle
- 閃回(關於閃回查詢)
- 閃回刪除、閃回查詢
- 閃回技術二:閃回表
- 【閃回特性之閃回查詢】使用閃回查詢(select as of)
- 閃回(關於閃回資料庫)資料庫
- 基本閃回查詢和閃回表
- 閃回技術一:閃回查詢
- [20160820]11g Restore Point EnhancementsREST
- How to Create or Remove Restore Point on Standby database (文件 ID 1672977.1)REMRESTDatabase
- DM7閃回與閃回查詢
- 閃回查詢之閃回版本查詢