Oracle10g on Debian Linux HOWTO

Is running Oracle10g on Debian Linux possible? Oh yes, definitely! And it runs great, really. It's even easier to install than the older versions of Oracle as there are no problems with incompatible libc library & other bugs. You need to make just two simple preparations before you can enjoy your new development database.

Important note: I tested this only on the Debian unstable distribution and only with the 2.6 kernel, as that's what I'm running. I believe that most of you that are running Debian unstable are also running the newest stable kernel, so that shouldn't be a problem, right? Let's go step by step...


1) As Oracle10g is certified only on Redhat Enterprise Linux and United Linux you will get this error when you run Oracle's runInstaller, and installation will stop:

Checking operating system version: must be redhat-2.1, UnitedLinux-1.0 or redhat-3

Failed <<<<

Solution: You should be able to do just

runinstaller -ignoreSysPrereqs

and then installer won't check for the operating system. Tip by Wim Coekaerts.


2) Oracle10g is able to utilize so called hugetlbpages, a feature that was added in the 2.6 Linux kernel, but is also available as a backport in RHEL 3 (which uses 2.4 kernel). Feature is enabled by default. Effectively, instead of using standard 4KB pages (on standard 32bit x86 architecture), with hugetlbpages functionality enabled pagesize will rocket to 4MB and thus save you a lot of CPU cycles which would otherwise be spent managing many smaller pages. Another good thing is that it will save some of your precious physical memory because there will be less pagetables for kernel to worry about. That is more true as you have more memory dedicated to the database and/or more clients connected to it. Trying to run Oracle installation on a standard Linus kernel you will get you the following error during creation of the initial database:

ORA-27125: unable to create shared memory segment

Solution A: To enable hugetlbpages, first you need 2.6 kernel, and then you need to recompile it with the following config options enabled:

CONFIG_HUGETLB_PAGE=y
CONFIG_HUGETLBFS=y

The second one is not strictly needed, but it won't hurt.

You will also need a small patch that is attached at the bottom of this page (hugetlbs-permitall.patch). It enables ordinary users (beside superuser) to create and allocate hugetlbpages. It might be a security risk, so be careful! After you reboot your newly compiled kernel, there's one more thing you need to do. Now that you have enabled hugetlbpages support, you need to tell kernel how many pages you will need. You can do that manually like this:

echo "64" > /proc/sys/vm/nr_hugepages

and then you will get your hugetlbpages after every reboot. It is quite important to request hugetlbpages shortly after boot, before system memory gets fragmented. To check that you have succeeded, run:

grep Huge /proc/meminfo

You should get output similar to this:

HugePages_Total: 64
HugePages_Free: 0
Hugepagesize: 4096 kB

As you can see, my Oracle is happily running (there are 64 pages in total, but none of them are free because Oracle has allocated all of them).

In my example I have configured Oracle to use slightly less than 256MB of memory for its SGA (Total System Global Area 264241152 bytes). That is deliberate as I have dedicated 256MB of memory to hugetlbpages (64 pages * 4MB page = 256MB). You'll need to figure out for yourself how much memory you're willing to let Oracle database use. Keep in mind that the memory allocated to hugetlbpages is unavailable to the rest of the system!

Solution B: You can also disable hugetlbpages and thus save you from some hassle. Theoretically, you'll loose some performance too, but don't lose sleep over that fact. Just do

export DISABLE_HUGETLBFS=1

before starting installer or dbca or whatever. Then Oracle won't use SHM_HUGETLBFS during call to shmget(). Another fine tip by Wim Coekaerts.


3) David Mansfield reports that when creating initial database using dbca, he gets the ORA-27125 error. He figured out why: "dbca (a java program) needs to startup the oracle binary to create the instance. When it starts it (and fails) you can verify using /proc that the environment DOES NOT contain the DISABLE_HUGETLBFS=1 environment variable. For some reason, java drops this environment variable, and hence the startup fails."

He also offers a solution for this problem:

cd $ORACLE_HOME/bin
mv oracle oracle.bin
cat >oracle <<"EOF"
#!/bin/bash

export DISABLE_HUGETLBFS=1
exec $ORACLE_HOME/bin/oracle.bin $@
EOF

chmod +x oracle

He adds: "In fact, this only needs to be done when creating the database (under dbca). After the creation is done, and further startups occur from the shell, there is no problem."


4) Starting with the 2.6.7 kernel, kernel developers have added /proc/sys/vm/hugetlb_shm_group control over who can allocate hugetlbpages. I presume this means that my patch above is not needed anymore, and that you need just to

echo "<dba_group_gid>" > /proc/sys/vm/hugetlb_shm_group

to get Oracle working with hugetlbpages enabled. I haven't tried it personally, but other people report that it works.
5) Jochen Roemling reports that he got two linker errors while installing Oracle 10.1.0.2 on Debian testing (2.6.7 kernel).

The first one is:

