利用Oracle CRS搭建应用的高可用集群(三)

系统 2574 0
五、总结 - 及其他说明/TIPS/文中提到的有用脚本

从上面的配置及测试我们可以看到,只要掌握了应用程序的启动、关闭、检查的方法,我们就完全可以
利用Oracle CRS来搭建一般应用程序的高可用集群,从而保证了业务的连续性。

1.简单错误处理:如果在实施或测试过程中命令失败,或者有错误需要回退状态,
或者删除资源及相关信息,可以使用下面的几个命令:
crs_stop -f db
crs_unregister db
crs_profile -delete db

错误二:我在上面启动虚拟IP资源的时候报错:
root@rac01 # crs_start –all
….
Attempting to start `havip` on member `rac01`
`havip` on member `rac01` has experienced an unrecoverable failure.
Human intervention required to resume its availability.
…..
查看crs日志:
      
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 2008 - 01 - 10 17 : 30 : 22.526 : [ CRSRES ][ 1580 ] startRunnable: setting CLI values 2008 - 01 - 10 17 : 30 : 22.527 : [ CRSRES ][ 1580 ] Attempting to start `dg` on member `rac01` 2008 - 01 - 10 17 : 30 : 22.589 : [ CRSRES ][ 1581 ] startRunnable: setting CLI values 2008 - 01 - 10 17 : 30 : 22.629 : [ CRSRES ][ 1581 ] Attempting to start `havip` on member `rac01` 2008 - 01 - 10 17 : 30 : 22.688 : [ CRSAPP ][ 1581 ] StartResource error for havip error code = 1 2008 - 01 - 10 17 : 30 : 22.749 : [ CRSAPP ][ 1581 ] StopResource error for havip error code = 1 2008 - 01 - 10 17 : 30 : 22.757 : [ CRSRES ][ 1581 ] X_OP_StopResourceFailed : Stop Resource failed ( File : rti.cpp, line: 1796 2008 - 01 - 10 17 : 30 : 22.758 : [ CRSRES ][ 1581 ][ ALERT ] `havip` on member `rac01` has experienced an ... 2008 - 01 - 10 17 : 30 : 22.758 : [ CRSRES ][ 1581 ] Human intervention required to resume its availability. 2008 - 01 - 10 17 : 30 : 23.211 : [ CRSRES ][ 1580 ] Start of `dg` on member `rac01` succeeded.
这时候发现在输入网卡时候不小心输入了错误的网卡名称,公共网卡名称应该是e1000g0,
结果使用的bge0,使用下面命令修改
root@rac01 # crs_profile -update havip -o oi=e1000g0
再次启动资源成功。

2.文中的sysdba命令是我习惯用的alias,需要在oracle的.bash_profile或者.profile中添加:
alias sysdba="sqlplus '/as sysdba'"
文中的命令crs_start/crs_stop/crs_profile/crs_register等命令位于$CRS_HOME/bin/目录下,
为了使用方面,一般需要手工将该PATH添加到root和oracle的PATH环境变量中去。

3.磁盘组的启动、关闭、监测脚本db.sh
      
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> #! / bin / sh # ***************************************************************** # shahand 2008 - 1 - 3 SCRIPT = $ 0 ACTION = $ 1 # Action (start, stop or check ) DG_NAME = oradata12 VOL_NAME = oradata case $ 1 in ' start ' ) / usr / sbin / vxdg - tfC import $DG_NAME; / usr / sbin / vxvol - g $DG_NAME startall echo "Resource STARTED" ;; ' stop ' ) / usr / sbin / vxvol - g $DG_NAME stopall; / usr / sbin / vxdg deport $DG_NAME echo "Resource STOPPED" ;; ' check ' ) if [ [ `/usr/sbin/vxprint -v -g $DG_NAME |grep $VOL_NAME|wc -c` -eq 0 ] ] then exit 1 else exit 0 fi echo "Resource CHECKED" ;; * ) echo "usage: $ 0 {start stop check }" ;; esac exit 0


4.文件系统的启动、关闭、监测脚本fs.sh

#!/bin/sh
# *****************************************************************
# shahand 2008-1-3

SCRIPT=$0
ACTION=$1 # Action (start, stop or check)

DG_NAME=oradata12
VOL_NAME=oradata


case $1 in
'start')
mount -F vxfs /dev/vx/dsk/$DG_NAME/$VOL_NAME /oradata
echo "Resource STARTED"
;;


'stop')
umount /oradata
echo "Resource STOPPED"
;;

'check')
if [[ `mount |grep $VOL_NAME |wc -c` -eq 0 ]]
then
exit 1
else
exit 0
fi
echo "Resource CHECKED"
;;

*)
echo "usage: $0 {start stop check}"
;;

