Archive for the ‘Oracle’ Category

Oracle 10g on Debian 64bit (32 bit as well)

April 5, 2010

Preparing the system
We will have to:

* Create required users and groups accounts
* Set required system parameters in /etc/sysctl.conf
* Installing complementary packages

Creating Oracle Inventory and dba group:

sudo groupadd oinstall
sudo groupadd dba

Creating Oracle user home and account:

sudo useradd -g oinstall -G dba -d /opt/oracle -s /bin/bash oracle
sudo chown -R oracle:oinstall /opt/oracle

Adding nobody group to nobody user:

sudo addgroup nobody
sudo usermod -g nobody nobody

Updating kernel parameters

This is one of the longest task of this installation. Because you will have to check your current config.
Check commands in Oracle documentation for this, section 6 Configuring Kernel Parameters.

Then, edit the file /etc/sysctl.conf as described below:

sudo gedit /etc/sysctl.conf

Add the following lines:

# Oracle 10g
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 32768 65000
# Replace kernel.shmmax with the half of your memory in bytes
# 1073741824 is 1 GigaBytes
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
# To allow dba to allocate hugetlbfs pages
# 1002 is your DBA group, id. grep dba /etc/group will give this value
vm.hugetlb_shm_group = 1002

Must adjust the kernel.shmmax parameter rest works with default value.

sysctl -p to activate the new value
sysctl -a to list the value already set


This is needed on Ubuntu Karmic and was not required on Ubuntu Jaunty (kernel parameters were apparently different).

Without this parameters your Oracle instance won’t start.

You have to replace the value of 1002 with the group ID of the DBA group.

Read this great howto install Oracle on debian to know more about huge tlb parameter.

Now, update /etc/security/limits.conf:

sudo gedit /etc/security/limits.conf

And add the following parameters:

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

Check that /etc/pam.d/login contains a line like this one:

session required

Installing additional packages

If not already done, update your distribution with the latest packages:

sudo apt-get update
sudo apt-get dist-upgrade

Install the following additional packages:

sudo apt-get install gcc make binutils gawk x11-utils rpm alien ksh lsb-rpm
sudo apt-get install autotools-dev libltdl-dev
sudo apt-get install –yes autoconf automake binutils bzip2 doxygen gcc less libc6-dev make perl-doc unzip zlibc
sudo apt-get install libaio1 lesstif2 libmotif3 libaio-dev

# Some of the ones below may not be needed, but as of many failures before getting it doing right, all these have been installed.
sudo apt-get install libpthread-stubs0 libpthread-stubs0-dev libpth-dev libc6-i386 libc6-dev-i386
sudo apt-get install g++-multilib gcc-multilib

And also these below to try to get ride of link errors.

sudo aptitude install lesstif2-dev lib32stdc++6 lib32z1 sysstat rlwrap unixodbc unixodbc-dev elfutils
sudo apt-get install gsfonts-x11 java-common sun-java6-bin sun-java6-jre

And to prevent from runInstaller terrific ./runInstaller: line 54: ./install/.oui: No such file or directory error message:

sudo apt-get install ia32-libs

Oracle 10g also needs libstdc++5 that is not provided with Debian.

There are many ways to install it,
Simply apt-get install libstdc++5 should work with Debian

But you can follow this too
I have followed this howto to install libstdc++5 on Ubuntu Karmic

mkdir /tmp/libstdc++5
cd /tmp/libstdc++5

