脚本留存,备查
Oracle10g rac add node
Step 1 Remove oifcfg information for the failed node
$CRS_HOME/bin/oifcfg getif
Step 2 Remove ONS information
cat $CRS_HOME/opmn/conf/ons.config
$CRS_HOME/bin/racgons remove_config myrac2:6200
[oracle@myrac1 ~]$ cat crsstat
#!/usr/bin/ksh
#
# Sample 10g CRS resource status query script
#
# Description:
# - Returns formatted version of crs_stat -t, in tabular
# format, with the complete rsc names and filtering keywords
# - The argument, $RSC_KEY, is optional and if passed to the script, will
# limit the output to HA resources whose names match $RSC_KEY.
# Requirements:
# - $ORA_CRS_HOME should be set in your environment
RSC_KEY=$1
QSTAT=-u
AWK=/usr/bin/awk # if not available use /usr/bin/awk
# Table header:echo ""
$AWK \
'BEGIN {printf "%-45s %-10s %-18s\n", "HA Resource", "Target", "State";
printf "%-45s %-10s %-18s\n", "-----------", "------", "-----";}'
# Table body:
/oracle/product/10.2.0/crs/bin/crs_stat $QSTAT | $AWK \
'BEGIN { FS="="; state = 0; }
$1~/NAME/ && $2~/'$RSC_KEY'/ {appname = $2; state=1};
state == 0 {next;}
$1~/TARGET/ && state == 1 {apptarget = $2; state=2;}
$1~/STATE/ && state == 2 {appstate = $2; state=3;}
state == 3 {printf "%-45s %-10s %-18s\n", appname, apptarget, appstate; state=0;}'
./crsstat |grep OFFLINE
## backup of the OCR
/oracle/product/10.2.0/crs/bin/ocrconfig -export /tmp/ocr_before_node_removal.exp
##remove db 建议dbca方式,如果使用命令,需要手动删除redo undo等文件
$ORACLE_HOME/bin/srvctl remove instance -d LC2DB1 -i LC2DB13
SQL> select username,password from dba_users where username='SYS';
USERNAME PASSWORD
------------------------------ ------------------------------
SYS 8A8F025737A9097A
SQL>
alter user sys identified by abc;
alter user sys identified by values '8A8F025737A9097A';
###Oracle10g 监听、ASM、实例可以不移除,集群重配成功后,创建ORACLE_BASE/admin/+ASM 等相关目录即可
##remove asm
crs_unregister ora.myracdb.myracdb2.inst
crs_unregister ora.myrac2.ASM2.asm
export ORACLE_SID=+ASM1
$CRS_HOME/bin/srvctl remove asm -n myrac2 ##注意目录是集群目录
##remove listener
$CRS_HOME/bin/crs_unregister ora.myrac2.LISTENER_MYRAC2.lsnr
#As user root stop the nodeapps resources
/oracle/product/10.2.0/crs/bin/srvctl stop nodeapps -n myrac2
/oracle/product/10.2.0/crs/bin/srvctl remove nodeapps -n myrac2
/oracle/product/10.2.0/crs/bin/olsnodes -n
# Execute rootdeletenode.sh
/oracle/product/10.2.0/crs/install/rootdeletenode.sh myrac2,2
/oracle/product/10.2.0/crs/bin/olsnodes -n
##Update the Inventory
$CRS_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/oracle/product/10.2.0/crs "CLUSTER_NODES={myrac1}" CRS=TRUE
#$CRS_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/oracle/product/10.2.0/asm "CLUSTER_NODES={myrac1}"
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/oracle/product/10.2.0/db_1 "CLUSTER_NODES={myrac1}"
cluvfy stage -post hwos -n oradb1,oradb5
cluvfy stage -pre crsinst -n oradb1,oradb5
###add node 图形界面方式
go to CRS_home/oui/bin and run the addNode.sh script
[root@myrac2 oracle]# /oracle/product/10.2.0/crs/root.sh
WARNING: directory '/oracle/product/10.2.0' is not owned by root
WARNING: directory '/oracle/product' is not owned by root
WARNING: directory '/oracle' is not owned by root
No value set for the CRS parameter CRS_OCR_LOCATIONS. Using Values in paramfile.crs
Checking to see if Oracle CRS stack is already configured
Oracle CRS stack is already configured and will be running under init(1M)
rm /etc/oracle/scls_scr/myrac2/oracle/
##add oracle database soft
cd /oracle/product/10.2.0/db_1/oui/bin