Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Monday, March 17, 2014

Installing Sun JRE (Java Run-time Environment ) in Ubuntu

Hi Everyone,

Some-times ago, I gave you the installation steps for Sun Java  ( Now Oracle Java ) for the Ubuntu Linux @ my previous post about installing sun jre  . But now that doesn't seems to work even for me as Oracle has removed the binary ( .bin ) file from their website . Even the steps given at https://www.java.com/en/download/help/linux_install.xml  or the PPA method of webupd8 as mentioned in Ubuntu Community Wiki doesn't seems to help.

So, I decided to do something different, which I have formulated in steps as below :-

1) Download the rpm file labelled as "Linux RPM" from the java website. 

2) Install alien package from Ubuntu repositories.
         sudo apt-get install alien
3) Go to the directory where you have downloaded the rpm file. For example, if your file was downloaded to Downloads directory then :-
         cd ~/Downloads
4) Use alien to Convert the rpm package to deb package. This may take a while.
         sudo alien --to-deb --scripts jre-7u51-linux-i586.rpm
5) Use dpkg to install the newly generated deb package.
         sudo dpkg -i jre_1.7.051-1_i386.deb
    You can also use The Ubuntu-Software-Center or GDebi-Package-Installer for the above purpose.
6) Use following command to verify the installation :- 
          java -version

Output will be something similar to this as show in the above screenshot:-

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

7) To install the firefox plugin, do the following :-
    a) Go to Firefox-plugin install directory
            cd /usr/lib/firefox-addons/plugins/
    b) create a soft-link ( shortcut ) for the Java plugin in the directory :-
            sudo ln -s /usr/java/jre1.7.0_51/lib/i386/libnpjp2.so .
    c) To verify, you can launch Firefox and type about:plugins and its ready for use.
8) To install the java plugin for Google chrome, do the following:-
   a) Go to Google chrome installation directory
         cd /opt/google/chrome
   b) create a directory named plugins here ( if its not there ) . At least, it was absent from mine chrome installation ;) 
        sudo mkdir plugins
   c) Now create a soft-link ( shortcut ) for the Java plugin in the directory :-
         sudo ln -s /usr/java/jre1.7.0_51/lib/i386/libnpjp2.so .
   d) Now, you can launch Google chrome and type chrome://plugins/ to verify the installation and start using the plugin.

Note:- The above steps have been tested on The Lubuntu 14.04 beta 1.

Friday, March 15, 2013

Installing Oracle XE on Ubuntu 32-bit

For successful installation of Oracle XE on Ubuntu 32-bit, following requirements must be satisfied :-
a) 512 MB RAM
b) 1 GB swap-space
c) 1.5 GB of free space in the mount-point containing /usr/lib directory.

For installing the Oracle 10g XE R2 do the following :
1) Install the libaio1 package .
            
sudo apt-get install libaio1


2) Download the .deb installer file : 
For the people who want to install Oracle XE on the 32-bit Ubuntu system but are not able to do the same due to unavailability of the installer from Oracle Website , here is some good news. I am sharing the original Oracle 10g R2 XE ( express edition ) installer on my cloud space.

The Link : One Drive Link

File size : 220670896
md5sum : 47a83df38f2cbcd78b9a1f110c1c5d92
sha1sum : be666229e036afa85dcc9437d48a418bf65c3468

Use the above link to download the deb installer file.
 
3) Go to the download location and run below command to install the Oracle 10g XE :
            
dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb


4) Configure the installation:
           
  /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).  

5) Set-up the environment variables :
Add following lines to .bashrc of the user which you will using to access the Oracle 10g XE:
  • export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
  • export ORACLE_SID=XE 
  • export PATH=$ORACLE_HOME/bin:$PATH 

6) Start a new shell ( terminal window ) for the changes to take effect or execute the .profile to force the changes made in the same session.
       
  . ./.profile


7) Use the command "sqlplus sys as sysdba" and the password which you created while configuration to connect to the database.

Have a happy Ubuntu Experience...

Note:- If anyone face problem in downloading from the above link, please let me know in the comments.

Wednesday, June 13, 2012

Trouble-shooting oracle 11g installation on Ubuntu

