Oracle database automatically starts shell scripts

Source: Internet
Author: User

To ensure that Oracle starts the service automatically after the next system reboot, we can do this with a shell footstep. Assume that the footstep name is/app/oracle/oraclestart.sh, which reads as follows:

    1. #!/bin/sh
    2. Su-oracle <<EON
    3. Export oracle_sid=ixdba
    4. Lsnrctl start
    5. Sqlplus/nolog <<EOF
    6. Conn/as SYSDBA
    7. Startup
    8. Exit
    9. Eof
    10. Exit
    11. EON

Note that this footstep is performed as root user.

In this step, EOF or EON is just a delimiter that can be substituted with any character you like, except that everyone is accustomed to using EOF or EON. When the shell executes its footsteps and finds "<<", the next word is treated as a delimiter, and the content behind the delimiter is treated as input until the shell finds the delimiter again, and the input is considered to be complete. That is, the delimiters are all paired up.

Add this footstep to the/etc/rc.local file to ensure that it loads automatically when the system restarts.

    1. [[Email protected] ~] #echo "/app/oracle/oraclestart.sh">>/etc/rc.local

Oracle database automatically starts shell scripts

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.