Bo's Oracle Station

【博客文章2023】最佳实践:Policy-Managed RAC数据库不停库无残留删除节点(删除实例和分离数据库HOME部分)

2023-5-6 22:33| 发布者: botang| 查看: 50| 评论: 0|原作者: Bo Tang

摘要: 本文介绍了原创的Policy-Managed RAC数据库不停库无残留删除节点最佳实践的删除实例和分离数据库HOME部分。本文区别于常见的有残留的或需要停库的删除节点的操作。通过把数据库从RAC转化成RACONENODE,彻底删除了想要删除的Policy Managed的实例。安全地分离了数据库HOME。
【博客文章2023】最佳实践:Policy-Managed RAC数据库不停库无残留删除节点(删除实例和分离数据库HOME部分)



Author: Bo Tang

1. 常见的有残留的或需要停库的删除节点的操作:

    删除节点的操作流程:删除该节点上的实例->分离和删除该节点上的数据库软件->分离和删除该节点上的网格基础架构软件。
    由于将要被删除的节点上运行着Policy Managed的数据库c01orcl(12.2.0.1)的一个节点,不能按照Admin Managed的数据库删除实例的方法来删除实例(比如:dbca方法或者srvctl remove instance命令)。Admin Managed的数据库删除实例相对简单容易,通过“srvctl remove instance -d 数据库名 -i 实例名”可以轻松删除。Policy Managed的数据库删除实例的一般做法是:通过“srvctl modify serverpool -g 服务器池的名字 -u  原先个数-1”来减少serverpool的服务器个数。如果将要被删除的节点上运行着实例,那么再通过“srvctl relocate server -n  要删除的服务器 -g Free”来重新在服务器池分配服务器,使得将要被删除的节点上不运行实例。但是这样合理的操作之后,存在无法解决的残留。具体情况是:最后的删除完成后,会发现在“crsctl status res -t”命令的输出中,数据库资源条目下仍然存在被删除的实例(显示成offline)。更加明显的是:“srvctl update database”命令会更加直白地告警:没有启动被删除的实例。遇到这种情况,只能通过:关停数据库->强行反注册数据库->重新注册数据库来解决。然而这样一来,就导致停库和重新注册服务和全局服务。

2. 实验初始环境:

[grid@station7 ~]$ crsctl status res -t           
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.ASMNET2LSNR_ASM.lsnr
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.DATA.ACFS_VOL1.advm
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.DATA.dg
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.FRA.dg
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.data.acfs_vol1.acfs
               ONLINE  OFFLINE      station3                 volume /home/oracle/
                                                             data offline,STABLE
               ONLINE  OFFLINE      station4                 volume /home/oracle/
                                                             data offline,STABLE
               ONLINE  ONLINE       station7                 mounted on /home/ora
                                                             cle/data,STABLE
ora.net1.network
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.ons
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
ora.proxy_advm
               ONLINE  ONLINE       station3                 STABLE
               ONLINE  ONLINE       station4                 STABLE
               ONLINE  ONLINE       station7                 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       station4                 STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       station7                 STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       station3                 STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       station3                 169.254.115.14 172.3
                                                             1.118.3 172.31.118.2
                                                             03,STABLE
ora.asm
      1        ONLINE  ONLINE       station3                 Started,STABLE
      2        ONLINE  ONLINE       station4                 Started,STABLE
      3        ONLINE  ONLINE       station7                 Started,STABLE
ora.c01orcl.db
      1        ONLINE  ONLINE       station4                 Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /dbhome_1,STABLE
      2        ONLINE  ONLINE       station3                 Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /dbhome_1,STABLE
      3        ONLINE  ONLINE       station7                 Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /dbhome_1,STABLE
ora.c01orcl.sales_r.svc
      1        OFFLINE OFFLINE                               STABLE
      2        OFFLINE OFFLINE                               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.c01orcl.sales_r2.svc
      1        OFFLINE OFFLINE                               STABLE
      2        OFFLINE OFFLINE                               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.c01orcl.serv2.svc
      1        ONLINE  ONLINE       station4                 STABLE
      2        ONLINE  ONLINE       station3                 STABLE
      3        ONLINE  ONLINE       station7                 STABLE
ora.c01orcl.serv3.svc
      1        ONLINE  ONLINE       station4                 STABLE
      2        ONLINE  ONLINE       station3                 STABLE
      3        ONLINE  ONLINE       station7                 STABLE
ora.cvu
      1        ONLINE  ONLINE       station3                 STABLE
ora.gns
      1        ONLINE  ONLINE       station3                 STABLE
