Slackware 10.2 and Oracle 9.2.0.4 + 9.2.0.7 patch on vanilla kernel 2.6
by dimka hAT freelsd DOT net

Some links:
O9i on SuSE Linux Enterprise Server 9 AMD (64-bit)
Installing Oracle Database 10g
Kernel Asynchronous I/O (AIO) Support for Linux
Async I/O for Oracle 9i Release 2 on RedHat 9, Kernel 2.6
Tuning and Optimizing Red Hat Linux Advanced Server for Oracle 9i Databases
Inst OA11 on linux (in russian)


NotFAQ:
1. Why Slack? -- Coz!
2. Why Oracle? -- Don't ask!
3. Why ...? -- maybe next time...

Files:

do not much trust for md5 .... be warned! ;)

$ md5sum ship_9204_linux_disk?.cpio.gz
11b664d2c8afed6d0886ec8a126ecdce  ship_9204_linux_disk1.cpio.gz
d17cb5e19c389f2648797259ee3453af  ship_9204_linux_disk2.cpio.gz
ba1c57d8ebbda9e039519dd785e0f2ac  ship_9204_linux_disk3.cpio.gz


this file not used, but present in dir.

$ md5sum p3948480_9206_LINUX.zip
bdf35918785e98358b9d35072e023319  p3948480_9206_LINUX.zip


this one will be our patch.

$ md5sum p4163445_92070_LINUX.zip
5b7ccdadeb153526baa01de6726dcde8  p4163445_92070_LINUX.zip


Target box:

Dual Xeon 3G, 8G RAM, 10 x SEAGATE ST373307LC (5 disk per SCSI channal)

