CentOS将oracle设置为自动启动
1、
#
# thisfileisusedbyoracleutilities.itiscreatedbyroot.sh
# andupdatedbythedatabaseconfigurationassistantwhencreating
# a数据库。
# A colon,' : ',isusedasthefieldterminator.anewlineterminates
# theentry.linesbeginningwithapoundsign,' # ',are comments。
#
#入口are of the form :
# $ Oracle _ sid : $ Oracle _ home :3360
#
# thefirstandsecondfieldsarethesystemidentifierandhome
# directoryofthedatabaserespectively.thethirdfiledindicates
# tothedbstartutilitythatthedatabaseshould,' y ',or should not,
# 'N ',be brought up at系统引导时间。
#
# multipleentrieswiththesame $ Oracle _ sidarenotallowed。
#
#
orcl 3360/data/Oracle/product/11.2.0/db _ 1: y
2,
#! /bin/bash
# thisfileisaddedforcompatibilitypurposes
#
# itishighlyadvisabletocreateownsystemdservicesorudevrules
# torunscriptsduringbootinsteadofusingthisfile。
#
# incontrasttopreviousversionsduetoparallelexecutionduringboot
# thisscriptwillnotberunafterallotherservices。
#
# pleasenotethatyoumustrun ' chmodx/etc/RC.d/RC.local ' to ensure
# thatthisscriptwillbeexecutedduringboot。
#添加开始
su Oracle-LC '/data/Oracle/product/11.2.0/db _1/bin/lsnrctl start '
su Oracle-LC/data/Oracle/product/11.2.0/db _1/bin/dbstart
#添加结束
3、
#! /bin/sh
# chkconfig: 345 61 61
# description 3360 Oracle 11gr2autorundmdds/p #/etc/init.d/Oracle
#
# run-levelstartupscriptfortheoracleinstance,监听器,and
#网络界面
导出Oracle _ base=/data/Oracle #根据个人情况更改路径
导出Oracle _ home=$ Oracle _ base/product/11.2.0/db _ 1
将导出Oracle _ sid=orcl #更改为自己的ORACLE_SID:testsid
导出路径=$ path : $ Oracle _ home/bin
ORA_OWNR='oracle '
># if the executables do not exist -- display errorif [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
reload|restart)
$0 stop
$0 start
;;
echo $"Usage: `basename $0` {start|stop|reload|reload}"
exit 1
esac
exit 0
4、
5、
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /data/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "orcl": log file /data/oracle/product/11.2.0/db_1/startup.log
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener Usage: /data/oracle/product/11.2.0/db_1/bin/dbshut ORACLE_HOME Processing Database instance "orcl": log file /data/oracle/product/11.2.0/db_1/shutdown.log 6、 文件修改内容为(替换掉ORACLE_HOME_LISTNER=$1): 省略... # First argument is used to bring up Oracle Net Listener #ORACLE_HOME_LISTNER=$1 ORACLE_HOME_LISTNER=$ORACLE_HOME 省略... 7、 文件修改内容为(替换掉ORACLE_HOME_LISTNER=$1): 省略... # The this to bring down Oracle Net Listener #ORACLE_HOME_LISTNER=$1 ORACLE_HOME_LISTNER=$ORACLE_HOME if [ ! $ORACLE_HOME_LISTNER ] ; then 省略... 8、 Processing Database instance "orcl": log file /data/oracle/product/11.2.0/db_1/startup.log 9、 10、 total 0 lrwxrwxrwx. 1 root root 32 Nov 15 01:04 K43vmware-tools-thinprint -> ../init.d/vmware-tools-thinprint lrwxrwxrwx. 1 root root 20 Nov 14 22:30 K50netconsole -> ../init.d/netconsole lrwxrwxrwx. 1 root root 17 Nov 14 22:30 K90network -> ../init.d/network lrwxrwxrwx. 1 root root 22 Nov 15 01:04 K99vmware-tools -> ../init.d/vmware-tools lrwxrwxrwx 1 root root 23 Dec 1 17:31 S61oracle -> /etc/rc.d/init.d/oracle 11、 Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. oracle 0:on1:off2:on3:on4:on5:on6:on