Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Service startup of Oracle & stop script and boot self-startup (single instance)

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Environment description:

ORACLE_SID= orcl

ORACLE_BASE=/oracle/app/oracle

ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1

(all of the following operations are performed with root)

1. Modify the Oracle system configuration file: / etc/oratab so that the dbstart and dbshut that come with Oracle will work.

# vi / etc/oratab, replace the corresponding module of ORACLE_SID:ORACLE_HOME:Y, as follows

Orcl:/oracle/app/oracle/product/11.2.0/dbhome_1:Y

two。 Create the file oracle under / etc/init.d/, as follows: (specify the ORA_HOME=XX path for the environment)

#! / bin/bash

# chkconfig:345 61 61

# description:Apache

#

# 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.

ORA_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1

ORA_OWNER=oracle

If [!-f $ORA_HOME/bin/dbstart]

Then

Echo "Oracle startup: cannot start"

Exit

Fi

Case "$1" in

'start')

# Start the Oracle databases:

Echo "Starting Oracle Databases..."

Echo "- -" > > / var/log/oracle

Date + "% T% a% D: Starting Oracle Databases as part of system up." > > / var/log/oracle

Echo "- -" > > / var/log/oracle

Su-$ORA_OWNER-c "$ORA_HOME/bin/dbstart" > > / var/log/oracle

Echo "Done"

# Start the Listener:

Echo "Starting Oracle Listeners..."

Echo "- -" > > / var/log/oracle

Date + "% T% a% D: Starting Oracle Listeners as part of system up." > > / var/log/oracle

Echo "- -" > > / var/log/oracle

Su-$ORA_OWNER-c "$ORA_HOME/bin/lsnrctl start" > > / var/log/oracle

Echo "Done."

Echo "- -" > > / var/log/oracle

Date + "% T% a% D: Finished." > > / var/log/oracle

Echo "- -" > > / var/log/oracle

Touch / var/lock/subsys/oracle

'stop')

# Stop the Oracle Listener:

Echo "Stoping Oracle Listeners..."

Echo "- -" > > / var/log/oracle

Date + "% T% a% D: Stoping Oracle Listener as part of system down." > > / var/log/oracle

Echo "- -" > > / var/log/oracle

Su-$ORA_OWNER-c "$ORA_HOME/bin/lsnrctl stop" > > / var/log/oracle

Echo "Done."

Rm-f / var/lock/subsys/oracle

# Stop the Oracle Database:

Echo "Stoping Oracle Databases..."

Echo "- -" > > / var/log/oracle

Date + "% T% a% D: Stoping Oracle Databases as part of system down." > > / var/log/oracle

Echo "- -" > > / var/log/oracle

Su-$ORA_OWNER-c "$ORA_HOME/bin/dbshut" > > / var/log/oracle

Echo "Done."

Echo ""

Echo "- -" > > / var/log/oracle

Date + "% T% a% D: Finished." > > / var/log/oracle

Echo "- -" > > / var/log/oracle

'restart')

$0 stop

$0 start

Esac

3. Change file permissions

# chmod 755 / etc/init.d/oracle

4. Add Servic

# chkconfig-- level 35 oracle on

5. You need to stop the database before shutting down or restarting the machine.

# ln-s / etc/init.d/oracle / etc/rc0.d/K01oracle / / shutdown

# ln-s / etc/init.d/oracle / etc/rc6.d/K01oracle / / restart

6. Usage

# service oracle start / / start oracle

# service oracle stop / / close oracle

# service oracle restart / / restart oracle

7. test

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report