Enable Oracle startup in CentOS 6.4

Source: Internet
Author: User

Enable Oracle startup in CentOS 6.4

Objective: To enable Oracle to start on CentOS 6.4

Solution: First add start, close, restart Oracle services and instance services, and then add this service to the System Service running level.

Set CentOS to automatically start Oracle at startup

Steps:

1. New service

Run the following command:

# Vi/etc/rc. d/init. d/oracle

The content of the Oracle file is:

#! /Bin/bash
# Chkconfig: 234 61 61
# Description: Oracle 11g AutoRun Service
#/Etc/rc. d/init. d/oracle
 
Case "$1" in
Start)
# Starts oracle listener and instance
Echo "Starting Oracle Database :"
Su-oracle-lc "lsnrctl start"
Su-oracle-lc dbstartup
;;
Stop)
# Shutdown oracle listner and instance
Echo "Shuting down Oracle Database :"
Su-oracle-lc "lsnrctl stop"
Su-oracle-lc dbshutdown
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo "Usage: {start | stop | reload | restart }"
Exit 1
Esac
Exit 0

Note: add at least two lines of comments to the script (in step 2). The first line tells chkconfig the running level of the service, and the second line adds a brief description about the service.

The preceding two scripts are involved: dbstart and dbshut.

2. Edit dbstartup and dbshutdown.
Execute Command
$ Vi $ ORACLE_HOME/bin/dbstartup
Content:
# Dbstartup
#/Opt/oracle/102/bin
Sqlplus/as sysdba <EOF
Startup
Exit
EOF
Vi $ ORACLE_HOME/bin/dbshutdown
Content:
# Dbshutdown
#/Home/oracle/102/bin
Sqlplus/as sysdba <EOF
Shutdown immediate
Exit
EOF

3. Check whether the startup script is correct.

# Cd/etc/rc. d/init. d
#./Oracle start
#./Oracle stop
 
4. Add the created oracle service to the system level.
Run the following command:
# Chmod 750/etc/rc. d/init. d/oracle
# Chkconfig -- level 234 oracle on
# Chkconfig -- add oracle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.