In my one of the previous post ( http://meandmyubuntulinux.blogspot.com/2012/05/installing-oracle-11g-r2-express.html ) , I told you about steps for installation of Oracle 11g R2 express edition on Ubuntu. But I found out that many of you are facing problems in installing using the given steps. So, I came up with an idea of adding a trouble-shooter post which can enable you to have a hassle-free installation experience.
                Most of the time, if you followed the steps in previous post then you should be able to reach at least up to the configuration part ( Step # 6(ii) ). If you face any problem before this step then you must perform re-installation. For this do the following :
1) Enter the following command on terminal window :
sudo -s
/etc/init.d/oracle-xe stop
ps -ef | grep oracle | grep -v grep | awk '{print $2}' | xargs kill
dpkg --purge oracle-xe
rm -r /u01
rm /etc/default/oracle-xe
update-rc.d -f oracle-xe remove

2) Follow the steps given in the previous post to install the Oracle 11g XE again.

Now, once you have reached the configuration part. Do the following to avoid getting MEMORY TARGET error ( ORA-00845: MEMORY_TARGET not supported on this system ) :
sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm

(here size will be the size of your RAM in MBs ).

The reason of doing all this is that on a Ubuntu system  /dev/shm is just a link to /run/shm but Oracle requires to have a seperate /dev/shm mount point.

Update: Few people have also reported ORA-01031: insufficient privileges error . To avoid this simply use "oracle" ( without quotes ) as your password for sys / system user while in configurations step.

3) Next you can proceed with the configuration and other consequent steps.

To make the change permanent do the following :

a) create a file named S01shm_load in /etc/rc2.d :

sudo vim /etc/rc2.d/S01shm_load

Now copy and paste following lines into the file :

#!/bin/sh
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/null
       touch /var/lock/subsys/listener
       rm /dev/shm 2>/dev/null
       mkdir /dev/shm 2>/dev/null
       mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo error
   exit 1 ;;
esac

b) Save the file and provide execute permissions :

         sudo chmod 755 /etc/rc2.d/S01shm_load

This will ensure that every-time you start your system, you get a working Oracle environment.

If you face any other problem while installing Oracle 11g R2 XE on Ubuntu, please feel free to ask as comments.

Reference:
1) Ubuntu man-page 

Thursday, May 10, 2012

