2023年8月17日 星期四

grant 產生 ORA-4021 錯誤案例

Oracle 版本: 12.1.0.2.0 , RAC

OS 版本: AIX 5.3


問題描述:

於針對 gv_$ 開頭的 view 授予權限時, session 會 hang 住,最終出現 ORA-04021 timeout occurred while waiting to lock object ,無法 grant 成功 。

SQL> grant select on gv_$instance to scott;

                 *

ERROR at line 1:

ORA-04021: timeout occurred while waiting to lock object

(此命令 hang 住,最終出現 ORA-04021 的 timeout 錯誤)


問題分析:

針對 grant select on gv_$instance to scott 語法進行 hanganalyze 與 systemstate dump 分析:

SQL> oradebug setospid 515;

SQL> oradebug hanganalyze 3;

SQL> oradebug dump systemstate 266;

SQL> oradebug hanganalyze 3;


由 trace 顯示此 grant session 遭遇到 library cache lock 的等待,並且被 sid 為 344 的 session 阻塞 :


同樣的方法 trace sid 為 344 的 session ,此 session 正在進行 virtual circuit next request 的等待 :


virtual circuit next request 是一個 idle 的等待事件,當資料庫有設定 EM Express ,使用者經由網頁開啟並登入,此時資料庫會進行如下操作來撈取相關資訊顯示在 EM Express 上 :

begin

:rept := dbms_report.get_report(:report_ref, :content, :comp); 

end;


若使用者沒有登出 Web 頁面, EM Express 的 session 就會出現 virtual circuit next request 這個 idle 的等待事件。由於此時 EM Express 尚未釋放相關的 LibraryHandle ,造成其它 session 對於 gv$instance 的操作產生了 library cache lock ,一直沒有等到 lock 釋放而出現了 ORA-04021 的錯誤。


解決方法:

將登入進 EM Express 的使用者 session kill ,或者是由 EM Express 的網頁進行登出的動作,再重新進行 grant 操作便可成功。


2023年7月17日 星期一

CRS-2675 無法停止 vip 案例

Oracle 版本: 11.2.0.4 , RAC

OS 版本: Linux 5.7


問題描述:

停止 vip 服務時出現 CRS 錯誤, vip 無法停止。

# cd /opt/app/11.2.0/grid/bin

# ./srvctl stop vip –i tacp1 –f

PRCR-1065 : Failed to stop resource ora.tacp1.vip

CRS-2645: Stop of 'ora.tacp1.vip' on 'tac1' failed


問題分析:

檢查 orarootagent_root.log ,在停止 vip 服務當下產生了錯誤如下 :

CRS-5007: Cannot remove the primary IP 192.168.49.111 from the network interface


Oracle Cluster 的 vip 是在服務啟動後才將 vip 綁定在網卡上,停止 vip 服務時會將此 vip 從網卡上移除。


從 orarootagent_root.log 顯示的錯誤訊息表示停止 vip 服務的當下,此 vip 無法從網卡上移除,原因是此 vip 為網卡上主要的 IP 。


檢查網卡與 IP 的設定,正常情況 vip 所綁定的網卡會以 <網卡>:n 來表示, eth1 所綁定的 vip 網卡名稱為 eth1:1 ,但是 192.168.49.111 卻綁定在實體網卡 eth2 上 :


所以這個問題是 vip 本身設定錯誤的問題,誤將 vip 設定成網卡上的實體 IP 了。


解決方法:

將網卡 eth2 disable 之後,調整實體 IP 與 vip 的設定,將兩者設定為不同 IP ,重啟服務後回復正常。


2023年6月30日 星期五

ORA-16532: Oracle Data Guard broker configuration does not exist

Oracle 版本: 12.1.0.2

OS 版本: Linux 7.5


問題描述:

Primary 為 RAC 架構, Standby 端為 Single Instance ,使用 Data Guard Broker ,設定完 Data Guard Broker 後 show configuration 出現以下告警 :

DGMGRL>  show configuration


Configuration – ORCL_DG

  Protection Mode: MaxPerformance

  Members:

  ORLC_P - Primary database

    Warning: ORA-16532: Oracle Data Guard broker configuration does not exist 

    ORCL_S - Physical standby database


Fast-Start Failover:  Disabled


Configuration Status:

ERROR   (status updated 40 seconds ago)


問題分析:

ORA-16532: Oracle Data Guard broker configuration does not exist 這個訊息大多與 Data Guard Broker 的設定檔有關,也就是參數 dg_broker_config_file1 與 dg_broker_config_file2 所設定的 .dat 檔,這個檔案預設會設定在 $ORACLE_HOME/dbs 底下,在 RAC 架構下,必須要把此檔案設定在所有節點可共享的位置,例如 ASM ,否則就有可能會出現 DG Broker 找不到設定檔的訊息。


解決方法:

將參數 dg_broker_config_file1 與 dg_broker_config_file2 重新設定在 ASM ,並重新 disable configuration 與 enable configuration 之後此告警訊息消失。

SQL> alter system set dg_broker_config_file1='+DATAC1/ORCL/dr1ORCL.dat';

SQL> alter system set dg_broker_config_file2='+DATAC1/ORCL/dr2ORCL.dat';


DGMGRL> disable configuration;

DGMGRL> enable configuration;