Installing Oracle 11g (11.2.0.1) DB On Ubuntu 10.10 32 Bit

Having recently created an Ubuntu 10.10 VirtualBox image for my Oracle 11.2.0.1 databse installation I have decided to bring my notes together as a simple blog entry that I hope will allow other people to quickly do the same. The reason for this entry is because the information required to successfully complete the installation is spread around the documention. Hence I felt some short concise, I hope, instructions would be useful. I assume that the user does have an understanding of Ubuntu and Oracle database installation and hence do not go into details on all the commands.

Update Packages

apt-get update
apt-get update

apt-get install elfutils libaio1 libaio-dev libstdc++6-4.4-dev numactl pdksh sysstat unixODBC-dev unixODBC build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm

Create Groups

groupadd oinstall
groupadd dba
groupadd nobody

usermod -g nobody nobody

Create / Update oracle User

useradd -s /bin/bash -m -g oinstall -G dba oracle passwd oracle

The following command is required to successfully run the installer.

xhost local:oracle

Configure Limits for oracle

sudo gedit /etc/security/limits.cong

Add :

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

Configure System

sudo gedit /etc/sysctl.conf

Add :

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304

Make Directories

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory

Link command to location expected by oracle installer

ln -s /usr/bin/awk /bin/awk  
ln -s /usr/bin/rpm /bin/rpm  
ln -s /usr/bin/basename /bin/basename

Run Installer

I assume here that the user has previously installed the oracle database. If not simply follow the default options when the database installer executes.

./runInstaller

Post Install

Add the following to /etc/profile

export ORACLE_BASE=/u01/app/oracle  
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1  
export ORACLE_OWNR=oracle  
export
PATH=$PATH:$ORACLE_HOME/bin

Start Script

Create /etc/init.d/oracledb with the following contents:

#!/bin/bash
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
#
export ORACLE_OWNR=oracle
export ORACLE_OWNER=oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "Oracle startup: cannot start"
    exit 1
fi

case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
        touch /var/lock/oracle
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
        rm -f /var/lock/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    \*)
        echo "Usage: `basename $0` start|stop|restart|reload"
        exit 1
esac

exit 0

Execute :

cd /etc/init.d
update-rc.d oracledb defaults 99

The above will create links within the rc\*.d directories.

Edit oratab Script

Modify /etc/oratab so that the db is started with the os the sid line should look like the following:

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

Checking it all works

Shutdown your VirtualBox Ubuntu and change the Network Configuration to Host Only Adapter, this is used to provide and internal loop back with VirtualBox and the os it is running on, and then restart. Once that instance is running log on and execute the following:

/sbin/ifconfig

It should return something like the following:

oracle@ubuntu-oracle-11g:~$ /sbin/ifconfig
eth1      Link encap:Ethernet  HWaddr 08:00:27:c7:f4:7b 
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fec7:f47b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:24 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3355 (3.3 KB)  TX bytes:7381 (7.3 KB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:710 errors:0 dropped:0 overruns:0 frame:0
          TX packets:710 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:53972 (53.9 KB)  TX bytes:53972 (53.9 KB)

As you can see this shows that the IP address is 192.168.56.101. On your system add an entry to the "hosts" file (oracle11gdb) and then use your favourite DB tool to access the database at :

jdbc:oracle:thin:@oracle11gdb:1521/ORCL

This should connect and allow you access to the database.

Comments:

Was the installation done using 11.2.0.1 or 11.2.0.2 ? 32-bit or 64-bit ?

Posted by Jeroen on December 26, 2010 at 05:02 PM GMT #

11.2.0.1 on Ubuntu 10.10 32 Bit

Posted by Andrew on January 04, 2011 at 01:42 AM GMT #

great work
it helps a lot
thank you!!

Posted by bcsachith on January 31, 2011 at 10:52 AM GMT #

regarding startup script...

why youre not using the oraenv script?

Posted by nuttijay on February 12, 2011 at 08:53 AM GMT #

Hello What happens if oracle user name is different from "oracle"? What should I change? Thank You JCV

Posted by guest on June 09, 2011 at 03:21 AM GMT #

If your user is not oracle then you will need to replace "oracle" with you user in the following: 1) Configure Limits 2) xhost 3) chown 4) Start / Stop script That should do it.

Posted by guest on June 09, 2011 at 04:18 AM GMT #

Thank's for your reply. Made what you said,bet did not work. When I execute: /etc/init.d/oracledb start I get the answer : "command not found" JCV

Posted by JCV on June 09, 2011 at 08:14 AM GMT #

I assume your start script looks something like that below: export ORACLE_OWNR=<YOUR NAME> export ORACLE_OWNER=<YOUR NAME> .... export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 If so can you try sudo bash and then execute su <YOUR NAME> -c "<ORACLE HOME DIR>/bin/lsnrctl start" su <YOUR NAME> -c "<ORACLE HOME DIR>/bin/dbstart <ORACLE HOME DIR>" then we can see which command is not found.

Posted by Andrew on June 09, 2011 at 08:54 AM GMT #

When trying dbstart as you said, I get the folowing message: pam_mount(spawn.c:128): error setting uid to 0 JCV

Posted by JCV on June 09, 2011 at 09:14 AM GMT #

Seems like this could be a bug in ubuntu (http://www.mail-archive.com/ubuntu-server-bugs@lists.ubuntu.com/msg56419.html) although I have not seen it myself. I'll see if I can find a work around.

Posted by Andrew on June 09, 2011 at 10:28 AM GMT #

Thanks a lot

Posted by JCV on June 09, 2011 at 11:25 AM GMT #

Thank you for your support, I'm going to delete the VM and setup a new one with "oracle" user. Yours José Carlos Vieira

Posted by JCV on June 13, 2011 at 01:27 AM GMT #

Post a Comment:
Comments are closed for this entry.
About

As a member of the Oracle A-Team we specialise in enabling and supporting the Oracle Fusion Middleware communities.

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today