Oracle XE 11g – Service Not Mounting Database

configurationoracleoracle-11g-r2startup

A few days ago I did a system upgrade to fedora 27 and since then the oracle service doesn't properly start the database, I mean after running:

sudo service oracle-xe start

the database still down. but if I login as the oracle user and then execute the contents of startdb.sql:

connect / as sysdba
startup
exit

everything works as usual. I think the problem is caused by some misconfiguration, but I don't know where to look.

Running systemctl status oracle-xe only shows that the database is not active:

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 21-JAN-2018 16:32:44

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

This is what journalctl reports from oracle-xe service's start method:

Jan 22 20:55:09 localhost.localdomain su[9121]: (to oracle) root on none
Jan 22 20:55:11 localhost.localdomain oracle-xe[9085]: ORACLE instance started.
Jan 22 20:55:11 localhost.localdomain oracle-xe[9085]: Total System Global Area 1068937216 bytes
Jan 22 20:55:11 localhost.localdomain oracle-xe[9085]: Fixed Size                    2233344 bytes
Jan 22 20:55:11 localhost.localdomain oracle-xe[9085]: Variable Size                  616565760 bytes
Jan 22 20:55:11 localhost.localdomain oracle-xe[9085]: Database Buffers          444596224 bytes
Jan 22 20:55:11 localhost.localdomain oracle-xe[9085]: Redo Buffers                    5541888 bytes
Jan 22 20:55:15 localhost.localdomain oracle-xe[9085]: Database mounted.
Jan 22 20:55:18 localhost.localdomain oracle-xe[9085]: Database opened.
Jan 22 20:55:18 localhost.localdomain systemd[1]: Started SYSV: This is a program that is responsible for taking care of.
Jan 22 21:22:56 localhost.localdomain systemd[1]: Stopping SYSV: This is a program that is responsible for taking care of...
Jan 22 21:22:56 localhost.localdomain oracle-xe[10575]: Shutting down Oracle Database 11g Express Edition instance.
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: ORA-01034: ORACLE not available
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: ORA-27101: shared memory realm does not exist
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: Linux-x86_64 Error: 2: No such file or directory
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: Stopping Oracle Net Listener.
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 22-JAN-2018 21:22:57
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Jan 22 21:22:57 localhost.localdomain oracle-xe[10575]: Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]: TNS-12541: TNS:no listener
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]:  TNS-12560: TNS:protocol adapter error
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]:   TNS-00511: No listener
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]:    Linux Error: 111: Connection refused
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]: Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]: TNS-12541: TNS:no listener
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]:  TNS-12560: TNS:protocol adapter error
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]:   TNS-00511: No listener
Jan 22 21:22:58 localhost.localdomain oracle-xe[10575]:    Linux Error: 111: Connection refused
Jan 22 21:22:58 localhost.localdomain systemd[1]: Stopped SYSV: This is a program that is responsible for taking care of.
Jan 22 21:22:58 localhost.localdomain systemd[1]: Starting SYSV: This is a program that is responsible for taking care of...
Jan 22 21:22:58 localhost.localdomain oracle-xe[10620]: Starting Oracle Net Listener.
Jan 22 21:22:58 localhost.localdomain su[10630]: (to oracle) root on none
Jan 22 21:22:58 localhost.localdomain oracle-xe[10620]: LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 22-JAN-2018 21:22:58
Jan 22 21:22:58 localhost.localdomain oracle-xe[10620]: Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: Starting /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr: please wait...
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: System parameter file is /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: TNS-12555: TNS:permission denied
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]:  TNS-12560: TNS:protocol adapter error
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]:   TNS-00525: Insufficient privilege for operation
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]:    Linux Error: 1: Operation not permitted
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: Listener failed to start. See the error message(s) above...
Jan 22 21:23:00 localhost.localdomain oracle-xe[10620]: Starting Oracle Database 11g Express Edition instance.
Jan 22 21:23:00 localhost.localdomain su[10655]: (to oracle) root on none
Jan 22 21:23:02 localhost.localdomain oracle-xe[10620]: ORACLE instance started.
Jan 22 21:23:02 localhost.localdomain oracle-xe[10620]: Total System Global Area 1068937216 bytes
Jan 22 21:23:02 localhost.localdomain oracle-xe[10620]: Fixed Size                    2233344 bytes
Jan 22 21:23:02 localhost.localdomain oracle-xe[10620]: Variable Size                  616565760 bytes
Jan 22 21:23:02 localhost.localdomain oracle-xe[10620]: Database Buffers          444596224 bytes
Jan 22 21:23:02 localhost.localdomain oracle-xe[10620]: Redo Buffers                    5541888 bytes
Jan 22 21:23:07 localhost.localdomain oracle-xe[10620]: Database mounted.
Jan 22 21:23:08 localhost.localdomain oracle-xe[10620]: Database opened.
Jan 22 21:23:08 localhost.localdomain systemd[1]: Started SYSV: This is a program that is responsible for taking care of.

If I run lsnrctl start after calling sudo service oracle-xe start the database becomes alive again.

Best Answer

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 22-JAN-2018 21:22:58
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
TNS-12555: TNS:permission denied
 TNS-12560: TNS:protocol adapter error
  TNS-00525: Insufficient privilege for operation
   Linux Error: 1: Operation not permitted
Listener failed to start. See the error message(s) above...

This is typically caused by some leftover socket files at temporary locations with wrong permission (for example someone started the listener as root). Shut down the database and delete those file as:

rm -rf /var/tmp/.oracle

Then try again.