Multi-instance boot script for Oracle database under Linux/unix environment

Source: Internet
Author: User

Operating system platform: RHEL 5
Shell Environment: Bash
Oracle:10g2

Function Description: Automatically switch to Oracle user at power-on, and launch multiple instances of Oracle. and record the startup of the database into a custom log file.

#!/bin/bash

Log_path= $HOME/oracle_initing.log
Log () {
If [$#-lt 1-a $#-gt 1];then
Exit 5
Fi
Case "[e-mail protected]" in
Success
echo ' Date +%b ' "%d" "%T '" "$PRO": Oracle instence \ "$ORACLE _sid\" starting up succefully ">> $LOG _path;
Failed
echo ' Date +%b ' "%d" "%T '" "$PRO": Oracle instence \ "$ORACLE _sid\" starting up FAILED ">> $LOG _path;
*)
echo ' Date +%b ' "%d" "%T '" "$PRO": "[email protected] >> $LOG _path;
Esac
}
Lsstart () {
# Stop stopping
# Start starting
Lsnrctl >> $LOG _path <<eof
Status
Start
Exit
Eof
}
Init_oracle () {
#lsstart Stop the Listen
# Lsstart
Hostname= ' HOSTNAME |awk-f. ' {print $} '
Pro=$0
oracle_sids= ' Sed-rn '/^ ([^#].*):/!d;p '/etc/oratab |awk-f: ' {printf $ ""} '
If [-Z ' $ORACLE _sids]; then
Exit 2
Else
Echo $ORACLE _sids
For Oracle_sid in $ORACLE _sids
Do
# echo $ORACLE _sid
#start or stop the Oracle databases
# Startup
# Shutdown Immediate
If Sqlplus-s/nolog >> $LOG _path <<eof
Conn/as SYSDBA
Startup
Eof
Then
Log success
Continue
Else
Log failed
Exit 3
Fi
Done
Fi
}
If [$ "$UID"-eq 0]; then
Su-oracle
Init_oracle
#lsstart Start the Listen
# Lsstart
Exit 0
elif ["$USER" = "Oracle"]; then
Init_oracle
#lsstart Start the Listen
# Lsstart
Exit 0
Else
Exit 4
Fi

http://wangxiaoyu.blog.51cto.com/922065/197630

Multi-instance boot script for Oracle database in Linux/unix environment (RPM)

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.