Installing Oracle 11g R2 Express Edition on Ubuntu 12.04 64-bit

              Recently I installed Oracle 11g R2 Express Edition on my ubuntu 12.04 ( Precise Pangolin). But for this, I have to google a lot and had to install two times to get a fully working environment. So, I thought it would be better if I share my experience with my fellow ubuntu'ers so that they don't have to face the troubles that I encountered. I have came up with following series of steps ( mostly derived from the link source I given at the end of this post ) for easy and hassle-free installation.
              But at first, I must inform you about the limitations of Oracle 11g R2 Express Edition (XE) which are as follows :

    • The Installer released by Oracle is only meant for 64-bit (x86_64) systems. If you wish to install the 32-bit version , see installing oracle xe on ubuntu 32-bit
    • It will consume, at most, processing resources equivalent to one CPU.
    • Only one installation of Oracle Database XE can be performed on a single computer.
    • The maximum amount of user data in an Oracle Database XE database cannot exceed 11 GB.
    • The maximum amount of RAM that Oracle XE uses cannot exceed 1 GB, even if more is available.
      Now the steps for Installation :

      1) Download the Oracle 11gR2 express edition installer from the link given below:


      ( You will need to create a free oracle web account if you don't already have it )

      2) Unzip it :
      unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

      3) Install the following packages :
      sudo apt-get install alien libaio1 unixodbc vim

      4) Convert the red-hat ( rpm ) package to Ubuntu-package :
      sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

      (Note: this may take a while , till that time you can go for step 5 )

      5) Do the following pre-requisite things:
      a) Create a special chkconfig script :

      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. Below is a simple trick to get around the problem and install Oracle XE successfully: 
      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

      b) Set the Kernel parameters :
      Oracle 11gR2 XE requires to set the following additional kernel parameters:
      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 : 
      sudo cat /etc/sysctl.d/60-oracle.conf 
      Load new kernel parameters: 
      sudo service procps restart  
      Verify: sudo sysctl -q fs.file-max 
             -> fs.file-max = 6815744 
      c) Increase the system swap space : Analyze your current swap space by following command :
                 free -m 
      Minimum swap space requirement of Oracle 11gR2 XE is 2 GB . In case, your is lesser , you can increase it by following steps in my one of previous post .
      d) make some more required changes :
      i) sudo ln -s /usr/bin/awk /bin/awk 
      ii) mkdir /var/lock/subsys 
      iii) touch /var/lock/subsys/listener 


      6) 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 :
      i) sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb  
      Update : Before you proceed to next step , do have a look at this trouble-shooting post in order to avoid MEMORY TARGET or any other "shared memory" error.

      ii) 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
      Update / Note:- Few people have also reported ORA-01031: insufficient privileges error while connecting to the database. To avoid this simply use "oracle" ( without quotes ) as your password in this step. 
      • Confirm password for SYS and SYSTEM administrative user accounts
      • Whether you want the database to start automatically when the computer starts (next reboot).
      7) Before you start using Oracle 11gR2 XE you have to set-up more things :
      a) Set-up the environmental variables :
      Add following lines to your .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:$LD_LIBRARY_PATH
      export PATH=$ORACLE_HOME/bin:$PATH
       
      b) execute your .profile to load the changes:
           
                . ./.profile

      8) Start the Oracle 11gR2 XE :

      sudo service oracle-xe start

      The output should be similar to following :
      user@machine:~$ sudo service oracle-xe start
      Starting Oracle Net Listener.
      Starting Oracle Database 11g Express Edition instance.
      user@machine:~$
       
      8) Create your user :
      a) start sqlplus and login as sys :
      sqlplus sys as sysdba
      ( provide the password you gave while configuring the oracle in Step 6 (ii) ).
      This should come to following :

      SQL*Plus: Release 11.2.0.2.0 Production on Wed May 9 12:12:16 2012

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

      Enter password:

      Connected to:
      Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

      SQL>

      b) Enter following on the sql prompt : Replace username and password by your desired ones.
      SQL> create user username identified by password;

      User created.

      SQL> grant connect,resource to username;

      Grant succeeded. 
       

      9) Now as you have created the user , you can login to it :

      user@machine:~$ sqlplus

      SQL*Plus: Release 11.2.0.2.0 Production on Wed May 9 12:28:48 2012

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

      Enter user-name: temp
      Enter password:

      Connected to:
      Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

      SQL> select 2+2 from dual;

      2+2
      ----------
      4

      SQL>


      Reference Links :-
      1. Oracle 11g reference Documents 

      Saturday, September 24, 2011

      Installing a 1 GB swap without partitioning

                    Some software that you install e.g. oracle database XE requires you to have greater than one GB swap space. So, if you have not created a swap partition of greater than 1GB just because you have lot of RAM, you may land in a fix so as what do now . Although  , in ubuntu , you can easily use GParted to create a new swap space but some times you don't have enough free space or don't want to take risk of using GParted . Also , GParted is not installed by default ( u can get it from Ubuntu Live Disk ). So, we need some process by which we can have some extra swap space without using GParted.

      To install a 1 GB swapfile named swapfile in /  ( root directory) , use the following steps in the terminal :

      1) sudo -s 

         ( to gain root privilage, its optional , but if you don't do this then you have to append sudo to each of the following commands )

      2) dd if=/dev/zero of=/swapfile bs=1024 count=1048576  

         (this may take a while)  ( 1048576 == 1 x 1024 x 1024 , 1GB == 1048576 KB)

      3) mkswap /swapfile

          ( ignore any error )

      4) swapon /swapfile
       
          ( to turn on the swap )
       
      5) cp /etc/fstab /etc/fstab.orig


          ( back-up the fstab before editing )

      6) echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
       
          ( adds the entry of  new swap to fstab for mounting the file at boot time )

      7) To  Verify:

         swapon -a ; swapon -s


      If at anytime u want to delete the swap then :

         sudo swapoff -a
        
         sudo rm /swapfile


         sudo cp /etc/fstab /etc/fstab.changed ; sudo cp /etc/fstab.orig /etc/fstab

         sudo swapon -a ; swapon -s