ORA-00845: MEMORY_TARGET error installing Oracle XE on Mint and Ubuntu

It was my turn to “cook” tonight. Deb was quite emphatic on that point. Continuing the fine and long-held tradition, sustained through generations of British manhood, I duly trudged down to the chippy.
Fish and chips, with that unique and exquisite smell of malt vinegar. Never mind all those fancy aftershaves, for us Brits it’s Sarsons…pour homme.
Except that, when I get to the shop, I find that I have no cash on me and they don’t accept cards.
No, not even “Chip and Pin”.
Eventually, the hunter gatherer returns ( having made a short detour to an ATM) to be greeted by the now ravenous family. Honestly, this cooking lark is all go.

It could be worse I suppose. I mean, the recipe for Victoria Sponge doesn’t suddenly stop working for no readily apparent reason, unlike, to take a random example, installing Oracle XE on Mint and Ubuntu.

When I wrote the original post, all was working perfectly. Mint 11, Oracle XE 11g, job done.
However, Mint 13 ( or Maya, if you prefer) is a bit of a different story. So, for that matter is Ubuntu 11.10 and above.

At this point, I’d like to say a big thanks to Gil Standen, whose comment on the original post was spot on in pin-pointing and solving this issue.

So, if you’ve found your way here having been frustrated in your installation attempts by this pesky error, what follows is an explanation of the issue, together with the steps that I used to resolve it on Mint 13.

The problem

As you are probably aware, Mint is based on Ubuntu. No doubt you are also aware that from 11.10, Ubuntu changed the way systemd worked.
You didn’t know that ? No, I must confess that it passed me by as well.
Anyway, the upshot of this is that, without getting too technical, they’ve moved stuff around again.
Oracle can’t find what it’s looking for so the toys come out of the pram in a shower of ORA-01034 and ORA-00845.

If you want to be a bit more technical ( and confirm that this is indeed the error you’re hitting), you simply need to open a terminal …

df -k

The output will be something like :

Filesystem     1K-blocks    Used Available Use% Mounted on 
/dev/sda1        6272596 3365612   2592464  57% / 
udev             1017052       4   1017048   1% /dev 
tmpfs             410336     888    409448   1% /run 
none                5120       0      5120   0% /run/lock 
none             1025836      80   1025756   1% /run/shm 

The problem is a bit tricky to spot, because there is something missing. In earlier Ubuntu based Linux versions you would have a shared memory area mounted on /dev/shm. This is what oracle-xe is looking for.

Now we know what’s missing, the next question is, how do we fix it ?

Mounting the shared memory

This next step has been adapted from the links that Gil provided – the Ubuntu Oracle Installation Guide, and yet more help on the Oracle Forum from the mysterious Dude.

So, switch to root…

sudo su -

Now we need to create a file to mount the shared memory at the location where Oracle XE is looking for it.
To do this, create a file as follows :

gedit /etc/init.d/oracle-shm

The contents of the file should be …

#! /bin/sh 
# /etc/init.d/oracle-shm 
# 
# 
case "$1" in 
  start) 
    echo "Starting script /etc/init.d/oracle-shm" 
    # Run only once at system startup 
    if [ -e /dev/shm/.oracle-shm ]; then 
      echo "/dev/shm is already mounted, nothing to do" 
    else 
      rm -f /dev/shm 
      mkdir /dev/shm 
      mount --move /run/shm /dev/shm 
      mount -B /dev/shm /run/shm 
      touch /dev/shm/.oracle-shm 
    fi 
    ;; 
  stop) 
    echo "Stopping script /etc/init.d/oracle-shm" 
    echo "Nothing to do" 
    ;; 
  *) 
    echo "Usage: /etc/init.d/oracle-shm {start|stop}" 
    exit 1 
    ;; 
esac 
# 
### BEGIN INIT INFO 
# Provides:          oracle-shm 
# Required-Start:    $remote_fs $syslog 
# Required-Stop:     $remote_fs $syslog 
# Default-Start:     2 3 4 5 
# Default-Stop:      0 1 6 
# Short-Description: Bind /run/shm to /dev/shm at system startup. 
# Description:       Fix to allow Oracle 11g use AMM. 
### END INIT INFO

Now we need to set the appropriate permissions and tell the OS to run this script on startup :

chmod 755 /etc/init.d/oracle-shm
update-rc.d oracle-shm defaults 01 99

