11g rac 删除节点和添加节点
某客户节点2本地磁盘损坏,节点1oracle数据库正常对外提供服务,更换磁盘之后需要重新把节点2加入集群。
参考mos
一、删除节点
1、在存活节点删除实例
[qdds1]@ht01[/home/oracle]$dbca -silent -deleteInstance -nodeList ht02 -gdbName qdds -instanceName qdds2 -sysDBAUserName sys -sysDBAPassword oracle Deleting instance 1% complete 2% complete 6% complete 13% complete 20% complete 26% complete 33% complete 40% complete 46% complete 53% complete 60% complete 66% complete Completing instance management. 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/qdds.log" for further details. alert日志 ALTER SYSTEM ARCHIVE LOG ALTER DATABASE DROP LOGFILE GROUP 3 Deleted Oracle managed file +DATA/qdds/onlinelog/group_3.265.1091563155 Deleted Oracle managed file +ARCH/qdds/onlinelog/group_3.259.1091563155 Completed: ALTER DATABASE DROP LOGFILE GROUP 3 ALTER DATABASE DROP LOGFILE GROUP 4 Deleted Oracle managed file +DATA/qdds/onlinelog/group_4.266.1091563155 Deleted Oracle managed file +ARCH/qdds/onlinelog/group_4.260.1091563157 Completed: ALTER DATABASE DROP LOGFILE GROUP 4 DROP TABLESPACE UNDOTBS2 INCLUDING CONTENTS AND DATAFILES Deleted Oracle managed file +DATA/qdds/datafile/undotbs2.264.1091563107 Completed: DROP TABLESPACE UNDOTBS2 INCLUDING CONTENTS AND DATAFILES ALTER SYSTEM RESET undo_tablespace SCOPE=SPFILE SID='qdds2'; ALTER SYSTEM RESET instance_number SCOPE=SPFILE SID='qdds2';
ALTER SYSTEM RESET thread SCOPE=SPFILE SID='qdds2';
2、停止节点2的集群资源
srvctl stop nodeapps -n ht02 -f
如果是正常移除节点
$ORACLE_HOME/crs/install/rootcrs.pl -delete -force
3、检查节点状态
[+ASM1]@ht01[/u01/app/grid/oui/bin]$olsnodes -s -t
ht01 Active Unpinned
ht02 Inactive Unpinned
如果是pinned,请设为Unpinned
crsctl unpin css -n ht02
4、存活的节点上删除被删除节点的信息
/u01/app/grid/bin/crsctl delete node -n ht02
5、正常移除节点删除软件
$ORACLE_HOME/deinstall/deinstall -local
6、存活的节点上更新节点列表信息
su - grid
cd $ORACLE_HOME/oui/bin
./runInstaller -updateNodeList ORACLE_HOME=/u01/app/grid "CLUSTER_NODES={ht01}" CRS=TRUE -silent -local
su - oracle
cd $ORACLE_HOME/oui/bin
./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1 "CLUSTER_NODES={ht01}" CRS=TRUE -silent -local
7、验证从集群中删除指定节点
cluvfy stage -post nodedel -n ht02
[+ASM1]@ht01[/home/grid]$cluvfy stage -post nodedel -n ht02
Performing post-checks for node removal
Checking CRS integrity...
Clusterware version consistency passed
CRS integrity check passed
Node removal check passed
Post-check for node removal was successful.
二、添加节点
1、cluvfy验证添加节点的条件是否满足
--添加节点预验证
cluvfy stage -pre nodeadd -n ht02 -fixup -verbose
cluvfy stage -post hwos -n ht02
--对比2个节点的配置
cluvfy comp peer -refnode ht01 -n ht02 -orainv oinstall -osdba oinstall-verbose
2、grid添加节点
创建目录及授权
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/grid
chown -R grid:oinstall /u01/app
chmod -R 777 /u01/app
export IGNORE_PREADDNODE_CHECKS=Y
cd $ORACLE_HOME/oui/bin
./addNode.sh -silent "CLUSTER_NEW_NODES={ht02}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={ht02-vip}" "CLUSTER_NEW_PRIVATE_NODE_NAMES={ht02-prv}"
[+ASM1]@ht01[/u01/app/grid/oui/bin]$./addNode.sh -silent "CLUSTER_NEW_NODES={ht02}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={ht02-vip}" "CLUSTER_NEW_PRIVATE_NODE_NAMES={ht02-prv}" Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 5119 MB Passed Oracle Universal Installer, Version 11.2.0.4.0 Production Copyright (C) 1999, 2013, Oracle. All rights reserved. Performing tests to see whether nodes ht02 are available ............................................................... 100% Done. . ----------------------------------------------------------------------------- Cluster Node Addition Summary Global Settings Source: /u01/app/grid New Nodes Space Requirements New Nodes ht02 /: Required 5.14GB : Available 35.90GB Installed Products Product Names Oracle Grid Infrastructure 11g 11.2.0.4.0 Java Development Kit 1.5.0.51.10 Installer SDK Component 11.2.0.4.0 Oracle One-Off Patch Installer 11.2.0.3.4 Oracle Universal Installer 11.2.0.4.0 Oracle RAC Required Support Files-HAS 11.2.0.4.0 Oracle USM Deconfiguration 11.2.0.4.0 Oracle Configuration Manager Deconfiguration 10.3.1.0.0 Enterprise Manager Common Core Files 10.2.0.4.5 Oracle DBCA Deconfiguration 11.2.0.4.0 Oracle RAC Deconfiguration 11.2.0.4.0 Oracle Quality of Service Management (Server) 11.2.0.4.0 Installation Plugin Files 11.2.0.4.0 Universal Storage Manager Files 11.2.0.4.0 Oracle Text Required Support Files 11.2.0.4.0 Automatic Storage Management Assistant 11.2.0.4.0 Oracle Database 11g Multimedia Files 11.2.0.4.0 Oracle Multimedia Java Advanced Imaging 11.2.0.4.0 Oracle Globalization Support 11.2.0.4.0 Oracle Multimedia Locator RDBMS Files 11.2.0.4.0 Oracle Core Required Support Files 11.2.0.4.0 Bali Share 1.1.18.0.0 Oracle Database Deconfiguration 11.2.0.4.0 Oracle Quality of Service Management (Client) 11.2.0.4.0 Expat libraries 2.0.1.0.1 Oracle Containers for Java 11.2.0.4.0 Perl Modules 5.10.0.0.1 Secure Socket Layer 11.2.0.4.0 Oracle JDBC/OCI Instant Client 11.2.0.4.0 Oracle Multimedia Client Option 11.2.0.4.0 LDAP Required Support Files 11.2.0.4.0 Character Set Migration Utility 11.2.0.4.0 Perl Interpreter 5.10.0.0.2 PL/SQL Embedded Gateway 11.2.0.4.0 OLAP SQL Scripts 11.2.0.4.0 Database SQL Scripts 11.2.0.4.0 Oracle Extended Windowing Toolkit 3.4.47.0.0 SSL Required Support Files for InstantClient 11.2.0.4.0 SQL*Plus Files for Instant Client 11.2.0.4.0 Oracle Net Required Support Files 11.2.0.4.0 Oracle Database User Interface 2.2.13.0.0 RDBMS Required Support Files for Instant Client 11.2.0.4.0 RDBMS Required Support Files Runtime 11.2.0.4.0 XML Parser for Java 11.2.0.4.0 Oracle Security Developer Tools 11.2.0.4.0 Oracle Wallet Manager 11.2.0.4.0 Enterprise Manager plugin Common Files 11.2.0.4.0 Platform Required Support Files 11.2.0.4.0 Oracle JFC Extended Windowing Toolkit 4.2.36.0.0 RDBMS Required Support Files 11.2.0.4.0 Oracle Ice Browser 5.2.3.6.0 Oracle Help For Java 4.2.9.0.0 Enterprise Manager Common Files 10.2.0.4.5 Deinstallation Tool 11.2.0.4.0 Oracle Java Client 11.2.0.4.0 Cluster Verification Utility Files 11.2.0.4.0 Oracle Notification Service (eONS) 11.2.0.4.0 Oracle LDAP administration 11.2.0.4.0 Cluster Verification Utility Common Files 11.2.0.4.0 Oracle Clusterware RDBMS Files 11.2.0.4.0 Oracle Locale Builder 11.2.0.4.0 Oracle Globalization Support 11.2.0.4.0 Buildtools Common Files 11.2.0.4.0 HAS Common Files 11.2.0.4.0 SQL*Plus Required Support Files 11.2.0.4.0 XDK Required Support Files 11.2.0.4.0 Agent Required Support Files 10.2.0.4.5 Parser Generator Required Support Files 11.2.0.4.0 Precompiler Required Support Files 11.2.0.4.0 Installation Common Files 11.2.0.4.0 Required Support Files 11.2.0.4.0 Oracle JDBC/THIN Interfaces 11.2.0.4.0 Oracle Multimedia Locator 11.2.0.4.0 Oracle Multimedia 11.2.0.4.0 Assistant Common Files 11.2.0.4.0 Oracle Net 11.2.0.4.0 PL/SQL 11.2.0.4.0 HAS Files for DB 11.2.0.4.0 Oracle Recovery Manager 11.2.0.4.0 Oracle Database Utilities 11.2.0.4.0 Oracle Notification Service 11.2.0.3.0 SQL*Plus 11.2.0.4.0 Oracle Netca Client 11.2.0.4.0 Oracle Advanced Security 11.2.0.4.0 Oracle JVM 11.2.0.4.0 Oracle Internet Directory Client 11.2.0.4.0 Oracle Net Listener 11.2.0.4.0 Cluster Ready Services Files 11.2.0.4.0 Oracle Database 11g 11.2.0.4.0 ----------------------------------------------------------------------------- Instantiating scripts for add node (Friday, May 20, 2022 3:12:31 AM CST) . 1% Done. Instantiation of add node scripts complete Copying to remote nodes (Friday, May 20, 2022 3:12:34 AM CST) ............................................................................................... 96% Done. Home copied to new nodes Saving inventory on nodes (Friday, May 20, 2022 3:17:10 AM CST) . 100% Done. Save inventory complete WARNING: The following configuration scripts need to be executed as the "root" user in each new cluster node. Each script in the list below is followed by a list of nodes. /u01/app/grid/root.sh #On nodes ht02 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 /u01/app/grid was successful. Please check '/tmp/silentInstall.log' for more details. [root@ht02 11.2.0]# /u01/app/grid/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/grid 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. Using configuration parameter file: /u01/app/grid/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation Installing Trace File Analyzer OLR initialization - successful Adding Clusterware entries to inittab CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node ht01, 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 ht02, VIP name ht02-vip PRKO-2420 : VIP is already started on node(s): ht02 Configure Oracle Grid Infrastructure for a Cluster ... succeeded
3、添加oracle软件
节点2创建目录及权限
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/product/19c/dbhome_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
su - oracle
cd $ORACLE_HOME/oui/bin
export IGNORE_PREADDNODE_CHECKS=Y
./addNode.sh -silent "CLUSTER_NEW_NODES={ht02}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={ht02-vip}"
[qdds1]@ht01[/u01/app/oracle/product/19c/dbhome_1/oui/bin]$./addNode.sh -silent "CLUSTER_NEW_NODES={ht02}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={ht02-vip}" Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 5119 MB Passed Oracle Universal Installer, Version 11.2.0.4.0 Production Copyright (C) 1999, 2013, Oracle. All rights reserved. Performing tests to see whether nodes ht02 are available ............................................................... 100% Done. . ----------------------------------------------------------------------------- Cluster Node Addition Summary Global Settings Source: /u01/app/oracle/product/19c/dbhome_1 New Nodes Space Requirements New Nodes ht02 /: Required 4.55GB : Available 31.81GB Installed Products Product Names Oracle Database 11g 11.2.0.4.0 Java Development Kit 1.5.0.51.10 Installer SDK Component 11.2.0.4.0 Oracle One-Off Patch Installer 11.2.0.3.4 Oracle Universal Installer 11.2.0.4.0 Oracle USM Deconfiguration 11.2.0.4.0 Oracle Configuration Manager Deconfiguration 10.3.1.0.0 Oracle DBCA Deconfiguration 11.2.0.4.0 Oracle RAC Deconfiguration 11.2.0.4.0 Oracle Database Deconfiguration 11.2.0.4.0 Oracle Configuration Manager Client 10.3.2.1.0 Oracle Configuration Manager 10.3.8.1.0 Oracle ODBC Driverfor Instant Client 11.2.0.4.0 LDAP Required Support Files 11.2.0.4.0 SSL Required Support Files for InstantClient 11.2.0.4.0 Bali Share 1.1.18.0.0 Oracle Extended Windowing Toolkit 3.4.47.0.0 Oracle JFC Extended Windowing Toolkit 4.2.36.0.0 Oracle Real Application Testing 11.2.0.4.0 Oracle Database Vault J2EE Application 11.2.0.4.0 Oracle Label Security 11.2.0.4.0 Oracle Data Mining RDBMS Files 11.2.0.4.0 Oracle OLAP RDBMS Files 11.2.0.4.0 Oracle OLAP API 11.2.0.4.0 Platform Required Support Files 11.2.0.4.0 Oracle Database Vault option 11.2.0.4.0 Oracle RAC Required Support Files-HAS 11.2.0.4.0 SQL*Plus Required Support Files 11.2.0.4.0 Oracle Display Fonts 9.0.2.0.0 Oracle Ice Browser 5.2.3.6.0 Oracle JDBC Server Support Package 11.2.0.4.0 Oracle SQL Developer 11.2.0.4.0 Oracle Application Express 11.2.0.4.0 XDK Required Support Files 11.2.0.4.0 RDBMS Required Support Files for Instant Client 11.2.0.4.0 SQLJ Runtime 11.2.0.4.0 Database Workspace Manager 11.2.0.4.0 RDBMS Required Support Files Runtime 11.2.0.4.0 Oracle Globalization Support 11.2.0.4.0 Exadata Storage Server 11.2.0.1.0 Provisioning Advisor Framework 10.2.0.4.3 Enterprise Manager Database Plugin -- Repository Support 11.2.0.4.0 Enterprise Manager Repository Core Files 10.2.0.4.5 Enterprise Manager Database Plugin -- Agent Support 11.2.0.4.0 Enterprise Manager Grid Control Core Files 10.2.0.4.5 Enterprise Manager Common Core Files 10.2.0.4.5 Enterprise Manager Agent Core Files 10.2.0.4.5 RDBMS Required Support Files 11.2.0.4.0 regexp 2.1.9.0.0 Agent Required Support Files 10.2.0.4.5 Oracle 11g Warehouse Builder Required Files 11.2.0.4.0 Oracle Notification Service (eONS) 11.2.0.4.0 Oracle Text Required Support Files 11.2.0.4.0 Parser Generator Required Support Files 11.2.0.4.0 Oracle Database 11g Multimedia Files 11.2.0.4.0 Oracle Multimedia Java Advanced Imaging 11.2.0.4.0 Oracle Multimedia Annotator 11.2.0.4.0 Oracle JDBC/OCI Instant Client 11.2.0.4.0 Oracle Multimedia Locator RDBMS Files 11.2.0.4.0 Precompiler Required Support Files 11.2.0.4.0 Oracle Core Required Support Files 11.2.0.4.0 Sample Schema Data 11.2.0.4.0 Oracle Starter Database 11.2.0.4.0 Oracle Message Gateway Common Files 11.2.0.4.0 Oracle XML Query 11.2.0.4.0 XML Parser for Oracle JVM 11.2.0.4.0 Oracle Help For Java 4.2.9.0.0 Installation Plugin Files 11.2.0.4.0 Enterprise Manager Common Files 10.2.0.4.5 Expat libraries 2.0.1.0.1 Deinstallation Tool 11.2.0.4.0 Oracle Quality of Service Management (Client) 11.2.0.4.0 Perl Modules 5.10.0.0.1 JAccelerator (COMPANION) 11.2.0.4.0 Oracle Containers for Java 11.2.0.4.0 Perl Interpreter 5.10.0.0.2 Oracle Net Required Support Files 11.2.0.4.0 Secure Socket Layer 11.2.0.4.0 Oracle Universal Connection Pool 11.2.0.4.0 Oracle JDBC/THIN Interfaces 11.2.0.4.0 Oracle Multimedia Client Option 11.2.0.4.0 Oracle Java Client 11.2.0.4.0 Character Set Migration Utility 11.2.0.4.0 Oracle Code Editor 1.2.1.0.0I PL/SQL Embedded Gateway 11.2.0.4.0 OLAP SQL Scripts 11.2.0.4.0 Database SQL Scripts 11.2.0.4.0 Oracle Locale Builder 11.2.0.4.0 Oracle Globalization Support 11.2.0.4.0 SQL*Plus Files for Instant Client 11.2.0.4.0 Required Support Files 11.2.0.4.0 Oracle Database User Interface 2.2.13.0.0 Oracle ODBC Driver 11.2.0.4.0 Oracle Notification Service 11.2.0.3.0 XML Parser for Java 11.2.0.4.0 Oracle Security Developer Tools 11.2.0.4.0 Oracle Wallet Manager 11.2.0.4.0 Cluster Verification Utility Common Files 11.2.0.4.0 Oracle Clusterware RDBMS Files 11.2.0.4.0 Oracle UIX 2.2.24.6.0 Enterprise Manager plugin Common Files 11.2.0.4.0 HAS Common Files 11.2.0.4.0 Precompiler Common Files 11.2.0.4.0 Installation Common Files 11.2.0.4.0 Oracle Help for the Web 2.0.14.0.0 Oracle LDAP administration 11.2.0.4.0 Buildtools Common Files 11.2.0.4.0 Assistant Common Files 11.2.0.4.0 Oracle Recovery Manager 11.2.0.4.0 PL/SQL 11.2.0.4.0 Generic Connectivity Common Files 11.2.0.4.0 Oracle Database Gateway for ODBC 11.2.0.4.0 Oracle Programmer 11.2.0.4.0 Oracle Database Utilities 11.2.0.4.0 Enterprise Manager Agent 10.2.0.4.5 SQL*Plus 11.2.0.4.0 Oracle Netca Client 11.2.0.4.0 Oracle Multimedia Locator 11.2.0.4.0 Oracle Call Interface (OCI) 11.2.0.4.0 Oracle Multimedia 11.2.0.4.0 Oracle Net 11.2.0.4.0 Oracle XML Development Kit 11.2.0.4.0 Oracle Internet Directory Client 11.2.0.4.0 Database Configuration and Upgrade Assistants 11.2.0.4.0 Oracle JVM 11.2.0.4.0 Oracle Advanced Security 11.2.0.4.0 Oracle Net Listener 11.2.0.4.0 Oracle Enterprise Manager Console DB 11.2.0.4.0 HAS Files for DB 11.2.0.4.0 Oracle Text 11.2.0.4.0 Oracle Net Services 11.2.0.4.0 Oracle Database 11g 11.2.0.4.0 Oracle OLAP 11.2.0.4.0 Oracle Spatial 11.2.0.4.0 Oracle Partitioning 11.2.0.4.0 Enterprise Edition Options 11.2.0.4.0 ----------------------------------------------------------------------------- Instantiating scripts for add node (Tuesday, May 24, 2022 3:30:15 PM CST) . 1% Done. Instantiation of add node scripts complete Copying to remote nodes (Tuesday, May 24, 2022 3:30:18 PM CST) ............................................................................................... 96% Done. Home copied to new nodes Saving inventory on nodes (Tuesday, May 24, 2022 3:35:55 PM CST) . 100% Done. Save inventory complete WARNING: The following configuration scripts need to be executed as the "root" user in each new cluster node. Each script in the list below is followed by a list of nodes. /u01/app/oracle/product/19c/dbhome_1/root.sh #On nodes ht02 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 /u01/app/oracle/product/19c/dbhome_1 was successful. Please check '/tmp/silentInstall.log' for more details. /u01/app/oracle/product/19c/dbhome_1/root.sh
4、集群添加实例
[qdds1]@ht01[/home/oracle]$srvctl add instance -d qdds -i qdds2 -n ht02
[qdds1]@ht01[/home/oracle]$srvctl config database -d qdds
Database unique name: qdds
Database name: qdds
Oracle home: /u01/app/oracle/product/19c/dbhome_1
Oracle user: oracle
Spfile: +DATA/qdds/spfileqdds.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: qdds
Database instances: qdds1,qdds2
Disk Groups: DATA,ARCH
Mount point paths:
Services:
Type: RAC
Database is administrator managed
5、dbca添加实例
[qdds2]@ht02[/home/oracle]$dbca -silent -addInstance -nodeList ht02 -gdbName qdds -instanceName qdds2 -sysDBAUserName sys -sysDBAPassword oracle
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/qdds.log" for further details.
6、添加undo及redo
alter database add logfile thread 2 group 3 size 524288000;
alter database add logfile thread 2 group 4 size 524288000;
ALTER DATABASE enable THREAD 2;
create undo tablespace UNDOTBS2 datafile size 115343360 autoextend on;
7、修改pfile
create pfile='/home/oracle/pfile20220520' from spfile
主要是把节点2信息添加进去
qdds1.thread=1
qdds2.thread=2
qdds1.undo_tablespace='UNDOTBS1'
qdds2.undo_tablespace='UNDOTBS2'
qdds1.instance_number=1
qdds2.instance_number=2
8、创建spfile
[qdds1]@ht01[/home/oracle]$srvctl config database -d qdds
Database unique name: qdds
Database name: qdds
Oracle home: /u01/app/oracle/product/19c/dbhome_1
Oracle user: oracle
Spfile: +DATA/qdds/spfileqdds.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: qdds
Database instances: qdds1
Disk Groups: DATA,ARCH
Mount point paths:
Services:
Type: RAC
Database is administrator managed
startup nomount pfile='/home/oracle/pfile20220520'
create spfile='+DATA' from pfile='/home/oracle/pfile20220520';
asmcmd rm +DATA/QDDS/spfileqdds.ora
asmcmd mkalias +DATA/QDDS/PARAMETERFILE/spfile.268.1105527839 spfileqdds.ora
srvctl stop database -d qdds
srvctl start database -d qdds