1.環境描述
OS:AIX6.1
Oracle :11.2.0.3.0 RAC
2.事故發生
資料庫NODE 2所在小型機發生宕機事故,本應正常切換至NODE1,但切換失敗,重啟系統得以解決。
3.事故分析
事故第二天進行了資料庫的alert log分析,從日誌中可以看到資料庫在執行個體NODE2發生宕機後,RAC已經做出了執行個體切換步驟,但在切換的過程中遭遇了ORA-00240、ORA-29770錯誤,導致當時資料庫沒有切換成功。下面是日誌的詳細分析。
資料庫在當時經曆了大致以下幾個重要步驟:
1. Beginning instance recovery of 1 threads
資料庫開始在本地恢複宕機的執行個體
2. Started redo application at
Thread 2: logseq 4556, block 368380
資料庫開始從線上redo日誌序號為4556的日誌恢複
3. Completed instance recovery at
Thread 2: logseq 4556, block 376983, scn 3502123313
資料庫redo日誌4556已經恢複成功。
4. Redo thread 2 internally disabled at seq 4557 (SMON)
當資料庫準備恢複4557的日誌時,遭遇失敗。
5 ORA-00240: control file enqueue held for more than 120 seconds
日誌中開始出現ora-00240錯誤,提示控制檔案被持有超過120秒。
6 ORA-29770: global enqueue process DIA0 (OSID 12517556) is hung for more than 300 seconds
Incident details in:
緊接著出現ora29770錯誤,資料庫進程DIA0 hung住超過5分鐘。
在當天執行個體宕機的20分鐘左右時間內,當時系統的監控等指令碼均無法執行,分析Oracle awr報告得知在當天宕機的時間內,未宕機的NODE1系統CPU資源幾乎耗盡。
經過分析與推測,DIA0進程的主要作用是處理資料庫死結、hung住的一個進程,日誌中的現象應該是這個進程發現控制檔案被持有超過120秒,屬於錯誤行為,進程開始處理這一問題,但當時系統cpu資源耗盡,進程DIA0解決故障超過5分鐘,導致出現了ora-29770錯誤。
所以認定這次執行個體切換失敗的主要原因在於ORA-00240錯誤。根據日誌中給出的trace檔案,查看trace檔案中的具體報錯原因。
從trace日誌中分析得知,當時控制檔案被持有超過120秒的主要原因是KSV master wait等待,KSV master wait耗費了2分03秒。
4.事故分析結論
根據以上現象及日誌體現,從oracle官方metalink中尋找資料得知這是一個bug [BUG ID 1308282.1]
下面是官方metalink文檔中關於這個bug的解釋:
High 'ksv master wait' And 'ASM File Metadata Operation' Waits In Non-Exadata 11g
Symptoms
High waits for 'ksv master wait' while doing an ASM file metadata operation were reported when a data migration utility was running. This wait was also seen for a drop of a tablespace.
The AWR showed the top events were CPU (> 100%), with 'ASM file metadata operation' (7%).
Cause
Event 'KSV master wait' indicates the process on the RDBMS side is waiting for a reply from a process on the ASM side. In 11g, the parameter cell_offload_processing is set to TRUE. Although that is a parameter is not applicable for non-Exadata databases, it caused ASM to try to deliver smart-scan results. The issue was reported in Bug 11800170 - ASM IN KSV WAIT AFTER APPLICATION OF 11.2.0.2 GRID PSU.
After applying the workaround for this issue (see Solution below), a drop of a tablespace that used to take 13 minutes took 4 seconds.
Solution
The following solutions are available for non-Exadata databases:
For the quickest solution, use the workaround. The workaround does not negatively impact non-Exadata databases. This parameter is to be set on the database instance.
alter system set cell_offload_processing = false;
Upgrade to 12.1, when available. OR
Apply the 11.2.0.3 patch set OR
Apply one-off Patch 11800170, if available for your RDBMS and Grid Homes
Note: At the time this note was written (March 2011), neither 12.1 nor 11.2.0.3 were available.
官方文檔中給出的最快解決方式是修改oracle中的一個參數cell_offload_processing,修改為false。