ORACLE RAC環境下刪除節點

dayong2015發表於2014-09-25
環境配置:
OS版本:Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)
DB版本:Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
由於節點rac2的磁碟損壞了,RAC叢集資料庫也就成了單例項的資料庫,我決定刪除損壞的節點,增加新的可用節點。
刪除節點
1.停掉刪除節點(rac2)的資料庫例項(HHPEN12)、ASM例項(+ASM2)和一些後臺程式服務
[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
----------------------------------------------------------------------
ora....11.inst application    0/5    0/0    ONLINE    ONLINE    rac1
ora....12.inst application    0/5    0/0    ONLINE    OFFLINE
ora....N11.srv application    0/0    0/0    ONLINE    ONLINE    rac1
ora...._TAF.cs application    0/0    0/1    ONLINE    ONLINE    rac1
ora.HHPEN1.db  application    0/0    0/1    ONLINE    ONLINE    rac1
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora....SM2.asm application    0/5    0/0    ONLINE    OFFLINE
ora....C2.lsnr application    0/5    0/0    ONLINE    OFFLINE
ora.rac2.gsd   application    0/5    0/0    ONLINE    OFFLINE
ora.rac2.ons   application    0/3    0/0    ONLINE    OFFLINE
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
2.修改spfile檔案相關引數
[oracle@rac1 ~]export ORACLE_SID=HHPEN11    
[oracle@rac1 ~]$ sqlplus / as sysdba        
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Sep 25 14:25:03 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +RAC_GROUP/hhpen1/spfilehhpen1 .ora
SQL> col name for a35;
SQL> col value for a35;
SQL> select name,value from v$spparameter where sid='HHPEN12';

NAME                                VALUE
----------------------------------- -----------------------------------
log_archive_dest_1                  location=/u01/app/rac2_arch
log_archive_dest_2                  service=HHPEN11
thread                              2
instance_number                     2
undo_tablespace                     UNDOTBS2
SQL> alter system reset thread scope=spfile sid='HHPEN12';
System altered.
SQL> alter system reset instance_number scope=spfile sid='HHPEN12';
System altered.
SQL> alter system reset undo_tablespace scope=spfile sid='HHPEN12';
System altered.
SQL> select sid,name,value from v$spparameter where name='cluster_database_instances';

SID             NAME                                VALUE
--------------- ----------------------------------- ----------
*               cluster_database_instances          2
3.刪除目標節點(rac2)的監聽服務
可以透過netca 刪除目標節點中的監聽服務,在rac1上執行netca,刪除監聽
4.刪除目標節點(rac2)資料庫軟體
在保留的任意一個結點上執行操作,更新Oracle Inventory,例如,在rac1上執行

5.刪除ONS配置
在任意保留節點(此處也就剩下節點rac1)中執行racgons 命令,刪除ONS 配置,操作如下:

批註:要查詢目標節點的ONS 埠號,可以透過下列命令
[oracle@rac1 ~]$ more /u01/app/oracle/crs/opmn/conf/ons.config
localport=6113
remoteport=6200
loglevel=3
useocr=on
6.刪除NODEAPPS
目標節點中包括GSD、ONS、VIP 等應用此時已經可以被刪除了,刪除這些應用可以透過srvctl 命令,注意要以root 身份執行,操作如下:
[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
----------------------------------------------------------------------
ora....11.inst application    0/5    0/0    ONLINE    ONLINE    rac1
ora....12.inst application    0/5    0/0    ONLINE    OFFLINE
ora....N11.srv application    0/0    0/0    OFFLINE   OFFLINE
ora...._TAF.cs application    0/0    0/1    OFFLINE   OFFLINE
ora.HHPEN1.db  application    0/0    0/1    ONLINE    ONLINE    rac1
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora....SM2.asm application    0/5    0/0    ONLINE    OFFLINE
ora.rac2.gsd   application    0/5    0/0    ONLINE    OFFLINE
ora.rac2.ons   application    0/3    0/0    ONLINE    OFFLINE
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
[oracle@rac1 ~]$ crs_stop -f ora.rac2.vip
Attempting to stop `ora.rac2.vip` on member `rac1`
Stop of `ora.rac2.vip` on member `rac1` succeeded.

7.刪除目標節點clusterware軟體
接下來要做的是刪除目標節點上的clusterware 軟體,本步操作與刪除資料庫軟體類似,首先仍是在任意保留的節點中操作,在rac1上執行:

8.從OCR中刪除目標節點資訊
在任意一臺保留的節點執行,在rac1上執行:
[oracle@rac1 ~]$ cd $CRS_HOME/bin
[oracle@rac1 bin]$ olsnodes -n -i
rac1    1       rac1-vip
rac2    2      
儘管透過前面的操作,ORACLE 軟體以及叢集件均已被刪除,節點資訊也更新過了,不過OCR 中還是保留有rac2節點的資訊,因此這塊也需要刪除,執行
指令碼如下:

[oracle@rac1 ~]$ olsnodes -n -i
rac1    1       rac1-vip
9.刪除目標節點資料庫例項和ASM例項
[oracle@rac1 ~]$ srvctl status database -d HHPEN1
Instance HHPEN11 is running on node rac1
Instance HHPEN12 is not running on node rac2
[oracle@rac1 ~]$ srvctl remove instance -d HHPEN1 -i HHPEN12
Remove instance HHPEN12 from the database HHPEN1? (y/[n]) y
[oracle@rac1 ~]$ crs_stop -f ora.rac2.ASM2.asm
Target set to OFFLINE for `ora.rac2.ASM2.asm`
[oracle@rac1 ~]$ srvctl remove asm -n rac2
PRKC-1056 : Failed to get the hostname for node rac2          --由於另一個系統我已經清除,所以此處找不到目標主機
PRKH-1001 : HASContext Internal Error
  [OCR Error(Native: getHostName:[21])]
[oracle@rac1 ~]$ crs_unregister ora.rac2.ASM2.asm      --使用crs_unregister登出掉該資源

批註:至此節點rac2刪除完成。

新增節點可以參考我之前總結的這篇文章:http://blog.itpub.net/29634949/viewspace-1163338/

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29634949/viewspace-1280640/,如需轉載,請註明出處,否則將追究法律責任。

相關文章