X

The leading edge of scripting languages and Oracle Database brought to you by the Data Access Development team

How I Enable Autostarting of Oracle Database for Demonstrations and Development

Christopher Jones
Senior Principal Product Manager

Here are the steps I have been using to enable autostarting of Oracle Database Enterprise Edition 10g, 11g or 12c during boot time of Oracle Linux 5 and 6. I also use these steps with Oracle Linux 7. These steps are useful for the kinds of demonstration and development setups that I typically need.

These steps are not needed for Oracle XE, since its install will prompt whether to autostart the DB and will configure the system automatically.

Create a new service script

Create a file /etc/init.d/dbora using dbora

Set permissions on the script

# chmod 750 /etc/init.d/dbora

Tell Linux to autostart/stop the service

On Oracle Linux 5 and 6 run:

# chkconfig --add dbora
# chkconfig dbora on

On Oracle Linux 7 run:

# systemctl enable dbora

Edit /etc/oratab

In /etc/oratab, change the autostart field from N to Y for any databases that you want autostarted.

Starting / Stopping the DB

The DB will start and stop at machine boot and shutdown.

Or it can be manually controlled with:

# service dbora start

and

# service dbora stop

On Oracle Linux 7, use 'systemctl start dbora' and 'systemctl stop dbora'.

Starting Oracle Database 12c Multitenant PDBs

To also start all pluggable databases when the container database starts, run this in SQL*Plus as SYSDBA:

create or replace trigger sys.after_startup
   after startup on database
begin
   execute immediate 'alter pluggable database all open';
end after_startup;
/

If you want to read more, check the official documentation about auto starting here.

Join the discussion

Comments ( 9 )
  • Rameswara topuri Friday, July 7, 2017
    good one
  • Ravi Joshi Monday, October 30, 2017
    Is it possible for you to update and in essence guide people on how to use systemd in stead of system SVR4's init.d directory?
  • Chris Jones Monday, October 30, 2017
    The instructions are still viable on Oracle Linux 7 and usable for test & development. If you have specific updates to be more 'officially' systemd-like, please post them here.
  • Thomas Monday, January 1, 2018
    just to confirm - dbora supposed to me empty? well, at least on my RedHat it doesn't work...

    # ls -la
    total 52
    drwxr-xr-x. 2 root root 141 Jan 1 22:59 .
    drwxr-xr-x. 10 root root 127 Jan 1 14:12 ..
    -rwxr-xr-x. 1 root root 318 Nov 3 15:18 choose_repo
    -rwxr-x---. 1 root root 0 Jan 1 22:59 dbora
    -rw-r--r--. 1 root root 17500 May 3 2017 functions
    -rwxr-xr-x. 1 root root 4334 May 3 2017 netconsole
    -rwxr-xr-x. 1 root root 7293 May 3 2017 network
    -rw-r--r--. 1 root root 1160 Sep 29 08:00 README
    -rwxr-xr-x. 1 root root 1868 Nov 3 15:18 rh-cloud-firstboot
    -rwxr-xr-x. 1 root root 2443 Oct 31 09:28 rhnsd
    [root@ip-172-31-39-17 init.d]# chkconfig -add dbora
    -add: unknown option
    [root@ip-172-31-39-17 init.d]# chkconfig --add dbora
    error reading information on service dbora: Invalid argument
    [root@ip-172-31-39-17 init.d]# chkconfig dbora on
    error reading information on service dbora: Invalid argument
  • Christopher Jones Monday, January 8, 2018
    dbora is not empty. The link in the post is correctly showing me the file contents.

    If you are using Oracle Linux 7, run 'systemctl enable dbora' to enable the service.
  • Patrick Tuesday, June 5, 2018
    Hi,

    I'm currently running Redhat 7.3 I try to used systemctl enable dbora but I got this message.

    dbora.service is not a native service, redirecting to /sbin/chkconfig.
    Executing /sbin/chkconfig dbora on

    any idea why systemctl doesn't work?

    thanks
  • Christopher Jones Wednesday, June 6, 2018
    For OL7 niceness someone would need to create a /etc/systemd/system/dbora.service file with proper systemd syntax. Maybe something like https://community.oracle.com/thread/2520738
  • Gerrit Haase Tuesday, November 20, 2018
    Hello,

    useful stuff.
    However, what about individual listener names, this solution supports only defult listener names?

    Regards,
    Gerrit
  • Christopher Jones Tuesday, November 20, 2018
    Feel free to hack the script in whatever way works for you.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services