Objective:
The company test environment on the Oracle 11G, but the system service is not configured, now need to configure Oracle as a system service, and with the system started, did not contact Oracle Baidu a bunch, it is best to find this way the easiest
Body:
Find the two files for Bin/dbstart and Bin/dbshut, switch to Oracle user, and make changes to these two files
Dbstart file 80 lines up and down
Vim/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart #ORACLE_HOME_LISTNER =$1 #变更前 oracle_ home_listner= $ORACLE _home #变更后
Dbshut file 50 line up/down
Vim/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut#oracle_home_listner=$1 #变更前ORACLE_ home_listner= $ORACLE _home #变更后
Creating Oracle Services
vim /etc/init.d/oracle #!/bin/sh# chkconfig: 35 90 90# description: oracle 11gr2# /etc/init.d/oracle## run-level stratup script for the Oracle instance, listener, and web interface export lang=zh_cn. Gbkexport oracle_base=/oracle/app/oracleexport oracle_home=/oracle/app/oracle/product/11.2.0/dbhome_ 1/export path= $PATH: $ORACLE _home/bin ora_ownr= "ORACLE" case "$" in start) su - $ORA _ownr -lc $ORACLE _home/bin/ dbstart #su - $ORA _ower -lc "$ORACLE _home/bin/lsnrctl start" echo "oracle start successful!" ;; stop) su - $ORA _ownr -lc $ORACLe_home/bin/dbshut #su - $ORA _ower -lc "$ Oracle_home/bin/lsnrctl start " echo " oracle stop successful! " ;; reload|restart) $0 stop $0 start ;; *) echo $ "usage: ' basename $0 ' {Start|stop|reload|restart} " exit 1 esac exit 0
Give Oracle Execute Permissions
chmod 755/etc/init.d/oracle
Add to system service and enable
Chkconfig Oracle on
This enables the use of services to start and stop Oracle, while also adding services to the system boot queue
This article is from the "Morrowind" blog, make sure to keep this source http://morrowind.blog.51cto.com/1181631/1696145
CentOS Oracle 11g self-Starting service