oracle19c rac 节点缩容操作(三节点变2节点)

目录

1.查看当前集群服务状态

2.查看集群节点状态

3.集群注册表备份

4.登录三节点(需要被移除的节点)

5.一节点删除三节点实例

6.查看数据库服务

7.更新inventory(在被删除的节点上运行)

8.卸载ORACLE HOME(在被删除的节点上运行),就是删除ORACLE DATABASE软件

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

9.1一节点(保留节点)                                                                                                                          

9.2二节点(保留节点)

10.在保留任一节点执行命令

11.删除GI(要删除的节点上grid用户执行)

11.1查看节点状态

11.2卸载集群(删除节点操作)

11.3更新inventory(在要被删除的节点上)

11.4删除Grid Infrastructure home(在要被删除的节点)

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

12.删除节点(在一节点运行)

13.验证缩容结果

13.1查看集群配置


1.查看当前集群服务状态

[root@antute01 bin]# crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
ora.chad
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
ora.net1.network
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
ora.ons
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ARCH.dg(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.CRS.dg(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       antute01                 STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       antute03                 STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       antute02                 STABLE
ora.antute01.vip
      1        ONLINE  ONLINE       antute01                 STABLE
ora.antute02.vip
      1        ONLINE  ONLINE       antute02                 STABLE
ora.antute03.vip
      1        ONLINE  ONLINE       antute03                 STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 Started,STABLE
      2        ONLINE  ONLINE       antute02                 Started,STABLE
      3        ONLINE  ONLINE       antute03                 Started,STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.att.db
      1        ONLINE  ONLINE       antute01                 Open,HOME=/u01/app/o
                                                             racle1/product/19/db
                                                             _home1,STABLE
      2        ONLINE  ONLINE       antute02                 Open,HOME=/u01/app/o
                                                             racle1/product/19/db
                                                             _home1,STABLE
      3        ONLINE  ONLINE       antute03                 Open,HOME=/u01/app/o
                                                             racle1/product/19/db
                                                             _home1,STABLE
ora.cvu
      1        ONLINE  ONLINE       antute02                 STABLE
ora.qosmserver
      1        ONLINE  ONLINE       antute02                 STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       antute01                 STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       antute03                 STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       antute02                 STABLE
--------------------------------------------------------------------------------

集群三个节点服务正常

2.查看集群节点状态

[root@antute01 bin]# olsnodes -s -t
antute01        Active  Unpinned
antute02        Active  Unpinned
antute03        Active  Unpinned

三个节点存活

3.集群注册表备份

登录一节点(保留的节点)

[root@antute01 bin]# ocrconfig -manualbackup

antute02     2023/08/02 17:34:28     +crs:/antute-cluster/OCRBACKUP/backup_20230802_173428.ocr.258.1143826469     724960844
[root@antute01 bin]# ocrconfig -showbackup
PROT-24: Auto backups for the Oracle Cluster Registry are not available

antute02     2023/08/02 17:34:28     +crs:/antute-cluster/OCRBACKUP/backup_20230802_173428.ocr.258.1143826469     724960844


4.登录三节点(需要被移除的节点)

登录需要被移除节点
[root@antute03 bin]# su - oracle
Last login: Mon Jul 31 13:27:18 CST 2023 on pts/0
[oracle@antute03 ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-AUG-2023 17:36:59

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-AUG-2023 17:14:13
Uptime                    0 days 0 hr. 22 min. 45 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/antute03/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.125.113)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.125.116)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM3", status READY, has 1 handler(s) for this service...
Service "+ASM_ARCH" has 1 instance(s).
  Instance "+ASM3", status READY, has 1 handler(s) for this service...
Service "+ASM_CRS" has 1 instance(s).
  Instance "+ASM3", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM3", status READY, has 1 handler(s) for this service...
Service "att" has 1 instance(s).
  Instance "att3", status READY, has 1 handler(s) for this service...
Service "attXDB" has 1 instance(s).
  Instance "att3", status READY, has 1 handler(s) for this service...
The command completed successfully

登录移除节点oracle用户

[oracle@antute03 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 17:38:13 2023
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      att
db_unique_name                       string      att
global_names                         boolean     FALSE
instance_name                        string      att3
lock_name_space                      string
log_file_name_convert                string
pdb_file_name_convert                string
processor_group_name                 string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      att
SQL>


5.一节点删除三节点实例

dbca -silent -deleteInstance -nodeList antute03 -gdbName att -instanceName att3 -sysDBAUserName sys -sysDBAPassword oracle_4U

-nodeList 节点名

-gdbName 数据库名

att -instanceName 实例名

-sysDBAUserName sys用户名

-sysDBAPassword sys密码
[oracle@antute01 ~]$ dbca -silent -deleteInstance -nodeList antute03 -gdbName att -instanceName att3 -sysDBAUserName sys -sysDBAPassword oracle_4U
[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.

Prepare for db operation
40% complete
Deleting instance
48% complete
52% complete
56% complete
60% complete
64% complete
68% complete
72% complete
76% complete
80% complete
Completing instance management.
100% complete
Instance "att3" deleted successfully from node "antute03".
Look at the log file "/u01/app/oracle1/cfgtoollogs/dbca/att/att4.log" for further details.


6.查看数据库服务

[root@antute02 bin]# crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
ora.chad
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
ora.net1.network
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
ora.ons
               ONLINE  ONLINE       antute01                 STABLE
               ONLINE  ONLINE       antute02                 STABLE
               ONLINE  ONLINE       antute03                 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ARCH.dg(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.CRS.dg(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       antute01                 STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       antute03                 STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       antute02                 STABLE
ora.antute01.vip
      1        ONLINE  ONLINE       antute01                 STABLE
ora.antute02.vip
      1        ONLINE  ONLINE       antute02                 STABLE
ora.antute03.vip
      1        ONLINE  ONLINE       antute03                 STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 Started,STABLE
      2        ONLINE  ONLINE       antute02                 Started,STABLE
      3        ONLINE  ONLINE       antute03                 Started,STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       antute01                 STABLE
      2        ONLINE  ONLINE       antute02                 STABLE
      3        ONLINE  ONLINE       antute03                 STABLE
ora.att.db
      1        ONLINE  ONLINE       antute01                 Open,HOME=/u01/app/o
                                                             racle1/product/19/db
                                                             _home1,STABLE
      2        ONLINE  ONLINE       antute02                 Open,HOME=/u01/app/o
                                                             racle1/product/19/db
                                                             _home1,STABLE

         ##三节点数据库服务已删除
ora.cvu
      1        ONLINE  ONLINE       antute02                 STABLE
ora.qosmserver
      1        ONLINE  ONLINE       antute02                 STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       antute01                 STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       antute03                 STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       antute02                 STABLE
--------------------------------------------------------------------------------

重新查看集群服务三节点数据库服务已删除

7.更新inventory(在被删除的节点上运行)

登录oracle用户

./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=antute03" -local

ORACLE_HOME、CLUSTER_NODES改成自己对应的目录和节点名

[oracle@antute03 db_home1]$ cd $ORACLE_HOME/oui/bin
[oracle@antute03 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=antute03" -local
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 20479 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

8.卸载ORACLE HOME(在被删除的节点上运行),就是删除ORACLE DATABASE软件

[oracle@antute03 bin]$ $ORACLE_HOME/deinstall/deinstall -local
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 []:回车
####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.0.0/grid
The following nodes are part of this cluster: antute03,antute02,antute01
The cluster node(s) on which the Oracle home deinstallation will be performed are:antute03
Oracle Home selected for deinstall is: /u01/app/oracle1/product/19/db_home1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Do you want to continue (y - yes, n - no)? [n]: y 选y

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

9.1一节点(保留节点)                                                                                                                          

[oracle@antute01 ~]$ cd $ORACLE_HOME/oui/bin
[oracle@antute01 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=antute01" -local
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 20479 MB    Passed
The inventory pointer is located at /etc/oraInst.loc


9.2二节点(保留节点)


[oracle@antute02 ~]$ cd $ORACLE_HOME/oui/bin
[oracle@antute02 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=antute01" -local
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 20479 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

10.在保留任一节点执行命令

CLUSTER_NODES是剩下保留的节点名称
[oracle@antute01 bin]$ $ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={antute01,antute02}"
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 20479 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

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


[root@antute03 bin]# olsnodes -s -t
antute01        Active  Unpinned
antute02        Active  Unpinned
antute03        Active  Unpinned


11.2卸载集群(删除节点操作)


[root@antute03 bin]# crsctl stop crs

--root脚本卸载
[root@antute03 bin]# cd /u01/app/19.0.0/grid/crs/install/

[root@antute03 install]# ./rootcrs.sh -deconfig -force
Using configuration parameter file: /u01/app/19.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/antute03/crsconfig/crsdeconfig_antute03_2023-08-02_05-59-13PM.log
PRCR-1070 : Failed to check if resource ora.net1.network is registered
CRS-0184 : Cannot communicate with the CRS daemon.
PRCR-1070 : Failed to check if resource ora.helper is registered
CRS-0184 : Cannot communicate with the CRS daemon.
PRCR-1070 : Failed to check if resource ora.ons is registered
CRS-0184 : Cannot communicate with the CRS daemon.

2023/08/02 17:59:22 CLSRSC-180: An error occurred while executing the command '/u01/app/19.0.0/grid/bin/srvctl config nodeapps'
2023/08/02 17:59:32 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.
2023/08/02 18:01:31 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.
2023/08/02 18:01:31 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node

11.3更新inventory(在要被删除的节点上)


[root@antute03 install]# su - grid
Last login: Wed Aug  2 17:59:48 CST 2023 on pts/0
[grid@antute03 ~]$ cd $ORACLE_HOME/oui/bin
[grid@antute03 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=antute03" CRS=TRUE -silent -local
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 20479 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/UpdateNodeList2023-08-02_06-04-05PM.log
'UpdateNodeList' was successful.

11.4删除Grid Infrastructure home(在要被删除的节点)

注意:如果不指定–local,会删除整个cluster中的所有的grid home
[grid@antute03 bin]$ $ORACLE_HOME/deinstall/deinstall -local
选择y或者回车
ASM configuration was not detected in this Oracle home. Was ASM configured in this Oracle home (y|n) [n]: y     输入y
 If you want to retain the existing diskgroups or if any of the information detected is incorrect, you can modify by entering 'y'. Do you  want to modify above information (y|n) [n]: y   输入y
Specify the ASM Diagnostic Destination [/u01/app/grid]:  输入回车
Specify the diskstring [/dev/dm*]:  输入回车
Specify the diskgroups that are managed by this ASM instance []:  输入回车
Do you want to continue (y - yes, n - no)? [n]: y    输入y

11.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运行)

12.删除节点(在一节点运行)

在保留节点操作
[root@antute01 bin]# crsctl delete node -n antute03
CRS-4661: Node antute03 successfully deleted.
[root@antute01 bin]# su - grid
Last login: Wed Aug  2 18:14:28 CST 2023
[grid@antute01 ~]$ cluvfy stage -post nodedel -n antute03 -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:                         Aug 2, 2023 6:17:02 PM
CVU home:                     /u01/app/19.0.0/grid/
User:                         grid

查看节点状态
[grid@antute01 ~]$ olsnodes -s -t
antute01        Active  Unpinned
antute02        Active  Unpinned

手工清理残余目录

[oracle@antute03 ~]$ cd /u01/app/oracle1/
[oracle@antute03 oracle1]$ ls
admin

13.验证缩容结果
13.1查看集群配置


[grid@antute02 ~]$ srvctl config database -d att
Database unique name: att
Database name: att
Oracle home: /u01/app/oracle1/product/19/db_home1
Oracle user: oracle
Spfile: +DATA/ATT/PARAMETERFILE/spfile.272.1138564717
Password file: +DATA/ATT/PASSWORD/pwdatt.257.1138564115
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: ARCH,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: att1,att2
Configured nodes: antute01,antute02
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

森森淼淼丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值