oracle11gr2_rac_刪除節點最佳實踐

YallonKing發表於2012-08-29
oracle 11gr2 刪除節點最佳實踐
oracle 11gr2 新增節點最佳實踐可參見我的博文:
http://space.itpub.net/26143577/viewspace-742169
OS資訊:
[grid@11grac1 ~]$ uname -a
Linux 11grac1 2.6.32-300.10.1.el5uek #1 SMP Wed Feb 22 17:22:40 EST 2012 i686 i686 i386 GNU/Linux
DB資訊:
SQL> select * from v$version where rownum<5;
BANNER
------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
檢視當前資源狀態
[grid@11grac1 ~]$ crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    11grac1    
ora....C1.lsnr application    ONLINE    ONLINE    11grac1    
ora....ac1.gsd application    ONLINE    ONLINE    11grac1    
ora....ac1.ons application    ONLINE    ONLINE    11grac1    
ora....ac1.vip ora....t1.type ONLINE    ONLINE    11grac1    
ora....SM2.asm application    ONLINE    ONLINE    11grac2    
ora....C2.lsnr application    ONLINE    ONLINE    11grac2    
ora....ac2.gsd application    ONLINE    ONLINE    11grac2    
ora....ac2.ons application    ONLINE    ONLINE    11grac2    
ora....ac2.vip ora....t1.type ONLINE    ONLINE    11grac2    
ora.DATA.dg    ora....up.type ONLINE    ONLINE    11grac1    
ora....ER.lsnr ora....er.type ONLINE    ONLINE    11grac1    
ora....N1.lsnr ora....er.type ONLINE    ONLINE    11grac1    
ora.asm        ora.asm.type   ONLINE    ONLINE    11grac1    
ora.eons       ora.eons.type  ONLINE    ONLINE    11grac1    
ora.gsd        ora.gsd.type   ONLINE    ONLINE    11grac1    
ora....network ora....rk.type ONLINE    ONLINE    11grac1    
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    11grac1    
ora.ons        ora.ons.type   ONLINE    ONLINE    11grac1    
ora.racdb.db   ora....se.type ONLINE    ONLINE    11grac1    
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    11grac1    
[grid@11grac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node 11grac1
Instance racdb2 is running on node 11grac2
寫入測試資料
[oracle@11grac1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 29 10:02:08 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> sho user
USER is "SYS"
SQL> create table test (id number,name varchar2(10));
Table created.
SQL> insert into test values (1,'yallonking');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
        ID NAME
---------- ----------
         1 yallonking
  
刪除節點例項(可用DBCA,也可用後邊的命令靜默刪除)
執行dbca,根據嚮導刪除相關資訊
instance management-> delete an instance-> 輸入sysdba使用者的賬戶和密碼-> 選定刪除的節點例項
[oracle@11grac1 ~]$ export DISPLAY=192.168.137.1:0.0
[oracle@11grac1 ~]$ dbca
檢視資料庫狀態
[grid@11grac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node 11grac1
[grid@11grac1 ~]$ crsctl check cluster -all
**************************************************************
11grac1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
11grac2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
[grid@11grac1 ~]$
刪除EM
[oracle@11grac1 ~]$ emca -deconfig dbcontrol db -repos drop -cluster
STARTED EMCA at Aug 29, 2012 10:29:12 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
Enter the following information:
Database unique name: racdb
Service name: racdb
Listener port number: 1521
Listener ORACLE_HOME [ /u01/11.2.0/grid ]:
Password for SYS user: 
Password for SYSMAN user: 
Do you wish to continue? [yes(Y)/no(N)]: y
Aug 29, 2012 10:29:35 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/racdb/emca_2012_08_29_10_29_11.log.
Aug 29, 2012 10:29:36 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed.
Aug 29, 2012 10:29:45 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: Error initializing SQL connection. SQL operations cannot be performed
Aug 29, 2012 10:29:45 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Aug 29, 2012 10:43:38 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Aug 29, 2012 10:43:38 AM
[oracle@11grac1 ~]$
備份OCR
[root@11grac1 ~]# /u01/11.2.0/grid/bin/ocrconfig -manualbackup
11grac1     2012/08/29 10:47:33     /u01/11.2.0/grid/cdata/racscan/backup_20120829_104733.ocr
[root@11grac1 ~]#
刪除例項(靜默狀態下)
[oracle@11grac1 ~]$ dbca -silent -deleteinstance -nodelist 11grac2 -gdbname racdb -instancename racdb2 -sysdbausername sys -sysdbapassword oracle
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/racdb.log" for further details.
檢視資料庫配置資訊
[oracle@11grac1 ~]$ srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA/racdb/spfileracdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb1
Disk Groups: DATA
Services:
Database is administrator managed
檢視資料庫例項和redo情況
[oracle@11grac1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 29 10:51:31 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> select inst_id,instance_name from gv$instance;
   INST_ID INSTANCE_NAME
---------- ----------------
         1 racdb1
SQL> select group#,thread# from v$log;
    GROUP#    THREAD#
---------- ----------
         1          1
         2          1
  
檢視節點監聽配置資訊
[oracle@11grac2 ~]$ srvctl config listener -a
Name: LISTENER
Network: 1, Owner: grid
Home:
  /u01/11.2.0/grid on node(s) 11grac2,11grac1
End points: TCP:1521
更新oracle inventory
[oracle@11grac2 db_1]$ /u01/app/oracle/product/11.2.0/db_1/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={11grac2}" -local
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB.   Actual 4094 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.
刪除oracle軟體
[oracle@11grac2 db_1]$ cd $ORACLE_HOME/deinstall
[oracle@11grac2 deinstall]$ ./deinstall -local
Checking for required files and bootstrapping ...
Please wait ...

更新oracle inventory
[oracle@11grac1 ~]$ $ORACLE_HOME/oui/bin/runInstaller -updatenodelist ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={11grac1}"
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB.   Actual 3854 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.

檢視節點狀態
[root@11grac1 ~]# /u01/11.2.0/grid/bin/olsnodes -s -t
11grac1 Active  Unpinned
11grac2 Active  Unpinned
禁用節點cluster
[root@11grac2 ~]# cd /u01/11.2.0/grid/crs/install/
[root@11grac2 install]# ./rootcrs.pl -deconfig -force
2012-08-29 11:06:54: Parsing the host name
2012-08-29 11:06:54: Checking for super user privileges
2012-08-29 11:06:54: User has super user privileges
Using configuration parameter file: ./crsconfig_params
VIP exists.:11grac1
VIP exists.: /11grac1-vip/192.168.137.163/255.255.255.0/eth0
VIP exists.:11grac2
VIP exists.: /11grac2-vip/192.168.137.164/255.255.255.0/eth0
GSD exists.
ONS daemon exists. Local port 6100, remote port 6200
eONS daemon exists. Multicast port 18611, multicast IP address 234.228.184.247, listening port 2016
ADVM/ACFS is not supported on oraclelinux-release-5-8.0.2
ACFS-9201: Not Supported
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on '11grac2'
CRS-2673: Attempting to stop 'ora.crsd' on '11grac2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on '11grac2'
CRS-2673: Attempting to stop 'ora.DATA.dg' on '11grac2'
CRS-2677: Stop of 'ora.DATA.dg' on '11grac2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on '11grac2'
CRS-2677: Stop of 'ora.asm' on '11grac2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on '11grac2' has completed
CRS-2677: Stop of 'ora.crsd' on '11grac2' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on '11grac2'
CRS-2673: Attempting to stop 'ora.gpnpd' on '11grac2'
CRS-2673: Attempting to stop 'ora.cssdmonitor' on '11grac2'
CRS-2673: Attempting to stop 'ora.ctssd' on '11grac2'
CRS-2673: Attempting to stop 'ora.evmd' on '11grac2'
CRS-2673: Attempting to stop 'ora.asm' on '11grac2'
CRS-2677: Stop of 'ora.cssdmonitor' on '11grac2' succeeded
CRS-2677: Stop of 'ora.mdnsd' on '11grac2' succeeded
CRS-2677: Stop of 'ora.gpnpd' on '11grac2' succeeded
CRS-2677: Stop of 'ora.evmd' on '11grac2' succeeded
CRS-2677: Stop of 'ora.ctssd' on '11grac2' succeeded
CRS-2675: Stop of 'ora.asm' on '11grac2' failed
CRS-2679: Attempting to clean 'ora.asm' on '11grac2'
ORA-01089: immediate shutdown in progress - no operations are permitted
Process ID: 0
Session ID: 0 Serial number: 0
CRS-2681: Clean of 'ora.asm' on '11grac2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on '11grac2'
CRS-2677: Stop of 'ora.cssd' on '11grac2' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on '11grac2'
CRS-2673: Attempting to stop 'ora.gipcd' on '11grac2'
CRS-2677: Stop of 'ora.gipcd' on '11grac2' succeeded
CRS-2677: Stop of 'ora.diskmon' on '11grac2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on '11grac2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle clusterware stack on this node
[root@11grac2 install]#

檢視節點狀態
[grid@11grac1 ~]$ olsnodes -s -t
11grac1 Active  Unpinned
11grac2 Inactive        Unpinned
刪除節點
[root@11grac1 ~]# /u01/11.2.0/grid/bin/crsctl delete node -n 11grac2
CRS-4661: Node 11grac2 successfully deleted.
檢視節點狀態
[root@11grac1 ~]# /u01/11.2.0/grid/bin/olsnodes -s -t
11grac1 Active  Unpinned
更新oracle inventory
[grid@11grac2 bin]$ pwd
/u01/11.2.0/grid/oui/bin
[grid@11grac2 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={11grac2}" CRS=TRUE -local 
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB.   Actual 4094 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.
刪除GI軟體
[grid@11grac2 deinstall]$ pwd
/u01/11.2.0/grid/deinstall
[grid@11grac2 deinstall]$ ./deinstall -local
Checking for required files and bootstrapping ...
Please wait ...
刪除相關目錄
[root@11grac2 install]# rm -rf /etc/oraInst.loc
[root@11grac2 install]# rm -rf /opt/ORCLfmap/
[root@11grac2 install]# rm -rf /u01
更新oracle inventory
[grid@11grac1 bin]$ pwd
/u01/11.2.0/grid/oui/bin
[grid@11grac1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={11grac1}" CRS=TRUE
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB.   Actual 3826 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.
刪除後的驗證
[grid@11grac1 bin]$ cluvfy stage -post nodedel -n 11grac2 -verbose
Performing post-checks for node removal
Checking CRS integrity...
The Oracle clusterware is healthy on node "11grac1"
CRS integrity check passed
 

Result:
Node removal check passed
Post-check for node removal was successful.
檢視節點資源資訊
[grid@11grac1 ~]$ crsctl check cluster -all
**************************************************************
11grac1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
[grid@11grac1 ~]$ crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    11grac1    
ora....C1.lsnr application    ONLINE    ONLINE    11grac1    
ora....ac1.gsd application    ONLINE    ONLINE    11grac1    
ora....ac1.ons application    ONLINE    ONLINE    11grac1    
ora....ac1.vip ora....t1.type ONLINE    ONLINE    11grac1    
ora.DATA.dg    ora....up.type ONLINE    ONLINE    11grac1    
ora....ER.lsnr ora....er.type ONLINE    ONLINE    11grac1    
ora....N1.lsnr ora....er.type ONLINE    ONLINE    11grac1    
ora.asm        ora.asm.type   ONLINE    ONLINE    11grac1    
ora.eons       ora.eons.type  ONLINE    ONLINE    11grac1    
ora.gsd        ora.gsd.type   ONLINE    ONLINE    11grac1    
ora....network ora....rk.type ONLINE    ONLINE    11grac1    
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    11grac1    
ora.ons        ora.ons.type   ONLINE    ONLINE    11grac1    
ora.racdb.db   ora....se.type ONLINE    ONLINE    11grac1    
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    11grac1    
[grid@11grac1 ~]$

驗證測試資料
Microsoft Windows [版本 6.1.7600]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。
C:\Users\YallonKing>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on 星期三 8月 29 12:29:43 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
SQL> conn sys/oracle@racdb_11g as sysdba
已連線。
SQL> select instance_name from gv$instance;
INSTANCE_NAME
--------------------------------
racdb1
SQL> select * from test;
        ID NAME
---------- --------------------
         1 yallonking
剩下的就是刪除被刪除節點的GI和ORACLE相關檔案、使用者、組、裸裝置、網路設定等資訊。
至此,OK!

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

相關文章