How to automatically start Oracle over 10 Gb instance databases when Linux is started

Source: Internet
Author: User

How to automatically start Oracle over 10 Gb instance databases when Linux is started:

# Description: start or stop oracle
./Etc/rc. d/init. d/functions
# Oracle_env
Export ORACLE_BASE =/u01/app/oracle/db10g
Export ORACLE_HOME = $ ORACLE_BASE/db10g
Export PATH = $ PATH: $ ORACLE_HOME/bin
Export ORACLE_SID = twerp
Oracle_user = oracle
# Killproc
Start (){
Echo-n "starting oracle :"
Su-"$ oracle_user" <EOO
Lsnrctl start
Sqlplus/nolog <EOS
Connect/as sysdba
Startup
EOS
# Exchange ORACLE_SID
Export ORACLE_SID = twwh
Sqlplus/nolog <EOS
Connect/as sysdba
Startup
EOS
EOO
}
Stop (){
Echo-n "stoping oracle :"
Su-"$ oracle_user" <EOO
Lsnrctl stop
Sqlplus/nolog <EOS
Connect/as sysdba
Shutdown immediate
EOS
# Exchange ORACLE_SID
Export ORACLE_SID = twwh
Sqlplus/nolog <EOS
Connect/as sysdba
Shutdown immediate
EOS
EOO
}
Case "$1" in
Start)
Start
Touch/var/lock/subsys/orad
;;
Stop)
Stop
Rm-f/var/lock/subsys/orad
;;
Status)
Status oracle
;;
Restart)
Stop
Sleep 3
Start
;;
*)
Echo "$0 {start | stop | status | restart }"
;;
Esac
Run the script cp to the/etc/rc. d/init. d/directory.
Add executable permissions:
Chmod 755/etc/rc. d/init. d/orad
Release:
Chkconfig -- add orad
Or use chmod a + x ora9 to add the script to the system so that it can be started and run. Run the following command:
Chkconfig -- level 3 (or 5) -- add ora9

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.