ITPub博客

首页 > 数据库 > Oracle > oracle rac节点重构

oracle rac节点重构

原创 Oracle 作者:wanglinghua0907 时间:2024-01-15 18:21:00 0 删除 编辑

方法一(2节点软件不删)

1.踢出节点

使用root用户登录,并执行下面的命令(所有节点,但最后一个节点除外)  (踢出当前节点)(perl失败,见本人其他文章)

# perl $GRID_HOME/crs/install/rootcrs.pl -verbose -deconfig -force

rootanode2 using configur CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 CRS-2673 orac e Zr 5 _1 c." 5 rootcrs.p Network exists: 1/192.168.83.0/255.255.255.0 ethO, t e static GSO ONS exists: /node1-vip/192.168.83.193/192.168.83.0/2zg.255.255.0/eth0, hosting node nodel exists: /node2-vip/192.168.83.194/192.168.83.0/255.255.255.O/ethO, hosting node node2 exi sts exists: Local port 6100, remote port 6200, EM port 2016 Startina shutdown of Oracle High Availability Services—managed resources on •node2• : Attempting to stop 'ora. crsd' on 'node2' Starting shutdown of Cluster Ready Services—managed resources on • node2• CRS-2791: CRS-2790: : Attempting to stop 'ora.OCRvT. dg' on 'node2' : Attempting to stop 'ora. blj. db' on 'node2' Stop of 'ora. blj. db' on 'node2' succeeded CRS-2677 : : Attempting to stop 'ora.DATA.d on 'node2' Stop of 'ora. DATA.d on 'node CRS-2677 : succeeded Stop of 'ora. OCRvT. g' on 'node2' succeeded CRS-2677: : Attempting to stop 'ora. asm• on 'node2' Stop of 'ora. asm• on 'node2' succeeded CRS-2677: Shutdown of Cluster Ready Services-managed resources on CRS-2792: CRS-2677: CRS-2673: CRS-2673. CRS-2677 : CRS-2677: CRS-2677 : CRS-2677: CRS-2677: CRS-2677: CRS-2677: CRS-2677: CRS-2673. CRS-2677: • node2 • has compl et ed Stop of 'ora. crsd' on 'node2' succeeded : Attempting to stop 'ora. ctssd' on 'node2' : Attempting to stop 'ora. evmd' on 'node2' Attempting to stop 'ora. asm' on 'node2' • Attempting to sto? 'ora. mdnsd' on 'node2' Stop of 'ora. evmd on 'node2' succeeded Stop of 'ora. ctssd' on 'node2' succeeded Stop of 'ora. mdnsd' on 'node2' succeeded stop of 'ora. asm• on 'node2' succeeded : Attempting to stop 'ora. cluster _ interconnect. hai • stop of 'ora. cluster _ interconnect. haip• on 'node : Attempting to sto? 'ora. cssd' on 'node2 stop of ora. cssd on 'node2' succeeded : Attempting to stop 'ora. crf' on 'node2' stop of 'ora. crf' on 'node2' succeeded : Attempting to stop 'ora. gipcd' on 'node2' stop of 'ora. gipcd' on 'node2' succeeded • Attempting to stop 'ora. gpnpd' on 'node2 stop of 'ora. gpnpd' on • node2' succeeded on • node2• succeeded CRs-2793: CRs-4133: shutdown of Oracle Hi h Availability services—managed resources on Oracle High Availabil?ty services has been stopped. • node2 • has compl et ed Removina Trace File Analyzer ccessful


2.跑root脚本加回节点

root跑

# GRID_HOME/root.sh

rootanode2 — oracle/ rid/crs_l root. sh performing roo The following enviroment variables are set as rid ORACLE_OWNER — orac le/gr i d/crs_l Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwr ite. Entries will be added to the /etc/oratab file as needed by Database configuration Assistant When a database is created Finished running of root script. Now product -speci actions will be performed. Using configuration arameter file: User i nore prerequ%sites during installation Instal%ing Trace File Analyzer OLR initial ization - successful Addinq cluster-ware entries to upstart CRS-4Å02: The c ss daemon was started in exclusive node but found an active css daemon on node nodel, An active cluster was found during exclusive startup, restarting to join the cluster nu±er 1 , and is terminating preparing packages for instal lation. cvu disk-I. O. 9-1 i e Oracle id Infr astructure a c luster succeeded


方法二(2节点软件、实例全卸载)

1.删实例

静默

(静默的话,要在1节点跑,删2节点)(节点名、global_names(没设就和service name一样)、实例名、sys密码)

[oracle@rac1 ~]$ dbca -silent -deleteinstance -nodelist rac2 -gdbname orcl -instancename orcl2 -sysdbausername sys -sysdbapassword oracle