Linking hsodbc agent
rm -f /opt/oracle/Ora10g/rdbms/lib/hsodbc
gcc -o /opt/oracle/Ora10g/rdbms/lib/hsodbc -L/opt/oracle/Ora10g/rdbms/lib/
-L/opt/oracle/Ora10g/lib/ -L/opt/oracle/Ora10g/lib/stubs/
/opt/oracle/Ora10g/hs/lib/hsodbc.o
/opt/oracle/Ora10g/rdbms/lib/defopt.o
/opt/oracle/Ora10g/rdbms/lib/homts.o
-L/opt/oracle/Ora10g/lib/ -lnavhoa -lhsnav -lhsbase -lagtsh -lpls10
-lplp10 -lclntsh -lcore10 -lxml10 -lunls10 -lsnls10 -lnls10 -lcore10
-lnls10 /opt/oracle/Ora10g/lib/libgeneric10.a `cat
/opt/oracle/Ora10g/lib/sysliblist` -Wl,-rpath,/opt/oracle/Ora10g/lib
-lm `cat /opt/oracle/Ora10g/lib/sysliblist` -ldl -lm
-L/opt/oracle/Ora10g/lib -lvsn10
/opt/oracle/Ora10g/hs/lib/hsodbc.o(.text+0xcd): In function `shorm':
: undefined reference to `homtiap_InitAgentProcess'
/opt/oracle/Ora10g/hs/lib/hsodbc.o(.text+0x105): In function `shorm':
: undefined reference to `horer_RegisterInternalModule'
/opt/oracle/Ora10g/hs/lib/hsodbc.o(.text+0x110): In function `shorm':
: undefined reference to `hortr_RegisterTransactionModule'
/opt/oracle/Ora10g/hs/lib/hsodbc.o(.text+0x11b): In function `shorm':
: undefined reference to `horsr_RegisterSqlModule'
/opt/oracle/Ora10g/hs/lib/hsodbc.o(.text+0x126): In function `shorm':
: undefined reference to `horcrrcm_RegisterCalloutModule'

The second one is:

Linking external procedure agent (/opt/oracle/Ora10g/rdbms/lib/extproc)
rm -f /opt/oracle/Ora10g/rdbms/lib/extproc
gcc -o /opt/oracle/Ora10g/rdbms/lib/extproc
-L/opt/oracle/Ora10g/rdbms/lib/ -L/opt/oracle/Ora10g/lib/
-L/opt/oracle/Ora10g/lib/stubs/ /opt/oracle/Ora10g/rdbms/lib/hormc.o
/opt/oracle/Ora10g/rdbms/lib/defopt.o
/opt/oracle/Ora10g/rdbms/lib/homts.o -lagtsh -lpls10
-lplp10 -lclntsh -lcore10 -lxml10-lunls10 -lsnls10 -lnls10 -lcore10
-lnls10 /opt/oracle/Ora10g/lib/libgeneric10.a `cat
/opt/oracle/Ora10g/lib/sysliblist` -Wl,-rpath,/opt/oracle/Ora10g/lib
-lm `cat /opt/oracle/Ora10g/lib/sysliblist` -ldl -lm
-L/opt/oracle/Ora10g/lib -lvsn10
/opt/oracle/Ora10g/rdbms/lib/hormc.o(.text+0xb6): In function `shorm':
: undefined reference to `homtiap_InitAgentProcess'
/opt/oracle/Ora10g/rdbms/lib/hormc.o(.text+0xee): In function `shorm':
: undefined reference to `horcrrcm_RegisterCalloutModule'
/opt/oracle/Ora10g/rdbms/lib/hormc.o(.text+0x105): In function `shorm':
: undefined reference to `homtwfr_WaitForRPCs'
/opt/oracle/Ora10g/rdbms/lib/hormc.o(.text+0x11a): In function `shorm':
: undefined reference to `homtcap_CleanupAgentProcess'
collect2: ld returned 1 exit status
make: *** [/opt/oracle/Ora10g/rdbms/lib/extproc] Error 1

He suggests a solution (that is also on Metalink):

export LD_LIBRARY_PATH=$ORACLE_HOME/lib
ln -s /usr/bin/basename /bin/basename
ln -s $ORACLE_HOME/lib/libclient10.a $ORACLE_HOME/lib/libagtsh.a
$ORACLE_HOME/bin/genagtsh $ORACLE_HOME/lib/libagtsh.so 1.0

Finally, add a -lnro10 to the second gcc statement, and then you can re-run the two gcc statements and they will complete without error.


6) This tip is not for Debian users, but I'll put it anyway because it might help some Suse 9.1 user. People on the various forums report that the following works for Suse 9.1:

echo "1" > /proc/sys/vm/disable_cap_mlock

Thanks for this tip goes to Ulrich Dunnebeil.
7) Jay Strauss reports:

Just installed 10.1.0.3 without a hitch. It even went through the dbca successfully. Figured I'd give you my scripts:

First I do this as root inside a script:

# Some of these may not be absolutely necessary for installing
# Oracle, but I needed them for some other stuff
apt-get install --yes \
autoconf \
automake \
binutils \
bzip2 \
doxygen \
gcc \
less \
libc6-dev \
make \
perl-doc \
unzip \
zlibc \
x-window-system

