Installing Oracle 11g R2 Express Edition on Ubuntu 14.04 64-bit Virtual Machine

I need Oracle APEX for one of my project. Instead of waiting for the company DBA configure a workspace for me, I decide to install a local copy of Oracle and APEX myself to familar with.This is part one: install Oracle on UBuntu 14.04 64Bit

Environment

Ubuntu 14.04 64Bit virtual machine
Oracle 11g R2 Express Edition (XE)

Requirement:

Please go over every item below to make sure that your system meets these requirements.

1). Oracle 11g R2 Express Edition may require up to 2GB swap space. please use free -m to verify that you have at least 2G swap space. If you do not have enough swap space, like in my case, then do the followings.

Figure 1. verify that you have enough swap space.

#switch to root
sudo su -
#create swap file on /swapfile
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile 
swapon /swapfile
#backup old fstab file and create a new one
cp /etc/fstab /etc/fstab.bak_`date +%N`
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
#enable all swap devices
swapon -a
#verify the new swap devices
swapon -s
free -m
2). Install alien for converting the downloaded installer from Red Hat format into Ubuntu-specific installer
sudo apt-get install alien libaio1
3). Configure Awk for compatibility
sudo ln -s /usr/bin/awk /bin/awk
4)Create the following folder if needed
sudo mkdir /var/lock/subsys
5). Create a special chkconfig script:
The Red Hat based Oracle 11gR2 XE installer relies on /sbin/chkconfig, which is not available in Ubuntu. This command will create a file /sbin/chkconfig to simulate the chkconfig tool.
sudo vim /sbin/chkconfig
copy and paste the following content into the newly created chkconfig file
#!/bin/bash
# chkconfig simulator for Oracle 11gR2 XE installer 
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 assign the appropriate execute privilege :
sudo chmod 755 /sbin/chkconfig
6). Fix /dev/shm to avoid having "cause ORA-00845: MEMORY_TARGET not supported on this system" error.

sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2045m /dev/shm # whatever value showing in your free -m output.

Installation


1). Download Oracle 11gR2 Express Edition installer from Oracle official site. You need an account to be able to download.

2). Unzip and convert the rpm package to deb package
cd /opt/oracle_src
mv ~/Downloads/oracle-xe-11.2.0-1.0.x86_64.rpm.zip .
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
cd Disk1/
#prepare Ubuntu specific package
sudo alien -d -c oracle-xe-11.2.0-1.0.x86_64.rpm 
#it takes a while for the command to complete.
3). Now you are ready to install Oracle 11gR2 XE.
cd /opt/oracle_src/Disk1
sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb

 Fig 2. Output from installing script
4) configure
sudo /etc/init.d/oracle-xe configure
sudo /etc/init.d/oracle-xe configure
Enter the following configuration information:
HttP port:8080
port used for database listener:1521
password for SYS and SYSTEM:tiger
Do you want Oracle XE to be startted on boot: yes
Congratulations, once you see the following figure.
Fig 3. Success configuration screen

5. Post-installation configuration
5.1 Set-up environmental variables : add the following lines to ~/.bashrc file
vim ~/.bashrc
#copy the following line to file .bashrc
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LFigure 1. verify that you have enough swap space.D_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
5.2 update environment variable
. ~/.bashrc
5.3 try logging into database
sqlplus sys as sysdba [tiger]
6. Use APEX The default APEX installed is Application Express 4.0.2.00.09, which could be reached at http://127.0.0.1:8080/apex

Question and solution 

1.Database configuration failed during configuration step."Database Configuration failed.Look into /u01/app/oracle/product/11.2.0/xe/config/log for details". When I look at these files, ORA-00845: MEMORY_TARGET not supported on this system was the main complain.
Solution:
1) Do step 6 in requirement section
2) then do these steps below
# get the pid of oracle, 3120 in my case
ps aux | grep oracle 
#kill oracle
sudo kill 3120
#check again to make sure that oracle is killed
ps aux | grep oracle 
#remove the installation
sudo dpkg --purge oracle-xe
rm -r /u01
rm /etc/default/oracle-xe
update-rc.d -f oracle-xe remove
5) re-run the installation step 3) and 4)

No comments:

Post a Comment

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...