The output from the update-rc.d command should be :

 Adding system startup for /etc/init.d/oracle-shm ... 
   /etc/rc0.d/K99oracle-shm -> ../init.d/oracle-shm 
   /etc/rc1.d/K99oracle-shm -> ../init.d/oracle-shm 
   /etc/rc6.d/K99oracle-shm -> ../init.d/oracle-shm 
   /etc/rc2.d/S01oracle-shm -> ../init.d/oracle-shm 
   /etc/rc3.d/S01oracle-shm -> ../init.d/oracle-shm 
   /etc/rc4.d/S01oracle-shm -> ../init.d/oracle-shm 
   /etc/rc5.d/S01oracle-shm -> ../init.d/oracle-shm 

At this point, I re-booted the system. To test that the change has taken effect …

df -k
Filesystem     1K-blocks     Used Available Use% Mounted on 
/dev/sda6       41021700  7160992  31805236  19% / 
udev             3529700        4   3529696   1% /dev 
tmpfs            1428588     1004   1427584   1% /run 
none                5120        0      5120   0% /run/lock 
none             3571460   624088   2947372  18% /dev/shm 

As you can see, /dev/shm has now been mounted.
Now, we should be able to configure Oracle XE without any more of this MEMORY_TARGET nonsense. Once again, as root…

/etc/init.d/oracle-xe configure

Hopefully, Oracle will now behave itself and you can sit back and enjoy your chips.

Author: mikesmithers

Back in 1993, I discovered that I could get paid money for doing fun stuff with computers. Over the years, I've specialised in Oracle Databases as a developer, a DBA and sometimes, an architect. It's my evil alter-ego - The Antikyte - who writes a blog about my various technical adventures. Yes, that is his Death Star parked in the Disabled Bay. I currently live in the South-West of England with Deb, my long-suffering wife.

10 thoughts on “ORA-00845: MEMORY_TARGET error installing Oracle XE on Mint and Ubuntu”

  1. I followed your instructions in my Debain Wheezy Distro, I ended up with two identical entries /dev/shm and /run/shm with identical sizes. How can I tweak the oracle-shm so that I only have /dev/shm

    Like

  2. Want the easiest way ever to install Oracle 11gR2 Enterprise Edition on Ubuntu ? Read about it here: https://sites.google.com/site/nandydandyoracle/environments/docker-11gr2-ee-ul
    When I contributed to this thread long time ago, about this /etc/init.d/oracle-shm file, the Linux Containers revolution was just a whisper. Check out how far it has come. There are many guides already on the net for putting Oracle XE down on Ubuntu using Linux Containers, but thanks to “filemon” ( https://hub.docker.com/u/filemon/ ) it’s now just pushbutton install if you need an Oracle EE 11gR2 on Ubuntu PDQ!

    Like

  3. Hi, this is Gil-again (gstanden). I just installed Oracle 12c two-node Grid Infrastructure Enteprise Edition on Ubuntu 14.04.1 using Oracle Enteprise Linux LXC Containers. I’m documenting the build here at my blog: https://sites.google.com/site/nandydandyoracle/lxc-ovs-rac-gns . The build uses OpenvSwitch, Bind9, isc-dhcp-server, and LXC Linux Containers. It is imho the cleanest easiest way to install any Oracle software onto Ubuntu. The database when installed is accessible from the base Ubuntu OS. Enjoy.

    Like

  4. Hi, I try to do all of this step by step. But when I try to do update-rc.d oracle-shm defaults 01 99? I have error: insserv: warning: script is corrupt or invalid: /etc/init.d/../rc2.d/s01shm_load. Please, help me, How can I solve it?

    Like

    1. Ainur,

      I didn’t encounter this particular issue. First of all, I assume that you’re trying to install Oracle Express Edition 11g on a Debian based distro (e.g. Mint, Ubuntu, Debian etc).
      If you are trying to do this on a Red-Hat based distro (e.g. Fedora, Red Hat, CentOS), then I suggest you take a look here as the process is quite different.

      If you’re hitting this problem on a Debian-based distro then a couple of things that spring to mind are :

      You need to be connected as root ( or sudo) for all of the steps that follow.

      It’s probably worth checking the oracle-shm file to make sure that the changes you’ve made are actually saved there and that there aren’t any typos. It’s a small file so

      cat /etc/init.d/oracle-shm
      

      … should do the job.

      The actual commands you need to run after editing the file (still connected as root or sudo, remember) are :

      chmod 755 /etc/init.d/oracle-shm
      update-rc.d oracle-shm defaults 01 99
      

      Note there is no “?” after the “99” in the second command. I’m not sure if this was simply some punctuation in your comment, but thought I’d better point it out, just in case.

      HTH

      Mike

      Like

Leave a reply to Riinav Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.