Thursday, September 20, 2012

Installing Oracle 11gXE in Linux Mint Mate 12

I followed this article, and it helped a lot!

http://mikesmithers.wordpress.com/2011/11/26/installing-oracle-11gxe-on-mint-and-ubuntu/

Note that, Oracle 11g XE Does not support debeian based package installers, hence I ran into many difficulties, but eventually managed to install successfully.

Installing Oracle XE 11g Release 2 was extremely successful in Debian Squeezy OS.

These are the basic steps I followed.

1. First download and unzip the RPM.

   
   unzip oracle-xe-11.2.0.1.0.x86_64.rpm.zip


2. Convert the RPM to DEB.


  sudo alien --scripts oracle-xe-11.2.0-1.0.x86_64.rpm

3. Install this Lib. In Debian Squeeze, I had to add an entry to the /etc/sources after having searched for the libaio1 from the net for debian. 

  sudo apt-get install alien libaio1

4.  Create the chkconfig file.

      cd /sbin

      vi chkconfig

#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Debian by Dude
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

sudo chmod 755 chkconfig

5.  sudo ln -s /usr/bin/awk /bin/awk


6. 

Now you need to set the shared memory file system which oracle uses
mount -t tmpfs shmfs -o size=2048m /dev/shm

df-h should return the below result
shmfs           2.0G  1.2M  2.0G   1% /dev/shm



if this failed unlink /dev/shm

sudo unlink /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm



7. dpkg --install ./oracle-xe_11.2.0-2_amd64.deb 

8.grep /var/lock/subsys /etc/init.d/oracle-xe

9    sed -i 's,/var/lock/subsys,/var/lock,'/etc/init.d/oracle-xe

10.
      sudo usermod -a -G dba oracle
sudo usermod -a -G dba mike



11. Make sure these environment variables are set for all users

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 PATH=$ORACLE_HOME/bin:$PATH

You can execute the script given by oracle, located in:
/u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

or add the above line to the of /etc/bash.bashrc



Note: when you switch to oracle user:
i.e. su - oracle, make sure the environment variables are still set.


12. /etc/init.d/oracle-xe configure

If oracle didnt start successfully, i.e if you didn't get the output shown in the end of this blog, do the following

su - oracle


./u01/app/oracle/product/11.2.0/xe/bin/lsnctrl

start


These are the only changes I made in the sequence mentioned above.
Oracle started successfully, and was able to connect and create tables etc etc.



byorn@boogy /etc/init.d $ sudo ./oracle-xe status LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 23-SEP-2012 18:16:47 Copyright (c) 1991, 2011, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 23-SEP-2012 18:16:18 Uptime 0 days 0 hr. 0 min. 29 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service XE Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/boogy/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=boogy)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=boogy)(PORT=8080))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "XE" has 1 instance(s). Instance "XE", status READY, has 1 handler(s) for this service... Service "XEXDB" has 1 instance(s). Instance "XE", status READY, has 1 handler(s) for this service... The command completed successfully



Note: When I restarted my machine, oracle failed because df-h didnt show me the newly created shared memory file system.
For that i shut down oracle completely, and executed the steps in 6. and started again, all went fine.






3 comments:

  1. Hi Byorn,

    I have a couple of problems as a new to linux.
    I am running on linux mint 14.1 kate ,i followed the above mentioned steps and having 1 gb of shared memory
    required environment variables and i choosen start up the oracle at boot. so its started.
    After i am unable to .
    Could you please suggest me how to use and start the oracle like using/creating database , creating tables on existing database, how/where i need to query the data.

    and one more is why we need to add mike to dba groups how it will be usefully .

    i am unable to locate ./u01/app/oracle/product/11.2.0/xe/bin/lsnctrl
    Many thanks .
    oracle@master-desktop /etc/init.d $ df -h

    Filesystem Size Used Avail Use% Mounted on
    /dev/sda3 20G 16G 3.5G 82% /
    udev 988M 4.0K 988M 1% /dev
    tmpfs 399M 884K 398M 1% /run
    none 5.0M 0 5.0M 0% /run/lock
    none 997M 475M 522M 48% /dev/shm
    none 100M 20K 100M 1% /run/user

    oracle@master-desktop ~ $ cat /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
    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 PATH=$ORACLE_HOME/bin:$PATH

    ./u01/app/oracle/product/11.2.0/xe/bin/lsnctrl



    LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 30-DEC-2012 09:20:51

    Copyright (c) 1991, 2011, Oracle. All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
    STATUS of the LISTENER
    ------------------------
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
    Start Date 30-DEC-2012 07:31:49
    Uptime 0 days 1 hr. 49 min. 2 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Default Service XE
    Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
    Listener Log File /u01/app/oracle/diag/tnslsnr/master-desktop/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=master-desktop)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=master-desktop)(PORT=8080))(Presentation=HTTP)(Session=RAW))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "XE" has 1 instance(s).
    Instance "XE", status READY, has 1 handler(s) for this service...
    Service "XEXDB" has 1 instance(s).
    Instance "XE", status READY, has 1 handler(s) for this service...
    The command completed successfully


    sudo usermod -a -G dba oracle

    sudo usermod -a -G dba mike

    ReplyDelete
  2. Hi Udaya Kumar,
    Am sorry I didnt check my blog for a long time.
    Please email me byorn.desilva@gmail.com if you are still interested to find out how to install this in Linux Mint 14

    ReplyDelete
  3. > sudo /etc/init.d/oracle-xe stop

    > sudo rm /var/lock/subsys/listener

    > sudo rm /var/lock/subsys

    > sudo mkdir /var/lock/subsys

    > sudo touch /var/lock/subsys/listener

    > sudo rm -rf /dev/shm

    > sudo mkdir /dev/shm

    > sudo mount -t tmpfs shmfs -o size=16384m /dev/shm

    > sudo /etc/init.d/oracle-xe configure

    > . $HOME/.profile

    > sudo service oracle-xe start

    ReplyDelete