size=`dmesg | egrep 'Memory.*available' | perl -ne '/\/(\d+)/; $_ = ($1 / 2) * 1024; print $_ > 268435456 ? $_ : 268435456'`

echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = $size" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "fs.file-max = 65536" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf

echo "* soft nproc 2047" >> /etc/security/limits.conf
echo "* hard nproc 16384" >> /etc/security/limits.conf
echo "* soft nofile 1024" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf

perl -i.bak -ne 'if (/session\s+required\s+pam_limits.so/) {s/^#\s+//}; print $_' /etc/pam.d/login

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

reboot

Then I do this as oracle:

cd /mnt/fe/tmp/Disk1 # this is where I decompressed the oracle dist

echo -n "Enter ORACLE_BASE: "
read ORACLE_BASE
export ORACLE_BASE

echo -n "Enter ORACLE_SID: "
read ORACLE_SID
export ORACLE_SID

export ORACLE_HOME=$ORACLE_BASE/product/10.1.0.3
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

# workaround for bug in 10g
export DISABLE_HUGETLBFS=1

./runInstaller -ignoreSysPrereqs

# There is another bug, dbhome points at /var/opt/oracle/oratab
# but the install builds the oratab in /etc/oratab
echo remember to modify dbhome to point at /etc/oratab


Related:
A First Look at Oracle 11g database on Debian GNU/Linux
AttachmentSize
hugetlbfs-permitall.patch383 bytes

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Oracle 10g on Linux Ubuntu 64 bits

Dears,

Thanks for this tutorial.

I have spent a lot of time trying to install Oracle 64 bits (enterprise or standard edition) on Linux Ubuntu 64 bits.

I have written a tutorial which describes the full process and a lot of issues that may appear.

Also another tutorial can be found here

Hope it may help.

oracle startup

First of all thank you for your useful guide. I maganed to install oracle on a debian 64 bit operating system.

I am currently having a problem: the oracle services are not starting up at system boot time. what could be the problem? in /etc/init.d there's nothing related to oarcle.

Startup script

I'm not currently playing with oracle, but here is something that I was using few years ago to start/stop oracle. You need to put this script to /etc/init.d and make proper links in your /etc/rc?.d directories. And tune those environment variables at the beginning of the script to suit your installation, of course. Hope it helps.


#! /bin/sh
#
# Oracle Server startup/shutdown script
#

DESC="Oracle Server"
ORACLE_BASE="/ext/oracle"
ORACLE_HOME="$ORACLE_BASE/orahome"
ORACLE_SID="atlas"

PATH="$ORACLE_HOME/bin:/sbin:/bin:/usr/sbin:/usr/bin"

export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

run_as_ora()
{
        su oracle -c "PATH=$ORACLE_HOME/bin:$PATH; $1" >/dev/null 2>&1
}

dostart()
{
        echo -n "Starting $DESC: rdbms"
        run_as_ora 'sqlplus "/ AS SYSDBA"' <<- EOF
                STARTUP;
        EOF
        echo -n " tnslsnr"
        run_as_ora "lsnrctl start"
        echo "."
}

dostop()
{
        echo -n "Stopping $DESC: tnslsnr"
        run_as_ora "lsnrctl stop"
        echo -n " rdbms"
        run_as_ora 'sqlplus "/ AS SYSDBA"' <<- EOF
                SHUTDOWN IMMEDIATE;
        EOF
        echo "."
}

case "$1" in
start)
        dostart
        ;;
stop)
        dostop
        ;;
restart)
        dostop
        dostart
        ;;
*)
        echo "Usage: /etc/init.d/oracle {start|stop|restart}"
        exit 1
        ;;
esac

exit 0

thank you

Thank you. Loved your elegant script (i found some similar scripts googling around, none as elegant as your's though). Made my own based on your's.

Another problem i had was that the script ORACLE_HOME/bin/dbstart did not work due to a badly hardcoded value in the script. I changed the line 78 (if i remember correctly ) from

ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
to
ORACLE_HOME_LISTNER=$ORACLE_HOME

I also edited /etc/oratab so the right database is loaded (putting an Y instead of N on the Line with the SID of my database).

Hope this helps someone having similar problems as i had...

Thaks again for your help.

YES!!!

No issues on Ubuntu Hardy 8.04.1 (2.6.24-19-generic kernal)

THANK YOU!!!

look this nice oracle tutorials

look this nice oracle tutorials installing oracle XE in debian

Read Full article here

about part 1, skipping the prerequisites

instead of skipping the prerequisites alltogether, you can comment out the lines in oraparam.ini (in a deeper directory) about the required distribution, leaving the rest of the prerequisites intact, which might provide you some important information.

This article saved my evening: after upgrading the stock kernel in Suse Linux Enterprise Server (SP2) with the newest 2.6.30.5, (VirtualBox environment) Oracle didn't work (ora-27125), part 4 of this article did the trick on its own, thanks for that!