ºìÁªLinuxÃÅ»§
Linux°ïÖú

Redhat as4 ÏÂoracle10g×ÔÆô¶¯½Å±¾ÉèÖÃ

·¢²¼Ê±¼ä:2008-02-14 20:44:17À´Ô´:ºìÁª×÷Õß:Lynghu
Ô­´´£ºRyan
¹ØÓÚoracleÔÚlinuxϵͳÏ°²×°ºó£¬ÈçºÎÔÚϵͳÖØÆôµÄÇé¿öÏÂÈ÷þÎñ×Ô¶¯Æô¶¯ÆðÀ´£¬ÍøÉÏÓкܶàµÄ½Ì³ÌºÍÏֳɵĽű¾£¬ÕâÀïÖ»ÊǸöÈ˹¤×÷ÖеÄÒ»µã¾­Ñé¡£

ÒÔredhat as4ºÍoracle 10gΪÀý¡£µ¥»úÔÚ°²×°¹ý³ÌÒÀÕÕoracle¹Ù·½µÄÎĵµÒ»²½²½ÏÂÀ´£¬Ö»ÒªÉèÖúòÎÊý¡¢°²×°ºÃ±ØÒªµÄ°ü£¬Ò»°ã²»»á³öʲôÎÊÌâ¡£°²×°ºÃÁËÒÔºóϵͳÖØÆô£¬oracleÖØÆô·þÎñ£¬ÍøÉϺܶàÈ˽¨Òé×Ô¼ºÐ´½Å±¾£¨Æäʵ½Å±¾Ò²ºÜ¼òµ¥£©£¬ÕâÀï½²µÄÊÇÓÃoracle±¾ÉíµÄ½Å±¾ÊµÏÖ£¬µ±È»²»¿É±ÜÃâ×îºó»¹ÒªÐ´Ò»µãµãµÄ¡£

1¡¢ÅäÖÃdbstartºÍdbshut

ÔÚ$ORACLE_HOME/binÖУ¬ÓÐdbstartºÍdbshutÕâÁ½¸ö½Å±¾£¬more dbstart¿´Ò»Ï¿ÉÒÔ¿´µ½£º

ÒýÓÃ:
#
# $Id: dbstart.sh.pp 11-may-2005.18:18:07 vikrkuma Exp $
# Copyright (c) 1991, 2005, Oracle. All rights reserved.
#

###################################
#
# usage: dbstart
#
# This script is used to start ORACLE from /etc/rc(.local).
# It should ONLY be executed as part of the system boot procedure.
#
# This script will start all databases listed in the oratab file
# whose third field is a "Y". If the third field is set to "Y" and
# there is no ORACLE_SID for an entry (the first field is a *),
# then this script will ignore that entry.
#
# This script requires that ASM ORACLE_SID's start with a +, and
# that non-ASM instance ORACLE_SID's do not start with a +.
#
# If ASM instances are to be started with this script, it cannot
# be used inside an rc*.d directory, and should be invoked from
# rc.local only. Otherwise, the CSS service may not be available
# yet, and this script will block init from completing the boot
# cycle.
#
# Note:
# Use ORACLE_TRACE=T for tracing this script.
#
# The progress log for each instance bringup plus Error and Warning message[s]
# are logged in file $ORACLE_HOME/startup.log. The error messages related to
# instance bringup are also logged to syslog (system log module).
# The Listener log is located at $ORACLE_HOME_LISTNER/listener.log
......


¿ÉÒÔ¿´³öÕâ¸ö½Å±¾ÊÇÓÃÀ´Æô¶¯oracle·þÎñµÄ£¬°üÀ¨listener¡¢instance¡¢asm instances£¬²¢ÇÒ¿ÉÒԷŵ½/etc/rc(.local).£¬Í¬ÑùdbshutÒ²ÊÇÆ𵽹رշþÎñµÄ×÷Óá£

ÅäÖÃϵͳʹÕâ¸ö½Å±¾Æð×÷Óãº

1£©¡¢ÒÔroot±à¼­/etc/oratab£¬ÀàËÆ orcl:/u01/product/10.2.0/db_1:N ÕâÖÖ¸ñʽ£¬ÆäÖÐorclÊÇÄãµÄORACLE_SID£¬/u01/product/10.2.0/db_1ÊÇORACLE_HOME£¬ÕâÀïÐèÒª°ÑN¸ÄΪY£¬¼´orcl:/u01/product/10.2.0/db_1:YÕâÑù¡£

2£©¡¢ÒÔoracle±à¼­$ORACLE_HOME/bin/dbstart£¬ÕÒµ½ÆäÖеÚ78ÐÐ:ORACLE_HOME_LISTNER=¸ÄΪÄã×Ô¼ºµÄ·¾¶£¬»òÕß¿ÉÒԸijÉORACLE_HOME_LISTNER=$ORACLE_HOME

±£´æ½Å±¾£¬ÒÔoracleÓû§ÔËÐÐdbshutºÍdbstart¿´ÊÇ·ñÄܹرա¢Æô¶¯Êý¾Ý¿â¡£Èç¹û²»ÄÜ£¬Ò»°ãÊDzÎÊýÉèÖ㬸ù¾Ý±¨´íÕÒµ½¶ÔӦλÖøü¸Ä¡£

