Installation of Oracle10g Express Edition on FreeBSD 5.4-RELEASE

Dmitry Ganenko dima at apk-inform.com
Fri Jun 23 11:33:58 UTC 2006


Introduction

It is impossible to hold in check a tear of tender emotions while
reading a press release of the Oracle Corporation:

"REDWOOD SHORES, California, Moscow, November,10, 2005 - the Oracle
Corporation announced  the release of Oracle Database 10g Express
Edition (Oracle Database XE),a free version of the world-wide known
DBMS for developers. The Beta-version of Oracle Database XE can be
loaded from the website of the Corporation.
New edition of DBMS Oracle Database 10g enables software developers,
DB administrators and all those using the Oracle technology for the
first time to get a free basic version of the DBMS which allows
starting developing and expansion of their own applications. Besides,
this version is proposed free to independent software developers and
equipment suppliers for free distribution and embedding into their own
applications.
"Oracle Database XE enables developers, DB administrators, independent
software suppliers and students to study, create and develop their own
applications on the basis of the most advanced DBMS for free", says
Thomas Kyte, the Oracle vice- president. "Nobody has ever supposed
such a thing - anybody is able to start his work with the best market
solution."

You see, the most advanced Oracle has come nearer to common people.
But as usually it has been nearer to Windows and Linux users. All the
best is for children! But why are we worse? So, students, developers,
administrators, let us start!


1. Playing the role of kernel hackers

First of all, we should patch kernel - just a little. Having tried to
launch oracle for some days with the following actions: using ktrace -
kdump; then (after having guessed to pay attention on ports and
joyfully detected linux_kdump there) using the last one; rummaging in
kernel sources; scratching the back of your head; murmuring quietly
abusive words about Oracle Corporation programmers, FreeBSD
developers, Linus Torvalds, Larry Ellison and, of course, Bill Gates
(nobody knows why him exactly!); dreaming in nightmares about teenage
Daemons with pitchforks which fight with Penguins in red caps and then,
after a short reconciliation, crash windows throughout all the
Silicone Valley - at last you are to recognize: the kernel should be
unbent, it really should!

The first patch corrects the error in the  Linux emulator in the
linux_time() function (or maybe it is not an error)

File patch1
 
--- compat/linux/linux_misc.c.orig      Fri Apr  1 01:17:42 2005
+++ compat/linux/linux_misc.c   Wed Jun 21 11:14:05 2006
@@ -711,8 +711,9 @@ linux_times(struct thread *td, struct li
        tms.tms_cutime = CONVTCK(td->td_proc->p_stats->p_cru.ru_utime);
        tms.tms_cstime = CONVTCK(td->td_proc->p_stats->p_cru.ru_stime);
 
-       if ((error = copyout(&tms, args->buf, sizeof(tms))))
-               return error;
+       if (args->buf != NULL)
+               if ((error = copyout(&tms, args->buf, sizeof(tms))))
+                       return error;
 
        microuptime(&tv);
        td->td_retval[0] = (int)CONVTCK(tv);

The second patch is for linprocfs. Don't ask me why it should be done
exactly this way. It was found experimentally and by peeping into
SuSE Linux 9.2 (It works somehow there...)

File patch2

--- compat/linprocfs/linprocfs.c.orig   Fri Apr  1 01:27:16 2005
+++ compat/linprocfs/linprocfs.c        Wed Jun 21 11:14:10 2006
@@ -515,7 +515,7 @@ linprocfs_doprocstat(PFS_FILL_ARGS)
        sbuf_printf(sb, "%d", p->p_pid);
 #define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
        PS_ADD("comm",          "(%s)", p->p_comm);
-       PS_ADD("statr",         "%c",   '0'); /* XXX */
+       PS_ADD("statr",         "%c",   'S'); /* XXX */
        PS_ADD("ppid",          "%d",   p->p_pptr ? p->p_pptr->p_pid : 0);
        PS_ADD("pgrp",          "%d",   p->p_pgid);
        PS_ADD("session",       "%d",   p->p_session->s_sid);
@@ -535,7 +535,7 @@ linprocfs_doprocstat(PFS_FILL_ARGS)
        PS_ADD("priority",      "%d",   0); /* XXX */
        PS_ADD("timeout",       "%u",   0); /* XXX */
        PS_ADD("itrealvalue",   "%u",   0); /* XXX */
-       PS_ADD("starttime",     "%d",   0); /* XXX */
+       PS_ADD("starttime",     "%d",   1); /* XXX */
        PS_ADD("vsize",         "%ju",  (uintmax_t)kp.ki_size);
        PS_ADD("rss",           "%ju",  P2K((uintmax_t)kp.ki_rssize));
        PS_ADD("rlim",          "%u",   0); /* XXX */

The third patch corrects a bug (or maybe a feature) in the pseudofs
code (it is necessary for linprocfs). The case is, if you assemble
linprocfs and try such a program, then the read function will read not
4 as it was asked but one point less, that is, as it is easily
calculated, 3 bytes:

File test.c

#include <sys/types.h>
#include <sys/uio.h> 
#include <unistd.h> 
#include <fcntl.h> 

main () { 
 int fd, count;
 char buf[10];

 fd = open("/compat/linux/proc/self/cmdline", O_RDONLY);
 count = read(fd, buf, 4);
 buf[4] = '\0';
 printf("count = %d, buf = %s\n", count, buf);
}

I am not sure whether the third correction is absolutely right;
moreover, I am not sure as to its place in the code. This question is
to real kernel hackers.

File patch3

--- fs/pseudofs/pseudofs_vnops.c.orig   Mon Sep  6 22:38:01 2004
+++ fs/pseudofs/pseudofs_vnops.c        Wed Jun 21 11:14:14 2006
@@ -530,7 +530,7 @@ pfs_read(struct vop_read_args *va)
                        PRELE(proc);
                PFS_RETURN (EIO);
        }