ora.gns.vip
      1        ONLINE  ONLINE       station3                 STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       station3                 Open,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       station3                 STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       station4                 STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       station7                 STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       station3                 STABLE
ora.station3.vip
      1        ONLINE  ONLINE       station3                 STABLE
ora.station4.vip
      1        ONLINE  ONLINE       station4                 STABLE
ora.station7.vip
      1        ONLINE  ONLINE       station7                 STABLE


    要删除station7节点(上图标注的蓝色的)。

3. 删除该节点上的实例:

    通过手动关停服务器池中的节点(当然包括将要被删除的节点),将RAC数据库在线转化成RACONENODE:

[oracle@station3 ~]$ srvctl stop instance -d c01orcl -n station7 -force

[oracle@station3 ~]$ srvctl stop instance -d c01orcl -n station4 -force

[oracle@station3 ~]$ srvctl convert database -d c01orcl -dbtype RACONENODE

    命令执行成功后,RACONENODE数据库的配置:

[oracle@station3 ~]$ srvctl config database -d c01orcl

Database unique name: c01orcl

Database name: c01orcl

Oracle home: /u01/app/oracle/product/12.2.0/dbhome_1

Oracle user: oracle

Spfile: +data/c01orcl/spfilec01orcl.ora

Password file: +data/c01orcl/orapwc01orcl

Domain: example.com

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Server pools: racdbpool

Disk Groups: FRA,DATA

Mount point paths:

Services: sales_r,sales_r2,serv2,serv3

Type: RACOneNode

Online relocation timeout: 30

Instance name prefix: c01orcl

Candidate servers:

OSDBA group: dba

OSOPER group: oper

Database instances: c01orcl_1

CSS critical: no

CPU count: 0

Memory target: 0

Maximum memory: 0

Default network number for database services:


    用户仍然能够通过原有的TNS串连接和使用数据库。

4. 分离和删除该节点上的数据库软件

    在要保留的节点上操作:

[oracle@station3 ~]$ cd /u01/app/oracle/product/12.2.0/dbhome_1/oui/bin/

