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.

About these ads

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

  1. Pingback: Instalacja bazy danych Oracle xe na linuksie Mint lub Ubuntu | WriteOnly

  2. Pingback: Source Installing Oracle 11g XE on Ubuntu 12.10 64 bit | aginanjarm

  3. 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s