-       sb = sbuf_new(sb, NULL, buflen, 0);
+       sb = sbuf_new(sb, NULL, buflen+1, 0);
        if (sb == NULL) {
                if (proc != NULL)
                        PRELE(proc);

We correct our kernel:

# cp patch1 patch2 patch3 /usr/src/sys
# patch < patch1
# patch < patch2
# patch < patch3

Then (it goes without saying)as it has always been done for Oracle
launching not only in FreeBSD, but also on Linux itself, we add the
following to the configuration of the core:

options   COMPAT_LINUX #it is as you would like it, you may load the module
options   SEMMAP=128
options   SEMMNI=128
options   SEMMNS=32000
options   SEMOPM=100
options   SEMMSL=250
options   SHMMAXPGS=262144
options   SHMMNI=4096
options   SHMSEG=4096
options   MAXDSIZ="(1024*1024*1024)" # as to this and what is below I am not sure
options   MAXSSIZ="(1024*1024*1024)"
options   DFLDSIZ="(1024*1024*1024)"

So, we compile, install, reboot... and go on.
        

2. We install the right linux_base

Though it is written in the Oracle10g Express Edition Installation
instruction that the glibc version should be  >=2.3.2, it seems to be
naive to believe everything that is written. It is going to work with
the version >=2.3.3. Anyhow, mine didn't start working. At binary
launching something told me about a relocation error and mentioned
some symbols GLIB_2.3.3 or something of the kind. That is why instead
of linux_base-8 you should install linux_base-fc4 (or linux_base-suse-9.2).

# cd /usr/ports/emulators/linux_base-fc4
# make
# make install

Then we find somewhere libaio-0.3.104-2.i386.rpm for FC4 and install
it with the help of rpm

# rpm --root=/compat/linux --ignoreos --ignorearch --nodeps -ivh libaio-0.3.104-2.i386.rpm

You also should mount linux procfs

# echo "linproc /compat/linux/proc linprocfs rw 0 0" >> /etc/fstab
# mount /compat/linux/proc


3. We install Oracle10g Express Edition

We take distributive Oracle XE for linux86
(oracle-xe-univ-10.2.0.1-1.0.i386.rpm) from otn.oracle.com. Of course,
you may also take distributive for Win32, but anything written above
or below will have nothing to do with it.
Install it with rpm:

# rpm --root=/compat/linux --ignoreos --ignorearch --noscripts --nodeps -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm

It is installed in  /compat/linux/usr/lib/oracle, but it is unlikely
to work. You should replace it into /usr/lib/oracle with no
variations. It is assembled by this path, this bright path is
registered everywhere in scripts, so you  have nothing to do but agree
with it:

# mv /compat/linux/usr/lib/oracle /usr/lib

We launch the following script, answer two or three questions and go
out to smoke. (If you are a non-smoker, you may have a cup of tea or
coffee). Smoking should be fast, tea or coffee should be gulped
because in some two minutes you will have Oracle10g Express Edition
installed and working at your FreeBSD; moreover, you'll be able to use
it any way, absolutely free, with your favorite operational system.

File install.sh
skipped (it is not interesting, and so long).
You may found it and patches in the attached file.

PS.

This article in russian you may also read here
http://wiki.bsdportal.ru/doc:oraclexe_on_freebsd



With best regards
Dmitry Ganenko <dima at apk-inform.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: orainst.tar.gz
Type: application/octet-stream
Size: 4008 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20060623/8d31d1e5/orainst.tar.obj


More information about the freebsd-emulation mailing list