Installing Oracle XE on Ubuntu in VirtualBox running in Mac OS X

As this works for development purposes only not for production:

Software requirement

  • VirtualBox 4.2.6 – VirtualBox-4.2.6-82870-OSX.dmg
  • Ubuntu 64bit Desktop 12.10- ubuntu-12.10-desktop-amd64.iso as this Oracle XE only work on 64bit Linux
  • Oracle XE 11.2.0 for Linux – oracle-xe-11.2.0-1.0.x86_64.rpm.zip
  • As at now im using Mac OS X 10.7.5

Installing and Setup VirtualBox

  1. Download and install VirtualBox , this should be easy

Installing Ubuntu Desktop 64bit to VirtualBox

  1. Download Ubuntu Desktop from ubuntu website http://www.ubuntu.com/download/desktop
  2. Go to VirtualBox
  3. Click “New” to “Create Virtual Machine”
  4. Run the ISO
    1. Name : Put a name for your virtual machine “MyTestUbuntu”
    2. Type : Choose Linux
    3. Version : Ubuntu (64 Bit)
    4. Memory Size : Just put 1024 for installation purposes only
    5. Hard Drive : Create a virtual hard drive now
    6. Click create
    7. File location , same as the VM name to avoid confusion
    8. File size: Since we are going to have a fixed size of an OS, put 30 GB, this is important as the OS will be installed on this image, dont put too low
    9. Hard Drive file type : VDI
    10. Storage on physical drive : Fixed size, for faster access, but be careful since you cannot expand the storage once you choose Fixed Size
    11. Click create , a popup window will appear
    12. Back to VirtualBox
    13. Select the newly created VM and Start
    14. Select Startup Disk: Choose a virtual Disk Option and locate ubuntu-12.10-desktop-amd64.iso
    15. Ubuntu Installation will start and proceed with Ubuntu installation
    16. Once finish , close the window of Ubuntu
  5. Assign the newly installed Ubuntu
    1. Click “New” to “Create Virtual Machine”
    2. Memory Size : Now choose bigger at least 2GB
    3. Hard Drive : Select previously created installation “MyTestUbuntu.vdi”
    4. Once done, click Start

Installing Oracle XE

http://meandmyubuntulinux.blogspot.ca/2012/05/installing-oracle-11g-r2-express.html

Unzip the installer
Unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

Install this package
sudo apt-get install alien libaio1 unixodbc vim

Ubuntu uses different tools to manage services and system startup scripts. The “chkconfig” tool required by the Oracle installer is not available in Ubuntu. The following will create a file to simulate the “chkconfig” tool.
sudo vim /sbin/chkconfig

copy and paste the following into the file
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo ‘### BEGIN INIT INFO’ >> $file
echo ‘# Provides: OracleXE’ >> $file
echo ‘# Required-Start: $remote_fs $syslog’ >> $file
echo ‘# Required-Stop: $remote_fs $syslog’ >> $file
echo ‘# Default-Start: 2 3 4 5’ >> $file
echo ‘# Default-Stop: 0 1 6’ >> $file
echo ‘# Short-Description: Oracle 11g Express Edition’ >> $file
echo ‘### END INIT INFO’ >> $file
fi
update-rc.d oracle-xe defaults 80 01

Save the above file and provide appropriate execute privilege :
sudo chmod 755 /sbin/chkconfig

ORA-00845: MEMORY_TARGET

Oracle 11gR2 XE 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.There are several ways how to address the problem. You can either enable /dev/shm shared memory, or change the default memory management of Oracle 11g from AMM (Automatic Memory Management) to ASMM (Automatic Shared Memory Management) as it was in used the previous 10g version. Since AMM is one of the new features of 11g, the following will show you how to make to make AMM work.

Login as root and edit shm file
sudo vim /etc/init.d/oracle-shm

Copy and paste this
#! /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 -t tmpfs shmfs -o size=2048m /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

Install the oracle-shm init script:
chmod 755 /etc/init.d/oracle-shm
update-rc.d oracle-shm defaults 01 99

Restart the system
reboot

Verify the success:
sudo cat /etc/mtab | grep shm

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

The following needs to be set for compatibility:
sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys
sudo touch /var/lock/subsys/listener

Now you are ready to install Oracle 11gR2 XE. Go to the directory where you created the ubuntu package file in Step 4 and enter following commands in terminal
sudo dpkg –install oracle-xe_11.2.0-2_amd64.deb

Run the configuration script
sudo /etc/init.d/oracle-xe configure

Start Oracle, or by default it is started
sudo service oracle-xe start

Just in case if still got error ORA-00845: MEMORY_TARGET in /u01/app/oracle/product/11.2.0/xe/config/log/CloneRmanRestore.log
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm

Done.

 

Advertisements

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 )

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