|
以前我在用使用oracle817的时候只要修改一下/etc/oratab文件把N该为Y 然后在
/etc/init.d下新建一个oradb的启动脚本,然后ln s rc0,rc1,rc3,rc5,rc6一下更具不同运行级来启动和关闭数据库;但到了oracle9i就发现这样作数据是不能起来的,监听可以起来,为什么呢?其实很件在启动oracle9i是还要需要两个重要的文件pfile和spfile;里面存放有oracle数据的一些基本参数SGA,db block, db cache,logfile,undo file……;所以我们必须还要修改$oracle_home/bin/dbstart文件
- add the following line:
SPFILE=/dbs/oracle/ora_ap/dbs/spfileoradb.ora[spfile+sid]
PFILE=/dbs/oracle/ora_ap/dbs/init.ora
然后就可以到/etc/init.d/目录下执行
./oradb start|stop 看看有没有成功
我oradba脚本:
#!/bin/bash
#
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
#
. /home/oracle/.bash_profile
ORA_OWNER=oracle
case "$1" in
start)
echo "Starting Oracle DataBase(s) dbstart in /etc/oratab...."
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORACLE_HOME/bin/dbstart
echo "Starting TNS listener...."
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
# Start the Intelligent Agent
if [ -f $ORA_HOME/bin/agentctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl start"
else
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_start"
fi
# Start Management Server
if [ -f $ORACLE_HOME/bin/oemctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/oemctl start oms"
fi
# Start HTTP Server
echo "Starting Oracle DataBase(s) apachectl start ..... "
if [ -f $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl start"
fi
touch /var/lock/subsys/dbora
;;
'stop')
# Stop HTTP Server
if [ -f $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl stop"
fi
# Stop Management Server
if [ -f $ORACLE_HOME/bin/oemctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/oemctl stop oms system/system"
fi
# Stop the Intelligent Agent
if [ -f $ORACLE_HOME/bin/agentctl ]; then
su - $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl stop"
else
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_stop"
fi
# Stop the TNS Listener
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/subsys/dbora
;;
esac
# End of script dbora |
|