Fosdccf.blog.chinaunix.net
sdccf
全部博文(19283)
Linux酷软(214)
tmp(0)
PostgreSQL(93)
Solaris(383)
AIX(173)
SCOUNIX(575)
DB2(1005)
Shell(386)
C/C++(1187)
MySQL(1750)
Sybase(465)
Oracle(3695)
Informix(548)
HP-UX(0)
IBM AIX(2)
Sun Solaris(0)
BSD(1)
Linux(8597)
SCO UNIX(23)
2011年(1)
2009年(125)
2008年(19094)
2007年(63)
clifford
linky521
曾德标
fengzhan
leon_yu
mcuflowe
yt200902
guanyuji
GY123456
snow888
carlos94
丸喵喵
sean229
cxunix
可怜的猪
cqxc413
xzzgege
wb123456
分类: Oracle
2008-04-30 18:45:28
1、 修改Oracle系统配置文件/etc/oratab/etc/oratab 格式为: SID:ORACLE_HOME:AUTO把AUTO域设置为Y(大写),只有这样,oracle 自带的dbstart和dbshut才能够发挥作用。我的为:ora9i:/home/oracle/ora/products/9.2.0:Y2、 编写服务脚本:如下#!/bin/bash##################FUNCTION############### AutoStart Oracle and listener# AutoStop Oracle and listener######################################## Created by ZhouYS 2003-11-26# case "$1" instart)echo "Starting Oracle Databases ... " echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Starting Oracle Databasee as part of system up." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - oracle -c "dbstart" >> /var/log/oracleecho "Done."echo "Starting Oracle Listeners ... " echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - oracle -c "lsnrctl start" >> /var/log/oracleecho "Done."echo ""echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracletouch /var/lock/subsys/oracle;;stop)echo "Stoping Oracle Listeners ... " echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - oracle -c "lsnrctl stop" >> /var/log/oracleecho "Done."rm -f /var/lock/subsys/oracleecho "Stoping Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - oracle -c "dbshut" >>/var/log/oracleecho "Done."echo ""echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle;;restart)$0 stop$0 start;;*)echo "Usage: oracle {start|stop|restart}" exit 1esac将脚本命名为oracle,保存在/etc/rc.d/init.d下改变文件属性:chmod 755 oracle注意:在windows下编辑此文件时有DOS格式字符导致在linux下不能够正常运行,建议用gedit 或用 vi编辑3、建立服务连接:系统启动时启动数据库,我们需要以下连结∶--------------------------------------------------------------------------------$ ln -s ../init.d/oracle /etc/rc.d/rc2.d/S99oracle$ ln -s ../init.d/oracle /etc/rc.d/rc3.d/S99oracle$ ln -s ../init.d/oracle /etc/rc.d/rc5.d/S99oracle #rc4.d unused--------------------------------------------------------------------------------要在重新启动时停止数据库,我们需要以下连结∶ --------------------------------------------------------------------------------$ ln -s ../init.d/oracle /etc/rc.d/rc0.d/K01oracle # 停止$ ln -s ../init.d/oracle /etc/rc.d/rc6.d/K01oracle # 重新启动 ----------------------------------转载完----------------------------------1)在试用上述自启动文件时,出现如下错误:Can't find init file for Database "ora9i".Database "ora9i" NOT started.更正上述的错误,应修改$ORACLE_HOME/bin/dbstart文件:第55行后增加:SPFILE=${ORACLE_HOME}/dbs/spfile${ORACLE_SID}.ora第117行改为:if [ -f $PFILE -o -f $SPFILE ] ; then即可2)实际在RH AS4启动时,又出现指令挂死的情况:root 2542 1652 0 12:30 ? 00:00:00 initlog -q -c /etc/rc5.d/S99oracle startroot 2543 2542 0 12:30 ? 00:00:00 /bin/bash /etc/rc5.d/S99oracle start经查,为SElinux和su指令的冲突,可以关闭SElinux或者使用安全的sudo:将上述oracle的shell所有的su - oracle -c "xxxx"前面加上 sudo 即可,如:sudo su - oracle -c "dbstart"
原文:http://humint.blog.ccidnet.com/blog-htm-itemid-115574-do-showone-type-blog-uid-22648.html
上一篇:Tomcat连接池配置与使用(数据库 Oracle)
下一篇:漫谈oracle中的空值
登录 注册