Oracle RAC 删除节点

 图形化参考这个:

Oracle_19c_Rac添加节点-删除节点图形化操作.docx - 墨天轮文档 (modb.pro)

节点删除分为3大阶段
1.删除实例   2.删除数据库软件   3.删除GI


一.删除实例(本次实验是把db1移除节点)
1.我们查看一下集群有几个节点构成的

[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/olsnodes -s -t
db1    Active    Unpinned
db2    Active    Unpinned 

 
2. 集群注册表做备份
[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/ocrconfig -manualbackup
db2     2022/01/29 00:32:16     +OCR:/db-cluster/OCRBACKUP/backup_20220129_003216.ocr.263.1095208337     724960844    
进行刚刚备份检查
[root@db1 ~]# /u01/app/19.0.0.0/grid/bin/ocrconfig -showbackup
 
 
3.删除实例

Oracle用户删除实例(在一个保留的节点上运行)-nodeList(删除实例所在的节点)   -gdbName(表示数据库的名字)  -instanceName(表示要删除的实例名字) -sysDBAUserName(表示超级管理员)  -sysDBAPassword(管理员密码)
[oracle@db2 ~]$ dbca -silent -deleteInstance -nodeList db1 -gdbName qujz -instanceName qujz1 -sysDBAUserName sys -sysDBAPassword oracle
[WARNING] [DBT-19203] The Database Configuration Assistant will delete the Oracle instance and its associated OFA directory structure. All information about this instance will be deleted.
 
 图形化吧


Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/qujz/qujz.log" for further details.
----删除成功

检查下实例是否删除成功

[oracle@db2 ~]$ srvctl config database -d qujz
Database unique name: qujz
Database name: qujz
Oracle home: /u01/app/oracle/product/19.0.0.0
Oracle user: oracle
Spfile: +DATA/QUJZ/PARAMETERFILE/spfile.273.1094873733
Password file: +DATA/QUJZ/PASSWORD/pwdqujz.256.1094872611
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: 
Disk Groups: DATA
Mount point paths: 
Services: 
Type: RAC
Start concurrency: 
Stop concurrency: 
OSDBA group: dba
OSOPER group: 
Database instances: qujz2      ----qujz1已经消失了
Configured nodes: db2          ----db1已经消失了 
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services: 
Database is administrator managed
----qujz这个实例在db1上已经消失

二.删除数据库软件
1.更新inventory(在被删除的节点上运行)

[oracle@db1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db1" -local    

被删除的节点执行!  
su - oracle
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1 "CLUSTER_NODES={rac3}" 

-------执行,更新Inventory   db1是要被删除的节点
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 6771 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
2.卸载ORACLE HOME(在被删除的节点上运行),就是删除ORACLE DATABASE软件

[oracle@db1 bin]$ $ORACLE_HOME/deinstall/deinstall -local
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/
 
 

3.更新inventory(在被保留的节点上运行)

[oracle@db2 ~]$  cd $ORACLE_HOME/oui/bin
 
[oracle@db2 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db2" -local            


 在保留任一节点执行命令 是剩下保留的节点名称
su - oracle
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/19c/db_1 "CLUSTER_NODES={rac1,rac2}"

-----------如果有多个节点填入剩下的节点 

三.删除GI(要删除的节点上grid用户执行)
1.查看节点状态

[grid@db1 ~]$ olsnodes -s -t
db1    Active    Unpinned      ----查看还是有2个节点组成
db2    Active    Unpinned
2.进行节点删除(root用户)

禁用和停止所有正在运行的群集资源
[root@db1 ~]# cd /u01/app/19.0.0.0/grid/crs/install/
[root@db1 install]# ./rootcrs.sh -deconfig -force
-lastnode 如果是想删除所有的节点 ,则加上选项lastnode,加上选项lastnode很危险,因为它会导致清除OCR 和voting disks的数据)
-force表示强迫停止VIP资源


[root@db1 install]# ./rootcrs.sh -deconfig -force
Using configuration parameter file: /u01/app/19.0.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/db1/crsconfig/crsdeconfig_db1_2022-01-29_00-59-15AM.log
2022/01/29 01:00:36 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.
2022/01/29 01:02:35 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.
2022/01/29 01:02:35 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node
3.更新inventory(在要被删除的节点上)

[grid@db1 ~]$  cd $ORACLE_HOME/oui/bin
[grid@db1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db1" CRS=TRUE -silent -local
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 8020 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
 /u01/app/oraInventory/logs/UpdateNodeList2022-01-29_01-04-45AM.log
'UpdateNodeList' was successful.
4.删除Grid Infrastructure home(在要被删除的节点)

这个命令会删除$GRID_HOME下面所有的东西
[grid@db1 ]$ $ORACLE_HOME/deinstall/deinstall -local
如果不指定–local,会删除整个cluster中的所有的grid home
 
[grid@db1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=db1" CRS=TRUE -silent -local
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 8020 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
 /u01/app/oraInventory/logs/UpdateNodeList2022-01-29_01-04-45AM.log
'UpdateNodeList' was successful.
[grid@db1 bin]$  $ORACLE_HOME/deinstall/deinstall -local
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2022-01-29_01-05-58AM/logs/
 
############ ORACLE DECONFIG TOOL START ############
 
 
######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##
 
 
Checking for existence of the Oracle home location /u01/app/19.0.0.0/grid
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Standalone Server
Oracle Base selected for deinstall is: /u01/app/grid
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home 
 
## [END] Install check configuration ##
 
Traces log file: /tmp/deinstall2022-01-29_01-05-58AM/logs//crsdc_2022-01-29_01-06-15-AM.log
 
Network Configuration check config START
 
Network de-configuration trace file location: /tmp/deinstall2022-01-29_01-05-58AM/logs/netdc_check2022-01-29_01-06-15AM.log
 
Specify all Oracle Restart enabled listeners that are to be de-configured. Enter .(dot) to deselect all. [ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN1]:              -------直接回车
Network Configuration check config END
 
Asm Check Configuration START
 
ASM de-configuration trace file location: /tmp/deinstall2022-01-29_01-05-58AM/logs/asmcadc_check2022-01-29_01-06-15AM.log
 
ASM configuration was not detected in this Oracle home. Was ASM configured in this Oracle home (y|n) [n]: y   ---选择y
 
####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: 
Oracle Home selected for deinstall is: /u01/app/19.0.0.0/grid
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Following Oracle Restart enabled listener(s) will be de-configured: ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN1
ASM was not detected in the Oracle Home
Do you want to continue (y - yes, n - no)? [n]: y   --选择y 
 
 
 
----------------------删除完成
 
######################### DEINSTALL CLEAN OPERATION END #########################
 
 
####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/19.0.0.0/grid' from the central inventory on the local node.
Failed to delete directory '/u01/app/19.0.0.0/grid' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/19.0.0.0/grid' on local node.
Failed to delete directory '/u01/app/oraInventory' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/oraInventory' on local node.
Oracle Universal Installer cleanup completed with errors.
 
 
Run 'rm -r /etc/oraInst.loc' as root on node(s) 'db1' at the end of the session.
 
Run 'rm -r /opt/ORCLfmap' as root on node(s) 'db1' at the end of the session.
Run 'rm -r /etc/oratab' as root on node(s) 'db1' at the end of the session.
Review the permissions and contents of '/u01/app/grid' on nodes(s) 'db1'.
If there are no Oracle home(s) associated with '/u01/app/grid', manually delete '/u01/app/grid' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
 
 
 
 
 

5.在要删除的节点上执行以下命令kill掉相关进程

ps -ef |grep ora |awk '{print $2}' |xargs kill -9
ps -ef |grep grid |awk '{print $2}' |xargs kill -9
ps -ef |grep asm |awk '{print $2}' |xargs kill -9
ps -ef |grep storage |awk '{print $2}' |xargs kill -9
ps -ef |grep ohasd |awk '{print $2}' |xargs kill -9 
ps -ef |grep grid
ps -ef |grep ora
ps -ef |grep asm
 
-----------------------------------------------------------
[root@db1 install]# ps -ef |grep ora |awk '{print $2}' |xargs kill -9
 
ps -ef |grep grid
ps -ef |grep ora
ps -ef |grep asm
kill: sending signal to 76043 failed: No such process
[root@db1 install]# ps -ef |grep grid |awk '{print $2}' |xargs kill -9
kill: sending signal to 76048 failed: No such process
[root@db1 install]# ps -ef |grep asm |awk '{print $2}' |xargs kill -9
kill: sending signal to 76053 failed: No such process
[root@db1 install]# ps -ef |grep storage |awk '{print $2}' |xargs kill -9
kill: sending signal to 76058 failed: No such process
[root@db1 install]# ps -ef |grep ohasd |awk '{print $2}' |xargs kill -9 
kill: sending signal to 76063 failed: No such process
[root@db1 install]# ps -ef |grep grid
root      76068  45357  0 01:17 pts/0    00:00:00 grep --color=auto grid
[root@db1 install]# ps -ef |grep ora
root      76070  45357  0 01:17 pts/0    00:00:00 grep --color=auto ora
[root@db1 install]# ps -ef |grep asm
root      76072  45357  0 01:17 pts/0    00:00:00 grep --color=auto asm

6.手工删除残留的文件(以root运行)

ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/19.0.0.0/grid/
cd $ORACLE_HOME
rm -rf *
cd $ORACLE_BASE
rm -rf *
 
rm -rf /etc/rc5.d/S96ohasd
rm -rf /etc/rc3.d/S96ohasd
rm -rf /rc.d/init.d/ohasd
rm -rf /etc/oracle
rm -rf /etc/ora*
rm -rf /etc/oratab
rm -rf /etc/oraInst.loc
rm -rf /opt/ORCLfmap/
rm -rf /u01/app/oracle/oraInventory
rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv
rm -rf /usr/local/bin/coraenv
rm -rf /tmp/*
rm -rf /var/tmp/.oracle
rm -rf /var/tmp
rm -rf /home/grid/*
rm -rf /home/oracle/*
rm -rf /etc/init/oracle*
rm -rf /etc/init.d/ora
rm -rf /tmp/.*

7.移除db1

在保留的任意一个节点上执行下面的步骤
从clusterware中移除节点db1
[root@db2 ~]# crsctl delete node -n db1
CRS-4661: Node db1 successfully deleted.
8.进行检查

[grid@db2 ~]$ cluvfy stage -post nodedel -n db1 -verbose
 
Verifying Node Removal ...
  Verifying CRS Integrity ...PASSED
  Verifying Clusterware Version Consistency ...PASSED
Verifying Node Removal ...PASSED
 
Post-check for node removal was successful.  ---节点删除后检查成功
 
CVU operation performed:      stage -post nodedel
Date:                         Jan 29, 2022 1:49:45 AM
CVU home:                     /u01/app/19.0.0.0/grid/
User:                         grid
 
 
[grid@db2 ~]$ olsnodes -s -t
db2    Active    Unpinned
 
 

 [oracle@rac3 ~]$ cd $ORACLE_HOME/deinstall
[oracle@rac3 deinstall]$ ls
bootstrap_files.lst  bootstrap.pl  deinstall  deinstall.pl  deinstall.xml  jlib  readme.txt  response  sshUserSetup.sh  utl
[oracle@rac3 deinstall]$ ./deinstall -local
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/oracle/product/19.0.0/db_1
Oracle Home type selected for deinstall is: Oracle Real Application Cluster Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/19.0.0/grid
The following nodes are part of this cluster: rac3,rac2,rac1
Checking for sufficient temp space availability on node(s) : 'rac3'

## [END] Install check configuration ##


Network Configuration check config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2022-10-17_10-20-32AM.log

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2022-10-17_10-20-32AM.log

Use comma as separator when specifying list of values as input

Specify the list of database names that are configured locally on this node for this Oracle home. Local configurations of the discovered databases will be removed []: y
Database Check Configuration END

######################### DECONFIG CHECK OPERATION END #########################


####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.0.0/grid
The following nodes are part of this cluster: rac3,rac2,rac1
The cluster node(s) on which the Oracle home deinstallation will be performed are:rac3
Oracle Home selected for deinstall is: /u01/app/oracle/product/19.0.0/db_1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
The option -local will not modify any database configuration for this Oracle home.
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-10-17_10-19-58-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-10-17_10-19-58-AM.err'

######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2022-10-17_10-20-32AM.log

Network Configuration clean config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2022-10-17_10-20-32AM.log

Network Configuration clean config END


######################### DECONFIG CLEAN OPERATION END #########################


####################### DECONFIG CLEAN OPERATION SUMMARY #######################
#######################################################################


############# ORACLE DECONFIG TOOL END #############

Using properties file /tmp/deinstall2022-10-17_10-19-33AM/response/deinstall_2022-10-17_10-19-58-AM.rsp
Location of logs /u01/app/oraInventory/logs/

############ ORACLE DEINSTALL TOOL START ############

####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-10-17_10-19-58-AM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2022-10-17_10-19-58-AM.err'

######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to rac3
Setting CLUSTER_NODES to rac3
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2022-10-17_10-19-33AM/oraInst.loc
Setting oracle.installer.local to true

## [END] Preparing for Deinstall ##

Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START

Detach Oracle home '/u01/app/oracle/product/19.0.0/db_1' from the central inventory on the local node : Done

Delete directory '/u01/app/oracle/product/19.0.0/db_1' on the local node : Done

Failed to delete the directory '/u01/app/oracle'. Either user has no permission to delete or it is in use.
Delete directory '/u01/app/oracle' on the local node : Failed <<<<

Oracle Universal Installer cleanup completed with errors.

Oracle Universal Installer clean END


## [START] Oracle install clean ##


## [END] Oracle install clean ##


######################### DEINSTALL CLEAN OPERATION END #########################


####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/oracle/product/19.0.0/db_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/19.0.0/db_1' on the local node.
Failed to delete directory '/u01/app/oracle' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/oracle' on local node.
Oracle Universal Installer cleanup completed with errors.

Review the permissions and contents of '/u01/app/oracle' on nodes(s) 'rac3'.
If there are no Oracle home(s) associated with '/u01/app/oracle', manually delete '/u01/app/oracle' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL TOOL END #############

[oracle@rac3 deinstall]$ exit
logout
[root@rac3 oracle]#

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值