2¡¢°ÑdbstartºÍdbshut¼Óµ½redhatÆô¶¯·þÎñÖÐ

¾­¹ýÉÏÒ»²½µÄÅäÖ㬿ÉÒÔÖ±½ÓÓÃdbstartÃüÁîÆô¶¯Êý¾Ýlistener¡¢instance¡¢asm instances£¬µ«ÊÇ»¹Ã»ÓÐÆô¶¯oracle10gµÄEM£¬ORACLEÀûÓÃwebÒ³Ãæ¹ÜÀíÊý¾Ý¿âÏ൱·½±ã£¬Ò²ÊÇ10gµÄÒ»¸öÌØÉ«£¬ËùÒÔÓ¦¸ÃÒ»²¢Æô¶¯Æð¸Ã·þÎñÀ´¡£

ÒýÓÃ:
$ORACLE_HOME/bin/emctl start dbconsole


Òò´ËÎÒÃÇ¿ÉÒÔÓÃrc.local»òÕßredhat·þÎñ¶¼¿ÉÒÔʵÏÖÒªÇóµÄ¿ª»úÆô¶¯¡£ÏÂÃæ·Ö±ð˵һÏ£º

1£©¡¢ÀûÓÃrc.local¡£Ö±½Ó°Ñdbstart¼Óµ½rc.localÖУ¬ÊµÏÖ¿ª»ú×Ô¶¯Æô¶¯¡£ÕâÀïÐèҪעÒâµÄÊDZØÐëÒÔoracleÆô¶¯¸Ã½Å±¾¡£

ÓÃroot±à¼­/etc/rc.local£¬Ìí¼ÓÏÂÃæÒ»ÐУº

ÒýÓÃ:
su - oracle -c "/u01/product/10.2.0/db_1/bin/dbstart"
su - oracle -c "/u01/product/10.2.0/db_1/bin/emctl start dbconsole"


ÕâÀï/u01/product/10.2.0/db_1ÐèÒªÌæ»»³Éʵ¼ÊµÄORACLE_HOME

±£´æ²¢Í˳öºó£¬reboot·þÎñÆ÷²âÊÔһϣ¬¿ÉÒÔ¿´µ½£¬µ±ÏµÍ³Æô¶¯ÒÔºóoracle¼àÌý¡¢ÊµÀýºÍem¶¼ÒѾ­ÆðÀ´ÁË

2£©¡¢Èç¹ûÎÒÃDz»ÓÃrc.local£¬Ò²¿ÉÒÔ¼Óµ½redhat·þÎñÖС£ÔÚ/etc/rc.d/init.dÖÐÌí¼ÓÈçϽű¾Îļþ£¬ÃüÃûΪoracle£º

ÒýÓÃ:
#!/bin/sh
#chkconfig: 2345 99 01
#description: ORACLE 10g Server

ORACLE_HOME=/u01/product/10.2.0/db_1

if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "ORACLE cannot start"
exit
fi

case "$1" in
'start')
echo "Starting Oracle Database..."
su - oracle -c "$ORACLE_HOME/bin/dbstart"
su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
;;
'stop')
echo "Stoping Oracle Database"
su - oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole"
su - oracle -c "$ORACLE_HOME/bin/dbshut"
;;
esac


×¢ÒâÆäÖÐÁ½ÐÐ×¢ÊÍ£¬ÍøÉϺܶà½Å±¾ÒòΪÉÙÁËÕâÁ½Ðв»ÄÜʹ·þÎñ×ÔÆô¶¯£º

ÒýÓÃ:
#chkconfig: 2345 99 01
#description: ORACLE 10g Server


ÆäÖÐchkconfig£º2345 99 01 ÊÇÖ¸½Å±¾½«ÎªÔËÐм¶2¡¢3¡¢4¡¢5Æô¶¯oracle 10g·þÎñ£¬Æô¶¯ÓÅÏȼ¶Îª99£¬¹Ø±ÕÓÅÏȼ¶Îª01¡£

È»ºóÒÔrootȨÏÞ:

ÒýÓÃ:
# cd /etc/rc2.d
# ln -s /etc/rc.d/init.d/oracle S99oracle
# chkconfig --list oracle
# chkconfig --level 2345 on


ÖØÆôϵͳ£¬¾Í¿ÉÒÔÔÚÆô¶¯µÄ¹ý³ÌÖп´µ½ Starting oracle£¬ÒòΪÎÒÃÇÉèÖõÄÓÅÏȼ¶Îª99£¬Ò»°ãÊÇ×îºóÆô¶¯¡£[OK]ÒÔºó¾Í¿ÉÒÔÁË¡£ÒòΪҪÆô¶¯emctl£¬¿ÉÄÜÓеãÂý£¬µÈ´ýµÄʱ¼äÒªÉÔ΢³¤Ò»µã¡£

Æô¶¯ÒÔºó¿ÉÒÔÒÔrootÖ´ÐÐoracle start»òÕßoracle stopÀ´Æô¶¯»òÍ£Ö¹·þÎñ¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