oracle11gr2_rac_删除节点最佳实践

来源:互联网 发布:linux查看登录失败日志 编辑:程序博客网 时间:2024/05/29 12:29
oracle11gr2_rac_删除节点最佳实践 

分类: Linux

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: <CRS 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!
原创粉丝点击