Saturday, 31 May 2008

Oracle 11g /Ubuntu update

Ok found the magic option to speed up oracle 11g for my development box.
emctl stop dbconsole
Now converted back to simply database server its works a lot better. Afraid after some time looking a performance stats found could not find my application in top SQL . The enterprise console performance stats only showed enterprise console eating all the resources.

Database on its own appears to be comparable but a little larger then XE. Afraid think in case of oracle, enterprise may still mean crew of 100's and something the site of a aircraft carrier to run it at full potential. But that what its aimed at the 1Tb+ database not developer/test systems.

Think I may go back to XE one tested everything works with 11g as expected.
Fun next as time to see how stacks up against Sqlite, Mysql and Postgres in running the all the my test suites.

Thursday, 29 May 2008

Oracle 11g on Ubuntu 8.04 64 bit / Life on the Edge

Decided to experiment with oracle and taken the hard road with Oracle 11g on Ubuntu 8.04. This was is my main development box and a good solid dual core AMD64 box. Just upgrade from 6.06 to 8.04 ubuntu and its time to give 64 bit oracle another go. Last time gave up and when 32 bit of OS and oracle, with a simple Oracle XE installation.

Before started found the following articles to lead the way
The blog by Halis way was a great help as really acted as a template for my 11g my work. As other have notedf one of the main catches is that the Oracle Universal Installer (OUI).
So we need a 32-bit Java triggered and a soem 386 compatability libraries to get it working.

There were some linkage problems with the 32bit exproc which is used with C++ database procedures and ultra text search. I simply continued through this as not planning to use exproc. I still have to solve this problem so remember this a play installation oracle and not suitable for production/heavy use. If to really want a supportable oracle platform afraid best to swap to openSUSE or CentOS.

Machine Setup
First of all make sure your machine set up as a server with a static IP address and host name pointing to the external ip address. Check or edit /etc/network/interfaces to make sure the interface is static. For example my interface look as follows:-
auto lo
iface lo inet loopback

iface eth1 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
auto eth1

iface eth0 inet dhcp
On my box eth0 points out to the world and eth1 is inhouse network. Then double check the /etc/hosts to make sure there a line for the server name
$ grep $(hostname) /etc/hosts
192.168.1.10 acles64
If you see 127.0.0.1 just edit the hosts file to have the external IP.

Now its time for a lot of compat libraries and 32-bit libraries.
sudo apt-get install build-essential zsh libaio1 lesstif2
sudo apt-get install lesstif2-dev make libc6 libstdc++5
sudo apt-get install lib32stdc++6 lib32z1 ia32-libs
This will probably cascade in to quite a few packages depending on how much you have installed, be patient and let it download everything it needs. The extra ia32 libraries is probably the biggest change to the old 32-bit installation.

Edit /etc/sysctl.conf to have the kernel parameters required by Oracle
(Afraid have not put any thought here simply copied Halis way 10g ones, may not be ideal for 11g or needed).

Add these lines at bottom of/etc/sysctl.conf :
# Oracle stuff
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
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
vm.swappiness=10
Create the oracle user and required groups.
sudo groupadd nobody
sudo groupadd oinstall
sudo groupadd dba
sudo useradd -s /bin/bash -g oinstall -G dba oracle
sudo passwd oracle
Increase system limits by adding these lines to /etc/security/limits.conf:
soft nproc 2047
hard nproc 16384
soft nofile 1024
hard nofile 65536
Next added a few symlinks to avoid any script problems:
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /bin/true /bin/rpm
sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so

Oracle installation
This was done under the oracle user and dba group was added for access to oracle. I like /opt/oracle as a installation route and luckily had space there.
sudo mkdir -p /opt/oracle
sudo chown -R oracle:oinstall /opt/oracle
sudo chmod -R 775 /opt/oracle
I downloaded Oracle 11g and unzip its to /opt/oracle/database. Then run the installer, make sure you are allowed to use the X11 server.

May need to login as oracle or play with export DISPLAY, xhost, vnc etc to get it working.
To get the 32-bit JRE to work you need to set the XLOCALELIBDIR before running the installer:
export XLOCALELIBDIR=/usr/lib32/X11/locale

cd /opt/oracle/database
./runInstaller -ignoreSysPrereqs
I just ran the defaults through with following corrections

1) Set location to /opt/oracle/product/11.1.0/db
2) Corrected oraInventory location as /opt/oracle/oraInventory
3) Continued with two linkage errors


The linkage errors were luckily in non vital areas (free text search) and (exproc32) so contained and have got my biorails application installed. The Error are shown below:-

Linkage of exproc32
INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'all_no_orcl' of makefile '/opt/oracle/product/11.1.0/db/rdbms/l$
Exception Severity: 1
INFO: Calling Action unixActions10.2.0.1.0 make
registerOnly = false
installMakePath = /usr/bin/make
installMakeFileName = /opt/oracle/product/11.1.0/db/srvm/lib/ins_srvm.mk
installTarget = install
undoMakeFileName =
installArguments = ORACLE_HOME=/opt/oracle/product/11.1.0/db
logFile = /opt/oracle/product/11.1.0/db/install/make.log
undoTarget =
progMsg = Linking RDBMS Executables
Then Later there a problem with the Oracle Text INSO filter ctxhx needed by Ultra Search crawler . As not planning to use not worried at present.
INFO: make: *** [ctxhx] Error 1

INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'install' of makefile '/opt/oracle/product/11.1.0/db/ctx/lib/ins$
Exception Severity: 1
INFO: Calling Action unixActions10.2.0.1.0 make
registerOnly = false
installMakePath = /usr/bin/make
installMakeFileName = /opt/oracle/product/11.1.0/db/rdbms/lib/ins_rdbms.mk
installTarget = ipc_g
undoMakeFileName =
installArguments = ORACLE_HOME=/opt/oracle/product/11.1.0/db
logFile = /opt/oracle/product/11.1.0/db/install/make.log
undoTarget =
progMsg = Linking UDP

Once this was done could go in and create users, roles, tables and schema I needed and appears to be working fine. Only real problem its eaten 1Gb of memory and taken over my development box in standard oracle manor. Generally think Oracle XE makes the better developer platform as a lot lighter on resources.

Went in and cut things back a lots and got memory back for my development IDE.