Oracle Linux 7: Autostart Oracle with init.d
Thanks to wurtel, I found the solution. To get the Oracle DB running with the machine, I had to use systemd. Here's a Guide to it: https://oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux#oracle-11gr2-update
Follow the Oracle 11gR2+ Section (the last one) on how to create a startup.sh and a shutdown.sh. Then follow this tutorial, to setup the unit file: https://oracle-base.com/articles/linux/linux-services-systemd#creating-linux-services
Works like a charm :)
Related videos on Youtube
![Bhupendra Dudhwal](https://lh5.googleusercontent.com/-dI-1qhH9714/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucnkXXwCYyKyw_hLT2t7Mh8c1GHg4Q/s96-c/photo.jpg?sz=256)
Bhupendra Dudhwal
Updated on September 18, 2022Comments
-
Bhupendra Dudhwal almost 2 years
I try to make Oracle 12.1.0.2.0 start with the system via init.d on my Oracle Linux 7.3 machine.
I followed this example: https://oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux
This is my script to start the db:
#!/bin/sh # chkconfig: 345 99 10 # description: Oracle auto start-stop script. # # Set ORA_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORA_OWNER to the user id of the owner of the # Oracle database in ORA_HOME. ORA_HOME=/u01/app/oracle/product/12.1.0.2/db_1 ORA_OWNER=oracle case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values # Remove "&" if you don't want startup as a background process. su $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" & su $ORA_OWNER -c $ORA_HOME/bin/dbstart & touch /var/lock/subsys/dbora ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su $ORA_OWNER -c $ORA_HOME/bin/dbshut su $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" rm -f /var/lock/subsys/dbora ;; esac
Nothing happens upon start. I created soft links in
/etc/rc0.d
and/etc/rc3.d
:ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora chkconfig --level 2345 dbora on
chkconfig
lists thedbora.sh
withrunlevel 2345
onmanually starting with a short script works just fine, like this:
#!/bin/sh $ORACLE_HOME/bin/lsnrctl start $ORACLE_HOME/bin/dbstart
What am I missing?
-
wurtel over 7 yearsI believe that Oracle Linux 7 does not use the traditional init, but has switched to systemd for controlling the system including stopping and starting services. You'll need to create a "unit configuration file" to stop and start Oracle. I'm sure there are examples floating around on the net.
-
wurtel over 7 yearsIf you found a solution, followup with an answer so that others searching for this can find a solution. You're allowed to answer your own question as long as you give enough info, e.g. include the unit file.
-