esac

exit 0


5. 数据库的启动、关闭、监测脚本db.sh

#!/bin/sh
# *****************************************************************
# ## shahand 2008-1-3
# *****************************************************************
# /oracle/crs/crs/public/db.sh

SCRIPT=$0
ACTION=$1 # Action (start, stop or check)

CRS_HOME=/oracle/crs/

case $1 in
'start')
su - oracle -c "export ORACLE_SID=orcl;
sqlplus /nolog <<EOF
connect /as sysdba;
startup;
exit;
EOF"
exit $?
;;


'stop')
su - oracle -c "export ORACLE_SID=orcl;
sqlplus /nolog <<EOF1
connect /as sysdba;
alter system checkpoint;
shutdown immediate;
exit;
EOF1"
exit $?
;;

'check')
if [ ! -f $CRS_HOME/crs/public/db.sql ]
then
echo "connect /as sysdba;" > $CRS_HOME/crs/public/db.sql;
echo "spool /tmp/db_check.out;" >>$CRS_HOME/crs/public/db.sql;
echo "select status from v/$instance ;" >> $CRS_HOME/crs/public/db.sql;
echo "exit;" >> $CRS_HOME/crs/public/db.sql;
fi

su - oracle -c "export ORACLE_SID=orcl;sqlplus /nolog @$CRS_HOME/crs/public/db.sql";

if [ `cat /tmp/db_check.out|grep OPEN|wc -c` -eq 0 ]
then
exit 1
else
exit 0
fi
;;

*)
echo "usage: $0 {start stop check}"
;;

esac

exit 0

