ORA-00845: MEMORY_TARGET

 Oracle  Comments Off
Nov 092011
 

First of all thanks to Dude over at the OTN Discussion forums for this. Im reblogging since Oracle doesnt like you to post links to blogs in the forum for some reason. You can find his full how-to for Oracle on Ubuntu here:

https://forums.oracle.com/forums/thread.jspa?threadID=2301639

Here is the issue I was having after I moved from Ubuntu 10 to 11.10. Following this how-to worked for me just fine and only took a few minutes. Good luck!

 

ORA-00845: MEMORY_TARGET

 

Oracle 11gR2 XE, or any other edition, under Ubuntu 11.10 will result in “ORA-00845: MEMORY_TARGET not support on this system” either at Oracle database startup or during the initial installation. Ubuntu 11.10 uses a new version of the “systemd” system and session manager and has migrated away from /dev/shm and other common directories in favor of /run.

Starting with the release version of Oracle 11gR2 Express Edition, Oracle uses Automatic Memory Management. Oracle 11g AMM under Linux requires shared memory using /dev/shm. Although Ubuntu 11.10 installs a /dev/shm symbolic link automatically at system startup to address compatibility, the solution is not sufficient for Oracle 11g.

There are several ways how to address the problem, which basically mean to either enable Oracle 11g to recognize /dev/shm shared memory, or to to change from the default Oracle 11g Automatic Memory Management (AMM) to Oracle 10g Automatic Shared Memory Management (ASMM). This section has been updated from the previous version of this document to reduce the instructions by removing the content related to ASMM and changing the strategy to fix /dev/shm without modifying files that could be subject to change by automatic OS updates, i.e. /etc/init/mounted-dev.conf and /etc/fstab. To enable Oracle 11g AMM, enter the following commands:

Login as root:

sudo su -

Cut & paste the following into the command prompt (not a text editor):

cat > /etc/init.d/oracle-shm <<-EOF
#! /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 -B /run/shm /dev/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
EOF

Install the oracle-shm init script:

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

Restart the system:

shutdown -r now (This is the way to do it if you are doing this remotely. Using this will tell your machine to restart itself. Its handy when you are working remotely.)

Verify the success:

sudo cat /etc/mtab | grep shm
Results you are looking for:
none /run/shm tmpfs rw,nosuid,nodev 0 0
/run/shm /dev/shm none rw,bind 0 0

The upper limit of shared memory under Linux is set to 50 % of the installed RAM by default. If your system has less than 2 GB of RAM installed, there is still a chance to run into ORA-00845 error if your shared memory is used by other software.

The verify available shared memory, type the following commands:

sudo df -h /run/shm

 

Sometimes I have power outages and my server reboots where I have my test Oracle DB installed on Ubuntu 10. Since it started to happen pretty often I have since written a script that will do all of this for me but i thought id share what I had to go through before I made my script.

Whenever you try to connect to  a database it returns message,

ORA-01034 : ORACLE not available
ORA-27101 : shared memory realm does not exist

Cause of the Problem:
————————–
This problem happens whenever ORACLE_SID or ORACLE_HOME is not properly set. Or for normal users whenever oracle database is not started. For remote users there may be a problem in listener.

Solution:
—————————-
A)For Local Connections:
—————————-
1)Verify the ORACLE_SID and ORACLE_HOME is set properly. You can check the variable in UNIX by doing:

echo $ORACLE_SID
orcl

echo $ORACLE_HOME
/oracle/app/oracle/product/11.0.1/db_1

If it is set incorrectly then set on UNIX by:

export ORACLE_SID=db_name_here

Remember that ORACLE_SID is case sensitive on UNIX.

2)Verify the database instance is running:

ps -ef |grep smon

It will return a row as ora_smon_yourdatabasename

If it does not return anything then your database is not started. So, start it after setting proper SID (see step 1); Go into sqlplus as s y s d b a, at the next prompt type “startup”.

© 2011 Suffusion theme by Sayontan Sinha