One big long Oracle post

Originally posted on my older blog in October of 2012:

ORACLE_UNQNAME not defined

Common mistake when installing Oracle database is to not have all of your variables set correctly in your .bash_profile. If you come across this error when you try to start up the EMCTL console then here is what you do:
[oracle@localhost bin]$ emctl start dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

vi ~/.bash_profile
Add this line:
export ORACLE_UNQNAME=orcl

Install Oracle Java JDK/JRE 7u7 on CentOS

First you will need to download the JDK in PM format from here.

Change to your root user…

su -i

Install the package…

JRE 32-bit
rpm -Uvh /path/to/binary/jre-7u7-linux-i586.rpm

Install Sun/Oracle JDK java, javaws, (for Firefox/Mozilla) and javac with alternatives –install command

alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000

-Java Browser (Mozilla) Plugin 32-bit
alternatives --install /usr/lib/mozilla/plugins/ /usr/java/latest/jre/lib/i386/ 20000

-Java Browser (Mozilla) Plugin 64-bit
alternatives --install /usr/lib64/mozilla/plugins/ /usr/java/latest/jre/lib/amd64/ 20000

-Install javac only if you installed JDK (Java Development Kit) package
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000

Check current java, javac, javaws and versions

java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

Java(TM) Web Start

javac -version
javac 1.7.0_07

Install guide for Oracle 11g R2 on Centos 6

1. Install some packages

yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

2. Edit Kernel parameter.

# vi /etc/sysctl.conf
# comment out
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0

# add at the last line
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576

# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 65536
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576

3. Create a user for Oracle.

groupadd -g 200 oinstall
groupadd -g 201 dba
useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle

vi /etc/pam.d/login
near line 14: add
session required

vi /etc/security/limits.conf
# add at the last line
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

vi /etc/profile
# add at the last line

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
ulimit -u 16384 -n 65536

4.  Switch to a user “Oracle” and configure some settings.

chmod 755 /usr/oracle
mkdir /usr/oracle/app
chmod 775 /usr/oracle/app
mkdir /usr/oracle/oradata
chmod 775 /usr/oracle/oradata

vi ~/.bash_profile
# add at the last line
umask 022
export ORACLE_BASE=/usr/oracle/app

$ mkdir tmp # create a temporary dir for installation


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:

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!


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
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”
rm -f /dev/shm
mkdir /dev/shm
mount -B /run/shm /dev/shm
touch /dev/shm/.oracle-shm
echo “Stopping script /etc/init.d/oracle-shm”
echo “Nothing to do”
echo “Usage: /etc/init.d/oracle-shm {start|stop}”
exit 1
# 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.

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

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s