redhat cluster的oracle script

The Oracle service example uses three scripts that must be placed in /users/oracle and owned
by the Oracle administration account. The oracle script is used to start and stop the Oracle service.
Specify this script when you add the service. This script calls the other Oracle example scripts.
The startdb and stopdb scripts start and stop the database. Note that there are many ways for an
application to interact with an Oracle database.

The following is an example of the oracle script, which is used to start, stop, and check the status of
the Oracle service.
#!/bin/sh
#
# Cluster service script to start, stop, and check status of oracle
#
cd /users/oracle
case $1 in
start)
su - oracle -c ./startdb
;;
stop)
su - oracle -c ./stopdb
;;
status)
status oracle
;;
esac
The following is an example of the startdb script, which is used to start the Oracle Database Server
instance:
#!/bin/sh
#
#
# Script to start the Oracle Database Server instance.
#
########################################################################
#
# ORACLE_RELEASE
#
# Specifies the Oracle product release.
#
########################################################################
ORACLE_RELEASE=9.2.0
########################################################################
#
# ORACLE_SID
#
# Specifies the Oracle system identifier or "sid", which is the name of
# the Oracle Server instance.
#
########################################################################
export ORACLE_SID=TEST
########################################################################
#
# 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/

release
#
########################################################################
export ORACLE_HOME=/u01/app/oracle/product/${ORACLE_RELEASE}
########################################################################
#
# 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/product/9.2.0/bin/sqlplus << EOF
sys as sysdba
spool /home/oracle/startdb.log
startup pfile = /u01/app/oracle/product/9.2.0/admin/test/scripts/init.ora open;
spool off
quit;
EOF
exit
The following is an example of the stopdb script, which is used to stop the Oracle Database Server
instance:
#!/bin/sh
#
#
# Script to STOP the Oracle Database Server instance.
#
######################################################################
#
# ORACLE_RELEASE

# Specifies the Oracle product release.
#
######################################################################
ORACLE_RELEASE=9.2.0
######################################################################
#
# ORACLE_SID
#
# Specifies the Oracle system identifier or "sid", which is the name
# of the Oracle Server instance.
#
######################################################################
export ORACLE_SID=TEST
######################################################################
#
# 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/

release
#
######################################################################
export ORACLE_HOME=/u01/app/oracle/product/${ORACLE_RELEASE}
######################################################################
#
# 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.
#
# STOP the Oracle Server instance in a tidy fashion.
#
######################################################################
/u01/app/oracle/product/9.2.0/bin/sqlplus << EOF
sys as sysdba
spool /home/oracle/stopdb.log
shutdown abort;
spool off
quit;
EOF
exit

[@more@]

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

转载于:http://blog.itpub.net/237287/viewspace-810422/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值