Saturday, June 1, 2013

These steps are COPIED from this URL http://meandmyubuntulinux.blogspot.com/2012/05/installing-oracle-11g-r2-express.html all the credit goes to above user
1) Download the Oracle 11gR2 express edition installer from the link given below: http://www.oracle.com/technetwork/products/express-edition/downloads/index.html ( You will need to create a free oracle web account if you don't already have it ) 2) Unzip it :
cd ~/Downloads/INSTALL
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
# It unzips into sub-dir called "Disk1"
3) Install the following packages :
sudo apt-get install alien libaio1 unixodbc vim
4) Convert the red-hat ( rpm ) package to Ubuntu-package :
cd ~/Downloads/INSTALL
sudo alien --scripts -d Disk1/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:
sudo vi /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
5a) Save the above file and provide appropriate execute privilege :
       chmod 755 /sbin/chkconfig
5b) Set the Kernel parameters : Oracle 11gR2 XE requires to set the following additional kernel parameters:
sudo vi /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 ) 5c) Verify the change :
sudo cat /etc/sysctl.d/60-oracle.conf 
Load new kernel parameters: 
sudo service procps start  
Verify: sudo sysctl -q fs.file-max 
       -> fs.file-max = 6815744 
5d) make some more required changes :
ln -s /usr/bin/awk /bin/awk 
mkdir /var/lock/subsys 
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 :
cd ~/Downloads/INSTALL
# the deb file will be created at this dir, in above steps
 sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb 

6b) This isimportant step
Efore doing this make sure to close all other programs running , they may crash, if shared-meemory is being used
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.
6c) To make the change permanent do the following : 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 

6d) Save the file and provide execute permissions :
 sudo chmod 755 /etc/rc2.d/S01shm_load 

6e) Configuring Oracle
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).
the output will be something like this
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

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

7b) 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 :
SQL> create user xxxx-username identified by yyyyy-password;
User created.
SQL> grant connect,resource to xxxx-username;
Grant succeeded. 

9) Now as you have created the user , you can login to it :
SQL> select 2+2 from dual;

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

No comments: