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.
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
groupadd oinstall
groupadd dba
groupadd nobody
usermod -g nobody nobody
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
sudo gedit /etc/security/limits.cong
Add :
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
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
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
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
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
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
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.
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
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.