sudo dpkg –force-architecture -i libstdc++5_3.3.6-17ubuntu1_i386.deb
sudo mv /usr/lib/* /usr/lib32/

sudo dpkg -i libstdc++5_3.3.6-17ubuntu1_amd64.deb

Now reboot your system to be sure these parameters will be taken in account for the next part of the installation.

Others configurations

Now, change default sh script by bash:

sudo ln -sf /bin/bash /bin/sh

Then some others commands used by Oracle installer:

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

Installing Oracle

extract the downloaded file:

cpio -idmv < 10201_database_linux_x86_64.cpio

./runInstaller -ignoreSysPrereqs

Starting and stopping Oracle

We should now be able to start Oracle database if you had choosed to create one during installation. Yes go to next section Creating an Oracle database and come back.

First, add the following variable declaration in your oracle user .profile, .bashrc or .bash_profile scripts:

export PATH=$PATH:/usr/local/bin

if [ -f /usr/local/bin/oraenv ];then
. /usr/local/bin/oraenv

Starting up the database

Finally, to manually start Oracle, run these commands as oracle user

lsnrctl start

You may encounter this error Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr.

Also your database may not start.
Then, first check in /etc/oratab that it has the ‘Y’ flag, if not, set it.

sudo gedit /etc/oratab

And replace N by Y


To get ride of this the Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr message, edit dbstart script and replace the hardcoded path with $ORACLE_HOME


And edit this part of script

# Set this to bring up Oracle Net Listener

Connecting to the database

Now, just try to connect to the freshly started database:

oracle@ubuntu-laptop:~/oracle10gse/product/10.2.0/db_1/log$ sqlplus system@orcl
SQL*Plus: Release – Production on Thu Feb 11 12:01:24 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Release – 64bit Production
SQL> select ‘Oracle 10g is working on Debian 5.0’ as SUCCESS from dual;
Oracle 10g is working on Debian 5.0

Shutting down the database

Just entry the following commands with Oracle user:

lsnrctl stop


Oracle 10g installation on Solaris

October 13, 2009

# Pre-installation task:

# First of all following users and groups should be created

1. Group dba, oper (optional), oinstall
2. user oracle having oinstall as primary group

use the following commands to create required groups and user (as root user)

groupadd oinstall

groupadd dba
groupadd oper
useradd -g oinstall -G dba[,oper] -d /export/home/oracle -s /usr/bin/bash -m oracle
passwd -r files oracle

# if user nobody exists then

useradd nobody

# Now create a project for oracle so that all resources can be alloacated to this project as root user

projadd oracle

# kernel parameters: oracle recommends the following kernel parameters to be set to recommended value
# the values can be set in /etc/system file in solaris as the following syntax
# set parameter-name=value
# editing system file is deprecated and solaris recommends using projmod command to do so

1. Parameter Replaced by Resource Control Recommended Value

noexec_user_stack NA 1
semsys:seminfo_semmni project.max-sem-ids 100
semsys:seminfo_semmns NA 1024
semsys:seminfo_semmsl project.max-sem-nsems 256
semsys:seminfo_semvmx NA 32767
shmsys:shminfo_shmmax project.max-shm-memory 4294967295
shmsys:shminfo_shmmin NA 1
shmsys:shminfo_shmmni project.max-shm-ids 100
shmsys:shminfo_shmseg NA 10

# you can view the current values of this parameters as follows

prctl -n project.max-shm-memory -i project oracle

# you can set the values permanently by the following command (as root)

projmod -sK “project.max-shm-memory=(privileged,2G,deny)” oracle

# Directories

# create ORACLE_BASE directory

mkdir -p /mount_point/app/oracle_sw_owner
chown -R oracle:oinstall /mount_point/app/oracle_sw_owner
chmod -R 775 /mount_point/app/oracle_sw_owner

# now export the base directory as environment variable which will let oracle installer to handle
# creation of oracle_home and oraInventory directory

export ORACLE_BASE=/mount_point/app/oracle_sw_owner

# Storage option :

# if you plan to use file system as database storage you have to do the following. It is good practice
# that the database storage be in separate file system (i.e. in separate partition)

mkdir /mount_point/oradata
chown oracle:oinstall /mount_point/oradata
chmod 775 /mount_point/oradata

# if you plan to use recovery then you have to create a flash_recovery area

mkdir /mount_point/flash_recovery_area
chown oracle:oinstall /mount_point/flash_recovery_area
chmod 775 /mount_point/flash_recovery_area

# If you plan to use Automatic Storage Management (ASM) as storage option then you have to create a disk group and
# instance. you have to do the following in case of creating a disk group consisting of only one solaris partition/slice.
# To do so, first check whether the partition is mounted or not by

df -k

# if the partition is mounted then unmount it and remove the entry corresponding to that partition from /etc/vfstab

# now you set the ownership and permission of the partiton to oracle as follows (replace c0d0s4 accordingly)

chown oracle:dba /dev/dsk/c0d0s4
chmod 660 /dev/dsk/c0d0s4

# Now you have to set some environment variables for user oracle. edit the file .profile in oracle’s home diectory
# invoke

vi ~/.profile

umask 022

# activate this changes without restarting or relogin by invoking

. ./.profile

# To verify that the environment has been set correctly, enter the following commands. the first
# command will output 0022 and second will show the list of env. variables.

env | more

# Now run the oracle universal installer invoking …


# Universal Installer choice

1. Installation Method – Basic – /path/to/orahome – DBA group oinstall should be selected.
2. Inventory Directory – /path/to/inventoryDir – gorup oinstall need to be selected
3. Product-specific – see if every check succeded
4. make note of URLs of various web-based tools

# Installing Automatic storage management (single partition as disk group)

1. run universal installer
2. select Advanced Installation
3. specify home directory
4. select Configure … ASM in configuration option screen
5. Provide Disk group name
6. Redundancy level-external
7. The partition u have prapared earlier will appear as the candidate disk. select it and press next

# In database creation screen make note of database SID.
# After installation is finished the installer provides three URL’s

http://urmachine:1158/em (which is oracle enterprise manager)
http://urmachine:5560/isqlplus (iSQL*Plus web interface)
http://urmachine:5560/isqlplus/dba (iSQL*Plus DBA web interface)

# use first link and create a user and using that username and password u can login to second url
# and invoke sql statements using the web interface.

# the third url is for those users with dba privileges. this URL requires server authentication.
# to use this URL u have to create in iSQL*Plus DBA realm in oracle http server and grant webDba
# role to that user. To do so follow the following steps.

cd /path/to/oracle/home/ (i.e. $ORACLE_BASE/oracle/product/10.2.0/db_1)
cp oc4j/j2ee/isqlplus/application-deployments/isqlplus/config/jazn-data.xml config/
cp oc4j/j2ee/isqlplus/application-deployments/isqlplus/config/jazn.xml config/
jdk/bin/java$ORACLE_HOME/oc4j/j2ee/home/config/ -jar \
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user “iSQL*Plus DBA/admin” -password welcome -shell

# this will start the oracle server’s authorization provider’s (JAZN) shell


# at that shell invoke the following

jazn> adduser “iSQL*Plus DBA” username password
jazn> grantrole webDba “iSQL*Plus DBA” username

# check that that ur user is created

jazn> listusers “iSQL*Plus DBA”

# Now login with the username and password u’ve just created in the 3rd URL that oracle installer provided.
# u have to provide sysdba username and password again.

# We are almost done with oracle 10g basic installation in solaris. One problem I have encountered is that
# when I restarted my machine after installation I couldnot connect to database with the URLs. the following
# error show..

ORACLE not found. ORA-…. shared memory realm does not exist .Error 2. no such file or directory.

# this is because after reboot the database instance is not started. so to have all things starts up in system bootup
# provide a script as follows. before that you have to do something…

# open the file /var/opt/oracle/oratab in your favourite editor. at the end of this file all the databases are listed like this


# if you install 2 database then you’ll have 2 such lines in this file .if the lines contain N at the end this means
# this database won’t be started during system bootup. change it to Y as above to make the database instance to start
# at system bootup

vi /etc/init.d/dbora

if [ ! -f $ORA_HOME/bin/dbstart ]
echo “Oracle startup: cannot start”
case “$1″ in
’start’) # Start the Oracle databases and listeners
su – $ORA_OWNER -c “$ORA_HOME/bin/dbstart $ORA_HOME”
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start LISTENER”
su – $ORA_OWNER -c “$ORA_HOME/bin/emctl start dbconsole”
su – $ORA_OWNER -c “$ORA_HOME/bin/isqlplusctl start”
’stop’) # Stop the Oracle databases and listeners
su – $ORA_OWNER -c “$ORA_HOME/bin/isqlplusctl stop”
su – $ORA_OWNER -c “$ORA_HOME/bin/emctl stop dbconsole”
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop”
su – $ORA_OWNER -c “$ORA_HOME/bin/dbshut $ORA_HOME”

# now change this ownership and permission as follows

chown root:sys /etc/init.d/dbora
chmod 744 /etc/init.d/dbora

# now do this so that this script is called everytime the system boots up or shuts down.

cp /etc/init.d/dbora /etc/rc0.d/K10dbora
chown root:sys /etc/rc0.d/K10dbora
chmod 744 /etc/rc0.d/K10dbora

cp /etc/init.d/dbora /etc/rc2.d/S99dbora
chown root:sys /etc/rc2.d/S99dbora
chmod 744 /etc/rc0.d/S99dbora

# one little thing just add the following things to ~/.profile of the user oracle

ORACLE_BASE=/path/to/oracle/base/u’ve/set/earlier; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=SID that you noted during installation; export ORACLE_SID
PATH=$PATH:/usr/local/bin:$ORACLE_HOME/bin; export PATH

# Now reboot your machine .. and you are done..