【OCP最新題庫解析(052)–題37】Which two are true about the Fast
- 2019 年 10 月 10 日
- 筆記
Q
題目
Which two are true about the Fast Recovery Area (FRA)?
A. It should be larger than the database.
B. Only consistent backups can be stored in the FRA.
C. Space management in the FRA is influenced by the database backup retention policy.
D. It must reside on the same file system as the database data files.
E. A database must be in ARCHIVELOG mode to user the FRA.
A
答案
Answer:AC
對於B選項,歸檔文件也可以放在FRA中。
對於D選項,不一定是相同的FS。
對於E選項,FRA的使用和是否歸檔沒有關係。
An optional disk location that you can use to store recovery-related files such as control file and online redo log copies, archived redo log files, flashback logs, and RMAN backups. Oracle Database and RMAN manage the files in the fast recovery area automatically. You can specify the disk quota, which is the maximum size of the fast recovery area. Formerly referred to as flash recovery area.
閃回恢復區(Fast Recovery Area,FRA)是一塊可選的磁碟位置,可以用來存儲與恢復相關的文件,例如控制文件和聯機重做日誌副本、歸檔重做日誌文件、閃回日誌和RMAN備份。Oracle資料庫和RMAN自動管理快速恢復區域中的文件。可以指定磁碟配額(由參數DB_RECOVERY_FILE_DEST_SIZE決定),這是FRA區域的最大大小。Fast Recovery Area之前稱為Flash Recovery Area,也可稱為快速恢復區。
註:快速恢復區的英文名稱已從flash recovery area改為fast recovery area,但當前的某些英文版Oracle產品可能仍在使用flash recovery area。
1. 創建快速恢復區
使用快速恢復區需要設置兩個初始化參數,DB_RECOVERY_FILE_DEST和DB_RECOVERY_FILE_DEST_SIZE。
第一個參數指定了快速恢復區的位置,這個位置可以指向磁碟,也可以指向ASM磁碟組;
第二個參數定義了快速恢復區的大小。
在RAC環境下配置快速恢復區時,要保證每個節點的配置值都相同。
這兩個參數可以在資料庫運行過程中在線修改,修改後立即就能生效,比如以下例子:
SQL> alter system set db_recovery_file_dest_size='2G' scope=both sid='*';
System altered.
SQL> alter system set db_recovery_file_dest='+fra' scope=both sid='*';
System altered.
SQL>
注意1:如果使用ASM作為Fast Recovery Area時,只能指定到Diskgroup級別,而不能成某個目錄。比如下面這個例子演示了這個錯誤:
SQL> alter system set db_recovery_file_dest='+fra/test' scope=both sid='*';
alter system set db_recovery_file_dest='+fra/test' scope=both sid='*'
*
ERROR at line 1:
ORA-02097: 無法修改參數, 因為指定的值無效
ORA-01261: 無法轉換參數 db_recovery_file_dest 的目標字元串
注意2:在配置Fast Recovery Area時,需要先設置參數DB_RECOVERY_FILE_DEST_SIZE,然後再設置參數DB_RECOVERY_FILE_DEST,否則會報錯,如下:
SQL> alter system set db_recovery_file_dest='+fra' scope=both sid='*';
alter system set db_recovery_file_dest='+fra' scope=both sid='*'
*
ERROR at line 1:
ORA-02097: 無法修改參數, 因為指定的值無效
ORA-19802: 無法使用 DB_RECOVERY_FILE_DEST, 由於缺少 DB_RECOVERY_FILE_DEST_SIZE
2. 快速恢復區的監控
配置快速恢復區時,需要定義區域空間大小,也就是必須配置參數DB_RECOVERY_FILE_DEST_SIZE。這個參數值確定了快速恢復區能使用的存儲空間上限。
如果定義了備份保留策略,Oracle會根據策略判斷哪些文件過期(obsolete)進而刪除,但只有在定義了備份保留策略時,Oracle才會自動判斷和刪除。當快速恢復區空間使用率達到90%時,會觸發自動刪除。刪除過程會在alert文件中記錄日誌,但是如果沒有空間可以釋放,並且使用空間超過85%,就會記錄一個warning日誌;如果超過了97%,會記錄一條critical warning日誌,這些日誌內容可以從dba_outstanding_alerts視圖中看到。
因此日常工作中需要監控快速恢復區的使用情況,在需要時及時進行調整。可以通過視圖V$RECOVERY_FILE_DEST和V$RECOVERY_AREA_USAGE來監控快速恢復區的使用情況。
V$RECOVERY_FILE_DEST displays information about the disk quota and current disk usage in the fast recovery area.
V$RECOVERY_AREA_USAGE displays usage information about recovery areas.
col name format a32 heading 'file name'
col spc_lmt_mb format 9999.99 heading 'space|limit|(mb)'
col spc_usd_mb format 9999.99 heading 'space|used|(mb)'
col spc_rcl_mb format 9999.99 heading 'space|reclaim|(mb)'
col number_of_files format 99999 heading 'files'
select name,space_limit/(1024*1024) spc_lmt_mb,space_used/(1024*1024) spc_usd_mb,space_reclaimable/(1024*1024) spc_rcl_mb,
number_of_files
from v$recovery_file_dest;–匯總
select * from v$recovery_area_usage;–明細