Deletinq "stance 1% complete 2% complete 13% complete 20% complete 26% complete 33% complete 40% complete 46% complete 53% complete 60% complete 66% complete completinq instance management. 100% complete Look at the log file "/oracle/app/cfgtoollogs/dbca/blj. log" [oracleanodel —JS for further details.

图形化dbca

 dbca-实例管理-删除节实例-选择服务输入密码-选择inactive实例-确认删除


验证节点

select inst_id,instance_name from gv$instance;

SQL> select inst_id, instance_name from gvSinstance; INST_ID INSTANCE_NAXE 1 bli fflJ2äj SQL > select inst_id, instance_name from gvSinstance; INST_ID INSTANCE_NAYE 1 bljl


2.在保留节点使用oracle用户更新集群列表(node1我写的是节点主机名)

[oracle@rac1 ~]$ $ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME  "CLUSTER_NODES={node1}"


3.移除集群中二节点的VIP

停掉本地监听服务

[grid@node1 ~]$ crsctl stop res ora.LISTENER.lsnr

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'node2'

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'node1'

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'node2' succeeded

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'node1' succeeded


停止二节点VIP(停不下来尝试直接删):

[root@node1 ~]$ /oracle/grid/crs_1/bin/srvctl stop vip -i node2-vip


删除二节点VIP:

[root@node1 ~]# /oracle/grid/crs_1/bin/srvctl remove vip -i node2-vip -f

 

查看状态

crsctl status res -t


2节点的vip信息已经删除

