LoveUnix » 其他UNIX & Linux » 关于REDHAT CLUSTER FOR ORACLE的问题
让LU留住您的每

一天 让LU博客留住您的每一天
2007-3-9 09:25 cyr1974
关于REDHAT CLUSTER FOR ORACLE的问题

[font=Verdana][size=12px]近日托朋友要求装一套oracle 10g for redhat cluster es4.0,双机热备,单机工作一切正常,但是因对redhat cluster不是很熟悉,在调用oracle启动时出现双机来回切换,估计是启动脚本状态检测出现问题,不太明白redhat cluster要求状态检测的返回值为什么?大家能否给提个醒。
下面是我的脚本分三部分:
[/size][/font]
[font=Verdana]oradb:cluster调用的主脚本
# copyright: Written by chenyongrui, free to distribute.
# You must keep everything in this file, including the copyright
# announcement.

#!/bin/sh
#
# Cluster service script to start/stop oracle
#

. /etc/rc.d/init.d/functions

cd /home/oracle

case $1 in
'start')
su - oracle -c "./startdb"
;;
'stop')
su - oracle -c "./stopdb"
;;
'status')
status oracle
;;
esac

对状态检测比较怀疑,我自己写脚本该返回什么值给它?

dbstart:

#startdb脚本内容:
#!/bin/sh
#
# copyright: Written by chenyongrui, free to distribute.
# You must keep everything in this file, including the copyright
# announcement.
#
# Script to start the Oracle Database Server instance.
#
########################################################################
#
# ORACLE_RELEASE
#
# Specifies the Oracle product release.
#
########################################################################

# ORACLE_RELEASE=10.2.0

########################################################################
#
# ORACLE_SID
#
# Specifies the Oracle system identifier or "sid", which is the name of
# the Oracle Server instance.
#
########################################################################

export ORACLE_SID=sid

########################################################################
#
# ORACLE_BASE
#
# Specifies the directory at the top of the Oracle software product and
# administrative file structure.
#
########################################################################

export ORACLE_BASE=/u01/app/oracle

########################################################################
#
# ORACLE_HOME
#
# Specifies the directory containing the software for a given release.
# The Oracle recommended value is $ORACLE_BASE/product/
#
########################################################################

export ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1

########################################################################
#
# LD_LIBRARY_PATH
#
# Required when using Oracle products that use shared libraries.
#
########################################################################

export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:$LD_LIBRARY_PATH

########################################################################
#
# PATH
#
# Verify that the users search path includes $ORACLE_HOME/bin
#
########################################################################

export PATH=$PATH:${ORACLE_HOME}/bin

########################################################################
#
# This does the actual work.
#
# Start the Oracle Server instance based on the initSID.ora
# initialization parameters file specified.
#
########################################################################

/u01/app/oracle/oracle/product/10.2.0/db_1/bin/sqlplus << EOF
connect / as sysdba
spool /home/oracle/startdb.log
startup;
spool off
quit;
EOF

exit


#stopdb脚本内容:
#!/bin/sh
#
# copyright: Written by chenyongrui, free to distribute.
# You must keep everything in this file, including the copyright
# announcement.

# Script to start the Oracle Database Server instance.
#
########################################################################
#
# ORACLE_RELEASE
#
# Specifies the Oracle product release.
#
########################################################################

# ORACLE_RELEASE=10.2.0

########################################################################
#
# ORACLE_SID
#
# Specifies the Oracle system identifier or "sid", which is the name of
# the Oracle Server instance.
#
########################################################################

export ORACLE_SID=double

########################################################################
#
# ORACLE_BASE
#
# Specifies the directory at the top of the Oracle software product and
# administrative file structure.
#
########################################################################

export ORACLE_BASE=/u01/app/oracle

########################################################################
#
# ORACLE_HOME
#
# Specifies the directory containing the software for a given release.
# The Oracle recommended value is $ORACLE_BASE/product/
#
########################################################################

export ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1

########################################################################
#
# LD_LIBRARY_PATH
#
# Required when using Oracle products that use shared libraries.
#
########################################################################

export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:$LD_LIBRARY_PATH

########################################################################
#
# PATH
#
# Verify that the users search path includes $ORACLE_HOME/bin
#
########################################################################

export PATH=$PATH:${ORACLE_HOME}/bin

########################################################################
#
# This does the actual work.
#
# Start the Oracle Server instance based on the initSID.ora
# initialization parameters file specified.
#
########################################################################

/u01/app/oracle/oracle/product/10.2.0/db_1/bin/sqlplus << EOF
conn / as sysdba
spool /home/oracle/stopdb.log
shutdown abort;
spool off
quit;
EOF

exit

多谢![/font]

2007-4-26 17:20 sunfan
看看你的fence

2007-5-18 16:30 视频会议
返回0是成功的.

2007-5-19 12:17 oraix
status这部分脚本处理有问题
直接exit 0是最简单的做法
或者用一些简单的命令获取oracle的状态比如
ps -ef|grep -v grep | grep ora_ > /dev/null
将该命令的放回码作为脚本status部分的返回码

2007-5-22 16:10 charly
建议到metalink招招,有没有标准的stepbystep,有的话就方便很多

2007-5-22 19:17 oraix
其实CLUSTER SUITE自带的文档就有很详细的说明,还有oracle脚本的模板

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.