[oracle@station3 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 "CLUSTER_NODES={station3,station4}"

Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB. Actual 4095 MB Passed

The inventory pointer is located at /etc/oraInst.loc

'UpdateNodeList' was successful.


[oracle@station4 ~]$ cd /u01/app/oracle/product/12.2.0/dbhome_1/oui/bin/

[oracle@station4 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 "CLUSTER_NODES={station3,station4}"

Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB. Actual 4095 MB Passed

The inventory pointer is located at /etc/oraInst.loc

'UpdateNodeList' was successful.


    在将要删除的节点上操作:

[oracle@station7 ~]$ cd /u01/app/oracle/product/12.2.0/dbhome_1/oui/bin/

[oracle@station7 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 "CLUSTER_NODES={station7}" -local

Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB. Actual 4095 MB Passed

The inventory pointer is located at /etc/oraInst.loc

'UpdateNodeList' was successful.



[oracle@station7 bin]$ ./runInstaller -detachHome ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 -local

Starting Oracle Universal Installer...


Checking swap space: must be greater than 500 MB. Actual 4095 MB Passed

The inventory pointer is located at /etc/oraInst.loc

'DetachHome' was successful.


    下面这条命令一定不能遗漏-local(红色),否则每一个节点上的ORACLE数据库软件都会被删除掉:

[oracle@station7 bin]$ /u01/app/oracle/product/12.2.0/dbhome_1/deinstall/deinstall -local

Checking for required files and bootstrapping ...

Please wait ...

Location of logs /tmp/deinstall2023-05-02_06-25-53PM/logs/


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


The product version number of the specified home cannot be determined. Is the product version 12.2.0.1.0 (y - yes, n - no)? [n]y


######################### DECONFIG CHECK OPERATION START #########################

## [START] Install check configuration ##

The deinstall tool cannot determine the home type needed to deconfigure the selected home. Please select the type of Oracle home you are trying to deinstall.

Single Instance database - Enter 1

Real Application Cluster database - Enter 2

Grid Infrastructure for a cluster - Enter 3

Grid Infrastructure for a stand-alone server - Enter 4

Client Oracle Home - Enter 5

Transparent Gateways Oracle Home - Enter 6

GSM Oracle Home - Enter 7

2



Checking for existence of the Oracle home location /u01/app/oracle/product/12.2.0/dbhome_1

Oracle Home type selected for deinstall is: Oracle Real Application Cluster Database

Oracle Base selected for deinstall is:

Checking for existence of central inventory location /u01/app/oraInventory

Checking for existence of the Oracle Grid Infrastructure home /u01/app/12.2.0/grid

The following nodes are part of this cluster: station7,station4,station3

Checking for sufficient temp space availability on node(s) : 'station7'


## [END] Install check configuration ##



Network Configuration check config START


Network de-configuration trace file location: /tmp/deinstall2023-05-02_06-25-53PM/logs/netdc_check2023-05-02_06-28-38-PM.log


Network Configuration check config END


Database Check Configuration START


Database de-configuration trace file location: /tmp/deinstall2023-05-02_06-25-53PM/logs/databasedc_check2023-05-02_06-30-16-PM.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 []: 直接回车

Database Check Configuration END

Oracle Configuration Manager check START

OCM check log file location : /tmp/deinstall2023-05-02_06-25-53PM/logs//ocm_check5116.log

Oracle Configuration Manager check END


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



####################### DECONFIG CHECK OPERATION SUMMARY #######################

Oracle Grid Infrastructure Home is: /u01/app/12.2.0/grid

The following nodes are part of this cluster: station7,station4,station3

The cluster node(s) on which the Oracle home deinstallation will be performed are:station7

Oracle Home selected for deinstall is: /u01/app/oracle/product/12.2.0/dbhome_1

Inventory Location where the Oracle home registered is: /u01/app/oraInventory

Checking the config status for CCR

Oracle Home exists with CCR directory, but CCR is not configured

CCR check is finished

Do you want to continue (y - yes, n - no)? [n]: y

A log of this session will be written to: '/tmp/deinstall2023-05-02_06-25-53PM/logs/deinstall_deconfig2023-05-02_06-26-09-PM.out'

Any error messages from this session will be written to: '/tmp/deinstall2023-05-02_06-25-53PM/logs/deinstall_deconfig2023-05-02_06-26-09-PM.err'


######################## DECONFIG CLEAN OPERATION START ########################

Database de-configuration trace file location: /tmp/deinstall2023-05-02_06-25-53PM/logs/databasedc_clean2023-05-02_06-31-13-PM.log


Network Configuration clean config START


Network de-configuration trace file location: /tmp/deinstall2023-05-02_06-25-53PM/logs/netdc_clean2023-05-02_06-31-13-PM.log


Network Configuration clean config END


Oracle Configuration Manager clean START

OCM clean log file location : /tmp/deinstall2023-05-02_06-25-53PM/logs//ocm_clean5116.log

Oracle Configuration Manager clean END


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



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

Cleaning the config for CCR

As CCR is not configured, so skipping the cleaning of CCR configuration

CCR clean is finished

#######################################################################



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


Using properties file /tmp/deinstall2023-05-02_06-25-53PM/response/deinstall_2023-05-02_06-26-09-PM.rsp

Location of logs /tmp/deinstall2023-05-02_06-25-53PM/logs/


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






####################### DEINSTALL CHECK OPERATION SUMMARY #######################

A log of this session will be written to: '/tmp/deinstall2023-05-02_06-25-53PM/logs/deinstall_deconfig2023-05-02_06-26-09-PM.out'

Any error messages from this session will be written to: '/tmp/deinstall2023-05-02_06-25-53PM/logs/deinstall_deconfig2023-05-02_06-26-09-PM.err'


######################## DEINSTALL CLEAN OPERATION START ########################

## [START] Preparing for Deinstall ##

Setting LOCAL_NODE to station7

Setting CLUSTER_NODES to station7

Setting CRS_HOME to false

Setting oracle.installer.invPtrLoc to /tmp/deinstall2023-05-02_06-25-53PM/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


Delete directory '/u01/app/oracle/product/12.2.0/dbhome_1' on the local node : Done


Oracle Universal Installer cleanup was successful.


Oracle Universal Installer clean END



## [START] Oracle install clean ##



## [END] Oracle install clean ##



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



####################### DEINSTALL CLEAN OPERATION SUMMARY #######################

Successfully deleted directory '/u01/app/oracle/product/12.2.0/dbhome_1' on the local node.

Oracle Universal Installer cleanup was successful.


Run 'rm -r /etc/oratab' as root on node(s) 'station7' at the end of the session.

Oracle deinstall tool successfully cleaned up temporary directories.

#######################################################################



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


[oracle@station7 bin]$




路过

雷人

握手

鲜花

鸡蛋

QQ|手机版|Bo's Oracle Station   

GMT+8, 2023-5-9 22:11 , Processed in 0.020963 second(s), 21 queries .

返回顶部