I am going to demonstrate how to install Oracle 11gR2 Express Edition in Ubuntu 13.04. Take note that Ubuntu is not supported by Oracle but I will still attempt to install the platform. I used the following source as basis for my installation:

http://meandmyubuntulinux.blogspot.com/2012/05/installing-oracle-11g-r2-express.html
http://meandmyubuntulinux.blogspot.com/2011/09/installing-1-gb-swap-without.html

Make sure you download Oracle11g Release 2 Express Edition x64 (The only available cpu architecture for XE edition) and placing it in a directory that you can work on before proceeding further:

Installation prerequisites:

1. Install the needed packages:
shell> sudo apt-get install alien libaio1 unixodbc vim

2. While downloading the packages, you can also unzip the Oracle database file you’ve just downloaded earlier as both will take some time:
shell> unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

3. Next, we need to convert the .rpm file to .deb file with the following command:
shell> sudo alien –scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

While doing this step, you may proceed to the next step at this may take time:

Pre-installation configuration

1. We will create a special chkconfig script in this step.The Red Hat based installer of Oracle XE 11gR2 relies on /sbin/chkconfig, which is not used in Ubuntu. The chkconfig package available for the current version of Ubuntu produces errors and my not be safe to use. Based on the source I followed, below is a simple trick to get around the problem and install Oracle XE successfully:

shell> 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 :
shell> sudo chmod 755 /sbin/chkconfig
2. Set the Kernel parameters :

Oracle 11gR2 XE requires to set the following additional kernel parameters:
shell> sudo vim /etc/sysctl.d/60-oracle.conf
(Enter the following) :
# Oracle 11g XE kernel parameters
fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65000
kernel.sem=250 32000 100 128
kernel.shmmax=536870912
(Save the file)
Note: kernel.shmmax = max possible value , e.g. size of physical RAM ( in bytes e.g. 512MB RAM == 512*1024*1024 == 536870912 bytes )
Verify the change :
shell> sudo cat /etc/sysctl.d/60-oracle.conf
Load new kernel parameters:
shell> sudo service procps start
Verify: sudo sysctl -q fs.file-max
This should come out: fs.file-max = 6815744
3. Increase the system swap space : Analyze your current swap space by following command :

shell> free -m
**Swapfile Notes: Minimum swap space requirement of Oracle 11gR2 XE is 2 GB . In case, your is lesser , you can increase it by following steps (Mine is originally 1GB only):
a) switch to root and perform the following commands:
shell> su root
shell> dd if=/dev/zero of=/swapfile bs=1024 count=2097152 (Preferably, you should set the count to 1048576. This will add to the current total of 1GB = 2GB. Mine totalled to 3GB)
shell> mkswap /swapfile
shell> swapon /swapfile
shell> cp /etc/fstab /etc/fstab.orig (This is for backup of the original fstab)
shell> echo ‘/swapfile swap swap defaults 0 0′>> /etc/fstab (Adds the entry of new swap to fstab upon boot)
Verify with:
shell> swapon -a; swapon -s

Just in case you want to revert to the original config, perform the following:
shell> sudo swapoff -a
shell> sudo rm /swapfile

shell> sudo cp /etc/fstab /etc/fstab.changed; sudo cp /etc/fstab.org /etc/fstab
shell> sudo swapon -a; swapon -s

End of Swapfile Notes**

We need to make some additional required changes :
shell> ln -s /usr/bin/awk /bin/awk
shell> mkdir /var/lock/subsys
shell> touch /var/lock/subsys/listener
Installation of Oracle 11gR2 XE
1. Going back to the directory where we converted the installation package of Oracle XE, we perform the following commands to install the package:
shell> sudo dpkg –install oracle-xe_11.2.0-2_amd64.deb
(Note: If you encounter any ‘shared memory’ error or anything related to memory, look through http://meandmyubuntulinux.blogspot.com/2012/06/trouble-shooting-oracle-11g.html for more information.)
shell> sudo /etc/init.d/oracle-xe configure
Enter the following configuration information:
  • A valid HTTP port for the Oracle Application Express (the default is 8080)
  • A valid port for the Oracle database listener (the default is 1521)
  • A password for the SYS and SYSTEM administrative user accounts
  • Confirm password for SYS and SYSTEM administrative user accounts
  • Whether you want the database to start automatically when the computer starts (next reboot).

Note: I pretty much used the default configuration here except for the password of course

IMPORTANT: If the previous step or the configuration fails to complete, then you may have encountered the problem in which the link above was created for. The author explained in the link above the reason for the failure. Nevertheless, you will need to reinstall the package again. This happened to me. I followed the troubleshooting guide created by the author and everything went well afterwards.

2. We need to set up the environment variables to ensure the database will run. Add the following env variables to the .bashrc:
shell> vi ~/.bashrc
shell> export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
shell> export ORACLE_SID=XE
shell> export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
shell> export ORACLE_BASE=/u01/app/oracle
shell> export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
shell> export PATH=$ORACLE_HOME/bin:$PATH

3. Load the changes:
shell> . ./.profile (from root or just type cd before this command)
shell> sudo service oracle-xe start (mine is running already)

Configuring User Accounts in Oracle 11gR2 XE

1. Login in the database as follows:

shell> sqlplus / as sysdba
Note: If you get the error ORA-01031: insufficient privileges after the above command, it means you need to add your user in the dba group. Perform the following:
shell> su root
shell> vim /etc/group
Add your user name at the end of dba:x:1001: like
dba:x:1001:<user>

2. Create a user account using the following commands:
sqlplus> create user <username> identified by <password>;
sqlplus> grant connect, resource to <username>;

3. Now try logging in to that user account using the username you’ve just created:
shell> sqlplus
Enter username:
Enter password:

About these ads