RAC 攻擊 - Oracle 叢集資料庫在家/服務故障轉移
外觀
- 以 **oracle** 使用者登入到 **collabn1**。建立新的服務 **svctest**,將 RAC1 作為首選例項,將 RAC2 作為可用例項。這意味著它通常將在 RAC1 例項上執行,但如果 RAC1 變得不可用,則會故障轉移到 RAC2 例項。collabn1:/home/oracle[RAC1]$ srvctl add service -d RAC -s svctest -r RAC1 -a RAC2 -P BASIC collabn1:/home/oracle[RAC1]$ srvctl start service -d RAC -s svctest
- 檢查兩個節點上的 **lsnrctl** 並檢視兩個節點上的 **SERVICE_NAMES** 初始化引數,檢查服務在哪裡執行。
您永遠不應該直接更改 RAC 資料庫上的 SERVICE_NAMES 初始化引數!此引數由叢集軟體自動維護。collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest Service svctest is running on instance(s) RAC1 collabn1:/home/oracle[RAC1]$ lsnrctl services Service "svctest.vm.ardentperf.com" has 1 instance(s). Instance "RAC1", status READY, has 2 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready REMOTE SERVER (ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.vm.ardentperf.com)(PORT=1521)) "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER collabn1:/home/oracle[RAC1]$ ssh collabn2 Last login: Sun Aug 3 13:13:16 2008 from collabn1 The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle Set environment by typing 'oenv' - default is instance RAC1. collabn2:/home/oracle[RAC2]$ lsnrctl services collabn2:/home/oracle[RAC2]$ lsnrctl services Service "svctest.vm.ardentperf.com" has 1 instance(s). Instance "RAC1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready REMOTE SERVER (ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.vm.ardentperf.com)(PORT=1521)) SQL> col value format a60 SQL> select inst_id, value from gv$parameter where NAME='service_names'; INST_ID VALUE ---------- ------------------------------------------------------------ 1 svctest, RAC.vm.ardentperf.com 2 RAC.vm.ardentperf.com
- 使用 SHUTDOWN ABORT 殺死執行服務 **svctest** 的例項。SQL> show user USER is "SYS" SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- RAC1 SQL> shutdown abort; ORACLE instance shut down. SQL>
- 等待片刻,然後重複步驟 2。發生了什麼?collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest
- 重啟您殺死的例項。
這不會啟動任何例項恢復。你知道為什麼嗎?collabn1:/home/oracle[RAC1]$ srvctl status database -d RAC Instance RAC1 is not running on node collabn1 Instance RAC2 is running on node collabn2 collabn1:/home/oracle[RAC1]$ srvctl start instance -d RAC -i RAC1 collabn1:/home/oracle[RAC1]$ srvctl status database -d RAC Instance RAC1 is running on node collabn1 Instance RAC2 is running on node collabn2 collabn1:/home/oracle[RAC1]$
- 重複步驟 2。服務現在在哪裡執行?collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest
- 手動將服務故障轉移。確認它現在在哪裡執行。請注意,這不會斷開任何當前會話collabn1:/home/oracle[RAC1]$ srvctl relocate service -d RAC -s svctest -i RAC2 -t RAC1 collabn1:/home/oracle[RAC1]$ srvctl status service -d RAC -s svctest