TARGET Local Resources ora. DATA. dg ONLINE ONLINE ora. LISTENER. Isnr OFFLINE OFFLINE or a. OCRVT. dg ONLINE ONLINE ora. asm ONLINE ONLINE ora. gsd OFFLINE OFFLINE ora. netl. network ONLINE ONLINE or a. Ons ONLINE ONLINE Cluster Resources ora. LISTENER_SCANI. Isnr 1 ONLINE ora. bl . db ONLINE ora. bl . XI. svc ONLINE ora. cvu ora. nodel. vip 1 ora. or cl. db 1 2 ONLINE ONLINE OFFLINE OFFLINE STATE ONLINE ONLINE OFFLINE OFFLINE ONLINE ONLINE ONLINE ONLINE OFFLINE OFFLINE ONLINE ONLINE ONLINE ONLINE ONLINE ONLINE ONLINE ONLINE ONLINE OFFLINE OFFLINE ONLINE SERVER nodel node2 nodel node2 nodel node2 nodel node2 nodel node2 nodel node2 nodel node2 nodel nodel nodel nodel node2 nodel STATE_DETAILS start ed star ted Instance shutdown Instance Shutdown ora. scanl. vip 1 ONLINE [gridanodel -IS 1


4.查看集群节点信息

[grid@node1 ~]$ olsnodes -s -t

node1   Active  Unpinned

node2   Active  Unpinned

(如果二节点是ping状态,需要执行这步:[grid@rac1 ~]$crsctl unpin css -n rac2)

 

5.删除节点2

2节点关集群

[root@node2 ~]# /oracle/grid/crs_1/bin/crsctl stop crs


如果关不下来服务,状态为unknow导致,可以直接disable crs,然后重启服务器即可。

root:

/u01/app/11.2.0/grid/bin/crsctl disable crs


1节点上删除2节点

[root@rac1 bin]# $GRID_HOME/bin/crsctl delete node -n rac2

CRS-4661: Node rac2 successfully deleted.

 

这个报错就是2节点没关

CRS-4658: The clusterware stack on node node2 is not completely down. CRS-4000: Command Delete failed, or completed with errors.

 

6.更新GI的inventory信息

su - gird

cd $ORACLE_HOME/oui/bin

[grid@rac1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES={rac1}" CRS=TRUE  -local

 

Starting Oracle Universal Installer...

 

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

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

The inventory is located at /oracle/oraInventory

'UpdateNodeList' was successful.


7.重新添加二节点到集群中

7.1前提条件

  (1):添加相应的用户和组,用户及用户组ID相同

  (2):配置 hosts文件 ,新增节点和原有都配置为相同

  (3):配置系统参数,用户参数和原有节点一样,配置网络

  (4):创建相应的目录,并保证权限对应(根据实际情况创建目录,非常重要)

  mkdir /oracle/app

  mkdir /oracle/grid/crs_1

  mkdir /oracle/gridbase

  mkdir /oracle/oraInventory 

  chown oracle:oinstall /oracle/app

  chown grid:oinstall /oracle/grid/

  chown grid:oinstall /oracle/grid/crs_1

  chown grid:oinstall /oracle/gridbase

  chown grid:oinstall /oracle/oraInventory

  chmod 770 /oracle/oraInventory

  5)检查多路径,盘权限

 

7.2配置用户之间的SSH、安装集群rpm包:

到grid软件解压目录下:

[root@rac1 sshsetup]# cd /oracle/grid/grid/sshsetup

grid用户的ssh:

./sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced –noPromptPassphrase

oracle用户的ssh:

./sshUserSetup.sh -user oracle -hosts "rac1 rac2" -advanced –noPromptPassphrase

将grid软件目录下的rpm包传到二节点:

[grid@rac1 ~]$scp cvuqdisk-1.0.9-1.rpm  192.168.40.102:/home/grid

 

二节点安装rpm包:

[grid@rac2 ~]$ rpm-ivh cvuqdisk-1.0.9-1.rpm

若你没有oinstall组,安装可能报错。此时手动export DISKGROUP=dba

 

7.3检查rac2是否满足rac安装条件

1.检查网络和存储:

[grid@racdb1 ~]$ cluvfy stage -post hwos -n rac2

Check: TCP connectivity of subnet "10.0.0.0"

  Source                          Destination                     Connected?      

  ------------------------------  ------------------------------  ----------------

  rac1:192.168.40.101             rac2:10.0.0.3                   failed          

 

ERROR: 

PRVF-7617 : Node connectivity between "rac1 : 192.168.40.101" and "rac2 : 10.0.0.3" failed

Result: TCP connectivity check failed for subnet "10.0.0.0"

 

Result: Node connectivity check failed

若出现上述报错,可忽略。

 

2.检查rpm包、磁盘空间等:

[grid@racdb1 ~]$ cluvfy comp peer  -n rac2

 

3.整体检查

 [grid@racdb1 ~]$ cluvfy stage -pre nodeadd -n rac2 -fixup -verbose

 

7.4添加节点(路径记得清理,不然有root属组的写不进)

如果报错,可重新执行上方的更新GI的inventory信息。


如果这个报错,可以将好的节点的ORACLE_HOME tar过来,然后再添加节点即可

Home copied to new nodes Saving inventory on nodes (Wednesday, May 31, 2023 3:40:22 PM CST) SEVERE: Remote 'AttachHome' failed on nodes: 'pacs02' . Refer to M. log' for details. It is recommended that the following conunand needs to be manually run on the failed nodes: /uOI/app/II.2.O/grid/oui/bin/runInstaIIer —attachHome —noCIusterEnabIed O/grid allg_gridinfrahomel CLUSTER NODES=pacs01, pacs02 CRS=true "INVENTORY _ LOCATION=/u01/app/orarnventory" -invPtrLoc "/u01/app/11. 2 . O/ grid/ oralnst . loc" LOCAL on which conunand is to be run>. Please refer 'AttachHome" logs under central inventory of remote nodes where failure occurred for more details. SEVERE:Remote 'UpdateNodeList' failed on nodes: 'pacs02' . Refer to 03—40 —09PM. log' for details. It is recormlended that the following command needs to be manually run on the failed nodes: /uOI/app/II.2.O/gzid/oui/bin/runInsta11er —updateN0deList —noCIusterEnabIed ORACLE HOME=/uOI/app/II.2 .0/grid CLUSTER NODES=p acs01,pacs02 CRS—true "INVENTORY LOCATION=/u01/app/ora1nventory" -invPtrLoc "/u01/app/11.2. O/grid/oralnst . loc" LOCAL NODE=<11111111n ode on which corrunand is to be run>. Please refer 'UpdateNodeList' logs under central inventory of remote nodes where failure occurred for more details. Save' inventory complete WARNING: The following configuration scripts need to be executed as the below is followed by a list of nodes . /u01/app/II.2. O/grid/root.sh nodes pacs02 To execute the configuration scripts : I. open a terminal window 2. Log in as "root" Actech@123 100* Done. "root" user in each new cluster node. Each script in the list

grid用户在grid_home/oui/bin目录下执行:

忽略addnote的时候进行的自检(因为我们不使用DNS和NTP,若addnode的时候自检不通过,则无法增加节点)

执行前删除日志小文件,特别是审计日志、trace日志,不然复制很慢


添加节点,需要忽略部分先决条件(1节点执行)

$ cd $ORACLE_HOME/oui/bin

$ export IGNORE_PREADDNODE_CHECKS=Y

$ ./addNode.sh "CLUSTER_NEW_NODES={rac2}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={rac2-vip}"


日志:

Each script in the list below is followed by a list of nodes.

/oracle/oraInventory/orainstRoot.sh #On nodes rac2

/oracle/grid/crs_1/root.sh #On nodes rac2

To execute the configuration scripts:

    1. Open a terminal window

    2. Log in as "root"

    3. Run the scripts in each cluster node

    

The Cluster Node Addition of /oracle/grid/crs_1 was unsuccessful.

Please check '/tmp/silentInstall.log' for more details.

 

跑以上提示脚本

(1)[root@rac2 oracle]# /oracle/oraInventory/orainstRoot.sh

 

(2)[root@rac2 oracle]# /oracle/grid/crs_1/root.sh

 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /oracle/grid/crs_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Using configuration parameter file: /oracle/grid/crs_1/crs/install/crsconfig_params

Creating trace directory

User ignored Prerequisites during installation

Installing Trace File Analyzer

OLR initialization - successful

Adding Clusterware entries to upstart

CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac1, number 1, and is terminating

An active cluster was found during exclusive startup, restarting to join the cluster

clscfg: EXISTING configuration version 5 detected.

clscfg: version 5 is 11g Release 2.

Successfully accumulated necessary OCR keys.

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

PRKO-2190 : VIP exists for node rac2, VIP name rac2-vip

PRKO-2420 : VIP is already started on node(s): rac2

Configure Oracle Grid Infrastructure for a Cluster ... succeeded


7.5添加新节点数据库:(在一节点操作)

oracle用户:

cd $ORACLE_HOME/oui/bin

./addNode.sh -silent "CLUSTER_NEW_NODES={pacs02}"


二节点运行脚本:(具体脚本 按照上面的反馈来,只在2节点执行)

[root@rac2 oracle]# /oracle/app/product/11.2.0/db_1/root.sh

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/product/11.2.0/db_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The contents of "dbhome" have not changed. No need to overwrite.

The contents of "oraenv" have not changed. No need to overwrite.

The contents of "coraenv" have not changed. No need to overwrite.

 

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

 

7.6创建二节点实例(在一节点操作)

Dg库需要修改db_unique_name和db_name一致,不然会报错,等加好实例再把db_unique_name修改回去

[oracle@rac1 bin]$ dbca -silent -addInstance -nodeList rac2 -gdbName orcl -instanceName orcl2 -sysDBAUserName sys -sysDBAPassword "oracle"


Adding instance

1% complete

2% complete

6% complete

13% complete

20% complete

27% complete

28% complete

34% complete

41% complete

48% complete

54% complete

66% complete

Completing instance management.

76% complete

100% complete

Look at the log file "/oracle/app/cfgtoollogs/dbca/orcl/orcl.log" for further details.

 

7.7验证集群状态等

[grid@rac2 ~]$ crs_stat -t

Name           Type           Target    State     Host        

------------------------------------------------------------

ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1        

ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        

ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac1        

ora.OCRVOT.dg  ora....up.type ONLINE    ONLINE    rac1        

ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        

ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac1        

ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               

ora....network ora....rk.type ONLINE    ONLINE    rac1        

ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    rac1        

ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        

ora.orcl.db    ora....se.type ONLINE    ONLINE    rac1        

ora....SM1.asm application    ONLINE    ONLINE    rac1        

ora....C1.lsnr application    ONLINE    ONLINE    rac1        

ora.rac1.gsd   application    OFFLINE   OFFLINE               

ora.rac1.ons   application    ONLINE    ONLINE    rac1        

ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        

ora....SM2.asm application    ONLINE    ONLINE    rac2        

ora....C2.lsnr application    ONLINE    ONLINE    rac2        

ora.rac2.gsd   application    OFFLINE   OFFLINE               

ora.rac2.ons   application    ONLINE    ONLINE    rac2        

ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        

ora....ry.acfs ora....fs.type ONLINE    ONLINE    rac1        

ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac1        


[grid@rac2 ~]$ srvctl status db -d orcl

Instance orcl1 is running on node rac1

Instance orcl2 is running on node rac2

 

SQL> select inst_id,status from gv$instance;

   INST_ID STATUS

---------- ------------

         3 OPEN

         1 OPEN

SQL> select open_mode from v$database;

 

OPEN_MODE

--------------------

READ WRITE


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69980685/viewspace-3003917/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE、sql server、oceanbase数据库专家,拥有7年以上的大型数据库运维经验,主方向oracle,擅长故障排除、诊断,大体量(TB)迁移,异常故障修复等。拥有丰富主导大型项目经验。服务行业包括:运营商、银行、金融业、政府单位、医疗、制造业、高校等等。

注册时间:2020-07-31

  • 博文量
    116
  • 访问量
    88779