Get the App
SLTechnology News&Howtos  ›  Database  › 

Centos oracle 11g self-starting service

Shulou Source: shulou.com Published: 2022-06-01 04:30:17 10月06日 Update

Foreword:

Oracle 11G is installed in the company's test environment, but the system service is not configured. Now we need to configure oracle as a system service, and with the system startup, we have not contacted a bunch of oracle Baidu. It is best to think that this method is the easiest.

Text:

Find the bin/dbstart and bin/dbshut files, switch to the oracle user, and make changes to the two files

About 80 lines of the dbstart file

Vim / oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart # ORACLE_HOME_LISTNER=$1 # before change ORACLE_HOME_LISTNER=$ORACLE_HOME # after change

The dbshut file has about 50 lines

Vim / oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut#ORACLE_HOME_LISTNER=$1 # before change ORACLE_HOME_LISTNER=$ORACLE_HOME # after change

Create an oracle service

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 "$1" 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 execution permission

Chmod 755 / etc/init.d/oracle

Add to the system service and enable

Chkconfig oracle on

In this way, you can use the service to start and stop oracle, while also adding the service to the system startup queue

Tags: Service system file up and down two configuration simple top company preface at the same time way best permissions body environment user queue switching contact Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi macOS MySQL Shulou Information