5. 监听的启动、关闭、监测脚本lsnr.sh
      
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> #! / bin / sh # ***************************************************************** # ## shahand 2008 - 1 - 3 # ***************************************************************** # / oracle / crs / crs / public / lsnr.sh SCRIPT = $ 0 ACTION = $ 1 # Action (start, stop or check ) case $ 1 in ' start ' ) su - oracle - c "lsnrctl start" exit $? ;; ' stop ' ) su - oracle - c "lsnrctl stop" exit $? ;; ' check ' ) if [ `ps -ef|grep tnslsnr |wc -c` -eq 0 ] then echo "bad"; exit 1 else echo "good"; exit 0 fi ;; * ) echo "usage: $ 0 {start stop check }" ;; esac exit 0
7.Oracle集群软件的安装响应文件crs.rsp ,其中在####之前需要修改
      
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> ORACLE_HOME = " / oracle / crs" sl_tableList = {"rac01:rac01 - priv:rac01 - vip:N:Y","rac02:rac02 - priv:rac02 - vip:N:Y"} ret_PrivIntrList = {"e1000g0: 10.198 . 88.0 : 1 ","e1000g1: 192.168 . 0.0 : 2 "} n_storageTypeOCR = 2 s_ocrpartitionlocation = " / oracle / ocrfile1" s_ocrMirrorLocation = "" n_storageTypeVDSK = 2 s_votingdisklocation = " / oracle / vdfile1" s_OcrVdskMirror1RetVal = "" s_VdskMirror2RetVal = "" ORACLE_HOME_NAME = "OraCRS10ghome1" ################# complete modify ##################### RESPONSEFILE_VERSION = 2.2 . 1.0 . 0 UNIX_GROUP_NAME = "oinstall" FROM_LOCATION = ".. / stage / products.xml" NEXT_SESSION_RESPONSE =< Value Unspecified > TOPLEVEL_COMPONENT = {"oracle.crs"," 10.2 . 0.1 . 0 "} DEINSTALL_LIST = {"oracle.crs"," 10.2 . 0.1 . 0 "} SHOW_SPLASH_SCREEN = false SHOW_WELCOME_PAGE = false SHOW_NODE_SELECTION_PAGE = false SHOW_SUMMARY_PAGE = false SHOW_INSTALL_PROGRESS_PAGE = false SHOW_CONFIG_TOOL_PAGE = false SHOW_XML_PREREQ_PAGE = false SHOW_ROOTSH_CONFIRMATION = true SHOW_END_SESSION_PAGE = false SHOW_EXIT_CONFIRMATION = false NEXT_SESSION = false NEXT_SESSION_ON_FAIL = false SHOW_DEINSTALL_CONFIRMATION = false SHOW_DEINSTALL_PROGRESS = false RESTART_SYSTEM = false RESTART_REMOTE_SYSTEM = false REMOVE_HOMES = ORACLE_HOSTNAME =< Value Unspecified > SHOW_END_OF_INSTALL_MSGS = false COMPONENT_LANGUAGES = {"en"} s_clustername = "crs" CLUSTER_CONFIGURATION_FILE = "" 8 . Oracle数据库软件的安装响应文件db.rsp,其中在####之前需要修改 CLUSTER_NODES = {} ORACLE_HOME_NAME = "OraDB10ghome1" ORACLE_HOME = " / oracle / 10g" ########################################################## FROM_LOCATION = ".. / stage / products.xml" RESPONSEFILE_VERSION = 2.2 . 1.0 . 0 UNIX_GROUP_NAME = "oinstall" FROM_LOCATION_CD_LABEL =< Value Unspecified > SHOW_WELCOME_PAGE = true SHOW_CUSTOM_TREE_PAGE = true SHOW_COMPONENT_LOCATIONS_PAGE = true SHOW_SUMMARY_PAGE = true SHOW_INSTALL_PROGRESS_PAGE = true SHOW_REQUIRED_CONFIG_TOOL_PAGE = true SHOW_CONFIG_TOOL_PAGE = true SHOW_RELEASE_NOTES = true SHOW_ROOTSH_CONFIRMATION = true SHOW_END_SESSION_PAGE = true SHOW_EXIT_CONFIRMATION = true NEXT_SESSION = false NEXT_SESSION_ON_FAIL = true NEXT_SESSION_RESPONSE =< Value Unspecified > DEINSTALL_LIST = {"oracle.server"," 10.2 . 0.1 . 0 "} SHOW_DEINSTALL_CONFIRMATION = true SHOW_DEINSTALL_PROGRESS = true ACCEPT_LICENSE_AGREEMENT = false TOPLEVEL_COMPONENT = {"oracle.server"," 10.2 . 0.1 . 0 "} SHOW_SPLASH_SCREEN = true SELECTED_LANGUAGES = {"en"} COMPONENT_LANGUAGES = {"en"} INSTALL_TYPE = "Enterprise Edition" sl_superAdminPasswds =< Value Unspecified > sl_dlgASMCfgSelectableDisks = {} s_superAdminSamePasswd =< Value Unspecified > s_globalDBName = "orcl" s_dlgASMCfgRedundancyValue = " 2 (Norm)" s_dlgASMCfgNewDisksSize = " 0 " s_dlgASMCfgExistingFreeSpace = " 0 " s_dlgASMCfgDiskGroupName = "DATA" s_dlgASMCfgDiskDiscoveryString = "" s_dlgASMCfgAdditionalSpaceNeeded = " MB" s_dbSelectedUsesASM = "" s_dbSIDSelectedForUpgrade = "" s_dbRetChar = "" s_dbOHSelectedForUpgrade = "" s_ASMSYSPassword =< Value Unspecified > n_performUpgrade = 0 n_dlgASMCfgRedundancySelected = 2 n_dbType = 1 n_dbSelection = 0 b_useSamePassword = false b_useFileSystemForRecovery = true b_receiveEmailNotification = false b_loadExampleSchemas = false b_enableAutoBackup = false b_dlgASMShowCandidateDisks = true b_centrallyManageASMInstance = true sl_dlgASMDskGrpSelectedGroup = {" "," "," "," "} s_dlgRBOUsername = "" s_dlgEMCentralAgentSelected = "No Agents Found" b_useDBControl = true s_superAdminSamePasswdAgain =< Value Unspecified > s_dlgEMSMTPServer = "" s_dlgEMEmailAddress = "" s_dlgRBORecoveryLocation = " / oracle / db / flash_recovery_area / " n_upgradeDB = 1 n_configurationOption = 3c sl_upgradableSIDBInstances = {} n_upgradeASM = 0 sl_dlgASMCfgDiskSelections = {} s_ASMSYSPasswordAgain =< Value Unspecified > n_dbStorageType = 0 s_rawDeviceMapFileLocation = "" sl_upgradableRACDBInstances = {} s_dlgRBOPassword =< Value Unspecified > b_stateOfUpgradeDBCheckbox = false s_dbSid = "orcl" b_dbSelectedUsesASM = false sl_superAdminPasswdsAgain =< Value Unspecified > s_mountPoint = " / oracle / db / oradata / " b_stateOfUpgradeASMCheckbox = false oracle.assistants.server:OPTIONAL_CONFIG_TOOLS = "{}" oracle.has.common:OPTIONAL_CONFIG_TOOLS = "{}" oracle.network.client:OPTIONAL_CONFIG_TOOLS = "{}" oracle.sqlplus.isqlplus:OPTIONAL_CONFIG_TOOLS = "{}" oracle.sysman.console.db:OPTIONAL_CONFIG_TOOLS = "{}" varSelect = 1 s_nameForOPERGrp = "dba" s_nameForDBAGrp = "dba"

利用Oracle CRS搭建应用的高可用集群(三)


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论