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:
- #!/bin/sh
- Su-oracle <<EON
- Export oracle_sid=ixdba
- Lsnrctl start
- Sqlplus/nolog <<EOF
- Conn/as SYSDBA
- Startup
- Exit
- Eof
- Exit
- 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.
- [[Email protected] ~] #echo "/app/oracle/oraclestart.sh">>/etc/rc.local
|
Oracle database automatically starts shell scripts