RSS
 

Posts Tagged ‘10g’

Installing Oracle 10g on Ubuntu 9.10 (Karmic Koala) Server 64-bit

27 Apr

Source: Installing Oracle 10g On Ubuntu Karmic 64 Bit or OtherwiseInstalling Oracle 10g On Ubuntu Karmic 64 Bit Or Otherwise (Part 2)

So apparently I needed to install Oracle 10g to Ubuntu, and ran through a lot of hassles. I found a guide that’s well written but had some trouble with 64-bit server, and am writing for this for others who will encounter some trouble as well.

I’m breaking this down the following sections:

  1. Installing Required Libraries
  2. Setting Up Users and Groups
  3. Setting Kernel Parameters
  4. Emulating SUSE and Red Hat
  5. Setting Up the Oracle Environment
  6. Installing Oracle
  7. Creating the Listener
  8. Creating a Database
  9. Creating Startup/Shutdown Scripts

Installing Required Libraries

Since Ubuntu is not an officially supported OS, we need to emulate those that are, and since Oracle mixes 32-bit and 64-bit libraries, we need to install i386, and even ia32 libraries. Run the following:

sudo apt-get install libaio1 rpm gcc-multilib libc6-dev-i386 libc6-dev-i386 libc6-i386 ia32-libs

In addition, doesn’t come with LIBSTDC++5, so you have to install manually installing the package. Run the following:

wget "http://de.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_amd64.deb"
ar vx libstdc++5_3.3.6-17ubuntu1_amd64.deb
tar zxvf data.tar.gz
file usr/lib/libstdc++.so.5.0.7
sudo install usr/lib/libstdc++.so.5.0.7 /usr/lib32/
cd /usr/lib32
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5
cd /usr/lib
sudo ln -s /usr/lib32/libstdc++.so.5

Setting Up Users and Groups

We need to create the group oinstall, dba, and nobody, and create a user named oracle. Run the following:

sudo groupadd oinstall
sudo groupadd dba
sudo groupadd nobody
sudo useradd -m oracle -g oinstall -G dba -s /bin/bash

And don’t forget to change the password.

sudo passwd oracle

Take note of the oinstall group ID as you will need this in setting the Kernel Parameters later. Do this by running the code below:

cat /etc/group | grep oinstall

The ID should be in the format 10XX. If it’s a newly installed system, it should be 1002.

Setting Kernel Parameters

We need to override the kernel parameters by running the following:

sudo vi /etc/sysctl.conf

And add the settings below at the bottom of the file. Take note that the [oinstall_group_id] should be replaced with what you got in the steps above (1002).

vm.hugetlb_shm_group = [oinstall_group_id]
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

Reload the parameters by running the following:

sudo /sbin/sysctl -p

We also need to edit limits of the system. Edit the limits.conf file by running:

sudo vi /etc/security/limits.conf

Add add the settings below to the bottom of the file.

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

Emulating SUSE and Red Hat

We emulate SUSE by creating symbolic links of the following:

sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
sudo ln -s /usr/bin/basename /bin/basename

We emulate Red Hat by creating the redhat-release file to trick the Oracle Installer that we are using Red Hat. =) Edit the file:

sudo vi /etc/redhat-release

And add the following:

Red Hat Enterprise Linux AS release 3 (Taroon)

Setting Up the Oracle Environment

I normally install my oracle database inside /opt so from hereon, you have to take note that /opt/oracle/10g will be the oracle home, and /opt/oracle will be the oracle base. The SID I will be using here will be orcl. Run the following:

sudo mkdir -p /opt/oracle/10g
sudo chown -R oracle:oinstall /opt/oracle
sudo chmod -R 775 /opt/oracle

Update environment profile by editing the global profile.

sudo vi /etc/profile

And add the following settings at the bottom.

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/10g
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin

Installing Oracle

Proceed with installation. My install directory is in /home/installers Unpack the downloaded oracle installer:

gunzip 10201_database_linux_x86_64.cpio.gz
cpio -id < 10201_database_linux_x86_64.cpio
sudo chown -R oracle:oinstall .

Normally, Ubuntu Server doesn’t have X server installed, so you will have problems running the installer as it actuallly has GUI. The easiest way to install this is to access a desktop with X server, and create a connection with SSH forwarding.

ssh -X oracle@oracle-server

From there, fire up the installer:

cd /home/installers/database
./runInstaller

The GUI should come out on your client machine. Once the installer is up, uncheck the “Create Starter Database” option, and keep clicking on Next to accept the defaults.

If you encounter some error about the “collector” you can just ignore this as Ubuntu is not supported.

After the installation, the installer will ask you to run two scripts as root. Run them as is.

Oracle is Installed! X_X

Creating the Listener

We create the listener by running the Network Configuration Assistant (needs X server). As with the installer, we need to have X forwarding enabled. The command should be in the oracle path, if not, there might have been a problem with setting up the oracle environment. Run the following as oracle user:

netca

Just use the defaults and create the listener.

Creating the Database

We create a database by running the Database Configuration Assistant (needs X). We also need X forwarding enabled here. Run the assistant with the following:

dbca

Create the database as you please. Although you have to take note of the Database Name/SID, and it should match the ORACLE_SID environment variable you set on the /etc/profile file.

Creating Startup/Shutdown Scripts

First, we need to edit the /etc/oratab file.

sudo vi /etc/oratab

My oratab file contains the following:

orcl:/opt/oracle/10g:N

Change the last character, N, to Y.

Next, we edit dbstart as oracle user. Run the following:

vi $ORACLE_HOME/bin/dbstart

Look for the following line:

ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

Just change that to your ORACLE_HOME (/opt/oracle/10g) and save the file.

Create a startup script found in /etc/init.d/ named dbora. The following script is taken here. Take note of the ORACLE_HOME and ORACLE_SID variables.

#!/bin/bash
#
# /etc/init.d/dbora
#
# Startup script for Oracle databases

export ORACLE_HOME=/opt/oracle/10g
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin

case "$1" in
start)
echo -n "Starting Oracle: "
su oracle -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle

su oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n "Shutdown Oracle: "
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
echo "OK"
;;
*)
echo "Usage: 'basename $0' start|stop"
exit 1
esac
exit 0

Modify the file so it is executable

sudo chmod 775 /etc/init.d/dbora

Register it in Ubuntu’s startup script by running the following:

sudo update-rc.d dbora defaults 99

Everything should be working as is. Try to access Enterprise Manager by accessing port 1158 (default) through HTTP.