# lspci
00:00.0 Host bridge: Intel Corp. E7501 Memory Controller Hub (rev 01)
00:00.1 Class ff00: Intel Corp. E7000 Series Host RASUM Controller (rev 01)
00:03.0 PCI bridge: Intel Corp. E7000 Series Hub Interface C PCI-to-PCI Bridge (rev 01)
00:03.1 Class ff00: Intel Corp. E7000 Series Hub Interface C RASUM Controller (rev 01)
00:1d.0 USB Controller: Intel Corp. 82801CA/CAM USB (Hub #1) (rev 02)
00:1d.1 USB Controller: Intel Corp. 82801CA/CAM USB (Hub #2) (rev 02)
00:1d.2 USB Controller: Intel Corp. 82801CA/CAM USB (Hub #3) (rev 02)
00:1e.0 PCI bridge: Intel Corp. 82801BA/CA/DB/EB PCI Bridge (rev 42)
00:1f.0 ISA bridge: Intel Corp. 82801CA LPC Interface Controller (rev 02)
00:1f.1 IDE interface: Intel Corp. 82801CA Ultra ATA Storage Controller (rev 02)
00:1f.3 SMBus: Intel Corp. 82801CA/CAM SMBus Controller (rev 02)
01:0c.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27)
02:1c.0 PIC: Intel Corp. 82870P2 P64H2 I/OxAPIC (rev 04)
02:1d.0 PCI bridge: Intel Corp. 82870P2 P64H2 Hub PCI Bridge (rev 04)
02:1e.0 PIC: Intel Corp. 82870P2 P64H2 I/OxAPIC (rev 04)
02:1f.0 PCI bridge: Intel Corp. 82870P2 P64H2 Hub PCI Bridge (rev 04)
03:02.0 RAID bus controller: LSI Logic / Symbios Logic PowerEdge Expandable RAID Controller 4 (rev 01)
03:04.0 SCSI storage controller: Adaptec AIC-7902 U320 (rev 03)
03:04.1 SCSI storage controller: Adaptec AIC-7902 U320 (rev 03)
04:05.0 Ethernet controller: Intel Corp. 82546EB Gigabit Ethernet Controller (Copper) (rev 01)
04:05.1 Ethernet controller: Intel Corp. 82546EB Gigabit Ethernet Controller (Copper) (rev 01)

# cat /proc/cpuinfo 
processor  : 0
vendor_id  : GenuineIntel
cpu family : 15
model   : 2
model name : Intel(R) Xeon(TM) CPU 3.06GHz
stepping   : 5
cpu MHz    : 3056.848
cache size : 512 KB
physical id : 0
siblings   : 1
runqueue   : 0
fdiv_bug   : no
hlt_bug    : no
f00f_bug   : no
coma_bug   : no
fpu   : yes
fpu_exception : yes
cpuid level : 2
wp    : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips   : 6094.84
...
RAID settings:

Logical Drive 1:
RAID = 1
Size = 69878MB
Write Policy = WRBACK
Read Policy = ADAPTIVE
Cache Policy = CachedIO
#Stripes = 2
State = OPTIMAL

Logical Drive 2
RAID = 1
Size = 279512MB
StripeSize = 64KB
Write Policy = WRBACK
Read Policy = ADAPTIVE
Cache Policy = CachedIO
#Stripes = 2
State = OPTIMAL
Spans = 4

OK. lets do it.

1. Installed slackware 10.2

# cat /etc/slackware-version 
Slackware 10.2.0

# gcc -v
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.6/specs
Configured with: ../gcc-3.3.6/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.3.6



2. Get last one vanilla kernel linux-2.6.14.3.tar.gz

# cd /usr/src/
# rm linux
# tar xfz linux-2.6.14.3.tar.gz
# chown -R root:root linux-2.6.14.3
# ln -s linux-2.6.14.3 linux
# cd linux
# make menuconfig bzImage modules modules_install
# cp arch/i386/boot/bzImage /boot/linux26143
# vi /etc/lilo.conf
# lilo
# reboot


3. result

# uname -a
Linux server 2.6.14.3 #2 SMP Wed Dec 7 13:36:05 MSK 2005 i686 unknown unknown GNU/Linux

# grep processor /proc/cpuinfo # HT enabled. should i?
processor  : 0
processor  : 1
processor  : 2
processor  : 3

# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb2             24418048   1615604  22802444   7% /
/dev/sdb3             31502496     38072  31464424   1% /opt
none                   4158052         0   4158052   0% /dev/shm
/dev/sda1            281722564    131228 278729196   1% /raid


4. mount
/dev/sdb - raid 1 (2 disk) (raiserfs, why not?)
/dev/sda - raid 1 (8 disk) (ext3)


# mount
/dev/sdb2 on / type reiserfs (rw)
proc on /proc type proc (rw)
/dev/sdb3 on /opt type reiserfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
/dev/sda1 on /raid type ext3 (rw,noatime)

# cat /etc/fstab 
/dev/sdb1        swap             swap        defaults         0   0
/dev/sdb2        /                reiserfs    defaults         1   1
/dev/sdb3        /opt             reiserfs    defaults         1   2
/dev/cdrom       /mnt/cdrom       auto        noauto,owner,ro  0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
none             /dev/shm         tmpfs       defaults         0   0
/dev/sda1        /raid            ext3        defaults,noatime 1   2

# free
             total       used       free     shared    buffers     cached
Mem:       8283360    3992860    4290500          0      43104    3779756
-/+ buffers/cache:     170000    8113360
Swap:     15631204          0   15631204



5. configuring ntpd, upsd, rc.local, megamgr, etc.
....

6. sysctl.conf profile

# cat > /etc/sysctl.conf 
kernel.shmmax=2147483648
kernel.sem=250 32000 100 128
fs.file-max=65536
fs.aio-max-nr=1048576
net.ipv4.ip_local_port_range=1024 65000
^D

# sysctl -p

# cat >> /etc/profile
if [ "`id -u`" = "0" ]; then
  ulimit -n 65536
  ulimit -u 16384
fi
^D



7. oracle users and env

$ su - root
# groupadd dba
# groupadd oinstall
# useradd -g oinstall -G dba oracle -s /bin/bash
# passwd oracle
# mkdir /opt/oracle
# chown oracle:oinstall /opt/oracle

# cat >> /etc/profile
export ORACLE_HOME=/opt/oracle
export ORACLE_BASE=/opt/oracle
^D


8. prepare oracle for installing

workbox$ scp p4163445_92070_LINUX.zip ship_9204_linux_disk?* oracle@server:distr
workbox$ ssh oracle@server
$ cd distr
$ for i in ship_9204_linux_disk?*; do gzip -dc $i | cpio -idm; done
$ mkdir patch
$ cd patch
$ unzip ../p4163445_92070_LINUX.zip




9. libaio

# wget ftp://fr2.rpmfind.net/linux/fedora/core/development/SRPMS/libaio-0.3.104-2.src.rpm
# md5sum libaio-0.3.104-2.src.rpm
11edbd9417bd41acdbf880ec8d919c38  libaio-0.3.104-2.src.rpm
# rpm2tgz libaio-0.3.104-2.src.rpm
# tar xfz libaio-0.3.104-2.src.tgz 
# cd libaio-0.3.104-2
# tar xfz libaio-0.3.104.tar.gz
# cd libaio-0.3.104
# make prefix=/usr/local install
# ldconfig



10. libaio oracle wrapper

# wget http://oss.oracle.com/projects/libaio-oracle/dist/files/libaio-oracle-0.3.0.tar.gz
# md5sum libaio-oracle-0.3.0.tar.gz
165bbd6c75b8c1916e4b03988bafb372  libaio-oracle-0.3.0.tar.gz
# cd libaio-oracle-0.3.0
# ./configure
# make



11. installing workarounds libs 
libcwait.so - for java
libctype.so - for oracle


# gcc -O2 -shared -o /usr/local/lib/libcwait.so -fpic -xc - <<\EOF
#include <errno.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
pid_t
__libc_wait (int *status)
{
  int res;
  asm volatile ("pushl %%ebx\n\t"
                "movl %2, %%ebx\n\t"
                "movl %1, %%eax\n\t"
                "int $0x80\n\t"
                "popl %%ebx"
                : "=a" (res)
                : "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0),
                  "S" (0));
  return res;
}
EOF


# gcc -O2 -shared -o /usr/local/lib/libctype.so -fpic -xc - <<\EOF
#include <stdlib.h>
#include <ctype.h>
unsigned short int * __ctype_b;
unsigned short int * __ctype_tolower;
unsigned short int * __ctype_toupper;
void __attribute__((constructor)) my_init()
{
__ctype_b = (unsigned short int *)* __ctype_b_loc();
__ctype_tolower = (unsigned short int *)* __ctype_tolower_loc();
__ctype_toupper = (unsigned short int *)* __ctype_toupper_loc();
}
void __attribute__((destructor)) my_clean() {}
EOF

# ldconfig



12. check env for oracle user and run installing

workbox$ ssh oracle@server # with x11 forwarding

$ id
uid=1000(oracle) gid=222(oinstall) groups=221(dba),222(oinstall)

$ cat > .bash_profile
export LD_ASSUME_KERNEL='2.4.20'
export LD_PRELOAD=/usr/local/lib/libcwait.so
^D
$ ln -s .bash_profile .bashrc
$ . .bash_profile

$ echo $ORACLE_BASE
/opt/oracle
$ echo $ORACLE_HOME
/opt/oracle
$ echo $LD_ASSUME_KERNEL
2.4.20
$ echo $LD_PRELOAD      
/usr/local/lib/libcwait.so

$ cd distr/Disk1/
$ ./runInstaller 

... use dba group for database adminstration
... run /tmp/orainstRoot.sh in another xterm with root uid
... select server bla-bla-bla (first position)
... select enterprise (first position)
... select software only (last position)
... INSTALLING 
... wait error ... you can make a cup of coffe also.


13. stubs (we got errors)

$ mv /opt/oracle/lib/stubs /opt/oracle/lib/stubs.no
$ vi /opt/oracle/lib/sysliblist     # add " -lctype" at end of line.
$ cat /opt/oracle/lib/sysliblist    # result
-ldl -lm -lpthread -lnsl -lirc -lctype


... press Retry button in installer.
... wait for /opt/oracle/root.sh request, then run it under root uid.
... END OF INSTALLATION 9.2.0.4 (but without async mode)


$ mv /opt/oracle/lib/stubs.no /opt/oracle/lib/stubs  # need for patching

$ ldd /opt/oracle/bin/sqlplus
       /usr/local/lib/libcwait.so (0xb7f98000)
       linux-gate.so.1 =>  (0xffffe000)
       libclntsh.so.9.0 => /opt/oracle/lib/libclntsh.so.9.0 (0xb75c6000)
       libwtc9.so => /opt/oracle/lib/libwtc9.so (0xb75c3000)
       libdl.so.2 => /lib/libdl.so.2 (0xb75bf000)
       libm.so.6 => /lib/libm.so.6 (0xb759c000)
       libpthread.so.0 => /lib/libpthread.so.0 (0xb754b000)
       libnsl.so.1 => /lib/libnsl.so.1 (0xb7534000)
       libctype.so => /usr/local/lib/libctype.so (0xb7526000)
       libc.so.6 => /lib/libc.so.6 (0xb740d000)
       /lib/ld-linux.so.2 (0xb7f9a000)



14. patching 9.2.0.4 up to 9.2.0.7


$ cd ~/distr/patch/Disk1
$ oracm/runInstaller -ignoreSysPrereqs

... then instal new installer


$ ./runInstaller -ignoreSysPrereqs

... select path /opt/oracle
... after analyzing installed products installer will ask about patchset (first).
... wait for error 


$ mv /opt/oracle/lib/stubs /opt/oracle/lib/stubs.no
$ vi /opt/oracle/lib/sysliblist
$ cat /opt/oracle/lib/sysliblist
-ldl -lm -lpthread -lnsl -lirc -lctype
$


... press Retry

... run /opt/oracle/root.sh as root, then press ok

# /opt/oracle/root.sh

... The installation of Oracle 9iR2 Patch Set was successful.


15. lets remember about libaio and async io ;)

install compatible wrapper for libaio

$ mv /opt/oracle/rdbms/lib/skgaio.o /opt/oracle/rdbms/lib/skgaio.o.orig
$ cp ~/libaio-oracle-0.3.0/libaio-oracle.o /opt/oracle/rdbms/lib/skgaio.o


linking oracle with async support

$ cd /opt/oracle/rdbms/lib
$ make -f ins_rdbms.mk async_on

$ ldd /opt/oracle/bin/oracle
       /usr/local/lib/libcwait.so (0xb7f16000)
       linux-gate.so.1 =>  (0xffffe000)
       libodm9.so => /opt/oracle/lib/libodm9.so (0xb7f13000)
       libskgxp9.so => /opt/oracle/lib/libskgxp9.so (0xb7f10000)
       libskgxn9.so => /opt/oracle/lib/libskgxn9.so (0xb7f0d000)
       libjox9.so => /opt/oracle/lib/libjox9.so (0xb7b10000)
       libdl.so.2 => /lib/libdl.so.2 (0xb7b0c000)
       libm.so.6 => /lib/libm.so.6 (0xb7ae8000)
       libpthread.so.0 => /lib/libpthread.so.0 (0xb7a97000)
       libnsl.so.1 => /lib/libnsl.so.1 (0xb7a81000)
       libctype.so => /usr/local/lib/libctype.so (0xb7a73000)
       libaio.so.1 => /usr/local/lib/libaio.so.1 (0xb7a71000)
       libc.so.6 => /lib/libc.so.6 (0xb7958000)
       /lib/ld-linux.so.2 (0xb7f18000)


filesystemio_options:
asynch   - enables asynchronous io.
directio - enables direct io.
setall   - enables both asynchronous and direct io.
none     - disables both.

disk_asynch_io=true

i.e. 
alter system set filesystemio_options = asynch;
show parameter filesystemio_options
show parameter disk_asynch_io





16. setup database for testings

$ su - root
# mkdir /raid/oradata
# chown oracle:dba /raid/oradata
# ln -s /raid/oradata /oradata
# exit
$ mkdir -p /oradata/test/admin/{bdump,udump,cdump}
$ export ORACLE_SID=test
$ touch /opt/oracle/dbs/inittest.ora
$ lsnrctl start
$ orapwd file=/opt/oracle/dbs/orapw password=testpass
$ sqlplus /nolog
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.

Total System Global Area   97588468 bytes
Fixed Size                   451828 bytes
Variable Size              46137344 bytes
Database Buffers           50331648 bytes
Redo Buffers                 667648 bytes
SQL> 







some notes.....

CREATE DATABASE test
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/oradata/test/system01.dbf' 
  SIZE 250M REUSE AUTOEXTEND ON NEXT  250M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/oradata/test/temp01.dbf' 
  SIZE 200M REUSE AUTOEXTEND ON NEXT  200M MAXSIZE UNLIMITED
UNDO TABLESPACE "UNDOTBS1" DATAFILE '/oradata/test/undotbs01.dbf' 
  SIZE 200M REUSE AUTOEXTEND ON NEXT  200M MAXSIZE UNLIMITED
CHARACTER SET CL8KOI8R
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/oradata/test/redo01.log') SIZE 102400K,
GROUP 2 ('/oradata/test/redo02.log') SIZE 102400K,
GROUP 3 ('/oradata/test/redo03.log') SIZE 102400K,
GROUP 4 ('/oradata/test/redo04.log') SIZE 102400K,
GROUP 5 ('/oradata/test/redo05.log') SIZE 102400K;

CREATE TABLESPACE INDX LOGGING DATAFILE '/oradata/test/indx01.dbf' 
  SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED 
  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; 

CREATE TABLESPACE TOOLS LOGGING DATAFILE '/oradata/test/tools01.dbf' 
  SIZE 10M REUSE AUTOEXTEND ON NEXT 320K MAXSIZE UNLIMITED 
  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

CREATE TABLESPACE USERS LOGGING DATAFILE '/oradata/test/users01.dbf' 
  SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED 
  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; 

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
connect system/manager
@?/sqlplus/admin/pupbld.sql
connect / as sysdba

create spfile from pfile='/opt/oracle/dbs/inittest.ora';




processes                = 150
timed_statistics         = TRUE
shared_pool_size         = 251658240
large_pool_size          = 16777216
java_pool_size           = 0
control_files            = /oradata/test/control01.ctl
db_block_size            = 8192
db_cache_size            = 754974720
compatible               = 9.2.0.0.0
db_file_multiblock_read_count= 16
fast_start_mttr_target   = 300
undo_management          = AUTO
undo_tablespace          = UNDOTBS1
undo_retention           = 10800
remote_login_passwordfile= EXCLUSIVE
db_domain                = ''
instance_name            = test
hash_join_enabled        = TRUE
background_dump_dest     = /oradata/test/admin/bdump
user_dump_dest           = /oradata/test/admin/udump
core_dump_dest           = /oradata/test/admin/cdump
sort_area_size           = 524288
db_name                  = test
open_cursors             = 300
star_transformation_enabled= FALSE
query_rewrite_enabled    = FALSE
pga_aggregate_target     = 659554304


export ORACLE_HOME=/opt/oracle
su - oracle -c $ORACLE_HOME/bin/sqlplus /nolog <<\EOF
connect / as sysdba
startup
EOF
su - oracle -c $ORACLE_HOME/bin/lsnrctl start