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.

Sunday, 23 December 2007

Is Windows Vista a lost cause?

Ok been, started asking around and cant find a single person I know say they prefer vista vs. XP. Even the die hard .Net developer I know think XP is better. Dont understand this, there was supposed to be loads of usability studies etc. What happened someone forgot to include anyone who actually uses a computer full time or previous version of windows in this.

I really loved the original windows NT when it came out, I purchased a Windows Tablet as loved the idea and still use it a browser to this day. As a developer I like Windows for for rich client stuff, spent years in visual studio building application. On server side used to use NT everywhere but have moved to Linux in recent years. But now appear that windows may have managed to shot itself in the foot on client side. I'm developing a growing dislike for vista with each time I try and use it. Just don't feel in control, cant work out why things like internet access aren't working, its now getting to stage of not wanting to see it again. I keep going backing thinking, it must be me, but then give up and reboot in Linux to actually have get the machine to work well.

Wireless, Media playing, simple internet browsing all work better on the Linux side and whole machine just feels so much more snappy. Only thing that works better on windows is hibernate and suspend which are really poor on the linux side. But happy to boot and shutdown a machine to have a working systems. Doesn't hunt that actually boot and shuts down fast don't really care.

Wednesday, 19 December 2007

Windows Vista v.s. Mint Linux

Ok got a new laptop for traveling yesterday, a little Toshiba R500 <1kg job, so got first real exposure to vista. Afraid as after function not glitter so cant really see much in new Aero UI. Once turned off all the pointless glitter system as a lot more responsive and was happier may be better then XP but still liked the simple 2000 interface better . Cant really see a reason to upgrade any existing systems, as appears the same odd system with a repaint and new dice on the mirror.
May be a little harder to find stuff, but this is simply due to moving things around. With each new version the bits I use as developer simply appear to move down a level and become a little harder to find (Environment variable, services, folders in file manager etc).

Had to spend a few hours watching it configure, update and reboot its self a number of time as found and installed my tool set, SqlYog, Enterprise Architect, NetBeans, Firefox, Skype, Mysql etc. All worked got a little board of now going to do xxx dialogs. All worked, but cant understand were the 780 mb or rams gone before installing any applications!. End results 4 hours work to get to a usable state and most of my environment build.

Finally got bored to put in Mint 4.0, my main desktop,and installed. The difference was shocking 10min later was installed and working . A simple selection package later and was up in working. As use crossover even the windows application installations worked faster and easer then under windows. Basically about 20 minutes later was up and running. Only real difference it computer simply appeared more responsive and faster.

End result it have not rebooted into vista again, will keep it around in-case get a nice .net C# project but otherwise Mint got the edge for my usage and just makes the computer appear faster!
Afraid believe role of a operating system is to run application for me not use all the processing cycles its self. Afraid vista appears to forget this, Linux remembers.

Tuesday, 18 December 2007

Oracle and Rails 2.0

Oh well once you think you done, alongs coming testing in a production environment and some extra fun. Turns out no one else appears to be working with Oracle and Rails 2.0 yet.
No one implemented the needed select_rows in svn. Caused a few problems to use the driver in tsting.

In put ended up with a nice custom oracle driver in the end. Need a few minor changes:-
  • Modified mapping to my own likes
    • float <-> binary_double
    • char(1) N/Y <-> boolean
    • text <-> varchar2(2024)
  • Boolean (true t 1 y +) all mapped to true
  • Implemented select_rows
  • added a high/low sequence which I prefer for high insert rates with oracle
the current version of the gem I created is up at http://biorails.org/svn/biorails/contrib/activerecord-oracle-adapter-1.0.0.gem if anyone interested. At present its a work in progress. Need to put on my old oracle DBA hat and look for anyway to improve it. But may help anyone else moving up to 2.0 with a oracle backend in the next few weeks. Would like to use Insert returning for sequences and trigger filled values if possible but will have to have a further look.

Put needed changes on ticket: #10415 in rails dev.

Saturday, 15 December 2007

Finished migrating to Rails 2.0

Just a not to say code base is now passing all test with Rails 2.0. Took about 8 hours of effort in the end mostly with scope and SOAP changes.

So feel free to upgrade Biorails and try it out and upgrade local rails if you want. At present environment.rb does not contain a version to will attempt to run on most recent installed rails version.

Expected status:-
  • Units: 353 tests, 668 assertions, 0 failures, 0 errors
  • Functionals: 301 tests, 780 assertions, 0 failures, 0 errors
Have got a simple does it return correctly or throw a exception test on most controller actions now . Only real problem is create/update functional are not really testing all the create/update objects with generation of new records.

Rails 2.0 upgrade produced a lot of donkey work but went smoothly the mains changes needed are shown below:-

1) Paginate.new => model.paginate via will_paginate plugin

Keep a eye of bottom of pages to check new paginate control is coming up ok in visual testing. Buts appears ok on initial pass

2) end_form*

Have had to change a number of forms to block wrappers to
<% form_tag( stuffff ) do %>
<% end %>
3) with_scope

Use this a lot to manage visibility of data. Has gone protected so having to move filters to part of correct model. Model.with_scope => self.with_scope and code moves into correct models and referenced so

On the whole appears a litte faster other then this no real problem seen.
def self.visible(*args)
self.with_scope( :find => {
:conditions=> ['exists (select 1 from memberships m,studies s where m.user_id=? and s.id=study_protocols.study_id and m.project_id=s.project_id)',User.current.id]
}) do
self.find(*args)
end
end
4) Had to Add 3 plugins to externals list in svn to cover bits moved out of core rails:-
script/plugin in_place_editing
script/plugin act_as_tree
script/plugin will_paginate
Need to find if there a Oracle plugin.There is talk that oracle ActiveRecord has moved out to separate gem/plugin could not find this yet. Will have another look later but will not effect development or testing yet.

5) Acton Web Services

Well this was a pain, but changed over to a plugin based on 1.2.6 code under my control at present. Will have to test this with our .net office client to make sure its working well.

ActionWebService and Rails 2.0

Well looks like I have to take on supporting this for my BioRails project. Afraid on the client side we are making heavy use of .NET generated client code generated from the WSDL. This is used for the Microsoft office client integration is isn't going to become restful soon. Also have clients using the same historic interface so ended up picking up AWS porting to 2.0.

To install the plugin the following should work:-
script/server plugin http://biorails.org/svn/biorails/plugins/action_web_services
At present all I can say is it passes our in-house test suite for the web services I want. Beyond that I have not had time to go. Had to do a few minor changes to get invoke to work, fully made it display calls sorted by name which have been meaning to do for ages.

Maybe for online services could keep few mongrels up with 1.2.6 dedicated to web service requests after move to 2.0. But as we distributing a software package instead of a service this would be hard on customers.

Basic changes are setting the gem dependencies to allow for use with Rails 2.0
gem 'activesupport', '>= 1.0.2'
gem 'actionpack', '>= 1.6.0'
gem 'activerecord', '>= 1.9.0'
Then the removal for include Reloadable::Deprecated from the code base. This appears to have worked for me. I expect there to be a similar gem soon. Then a number of conversions of render_file to render :text => content in the scaffold code.

Its now back to working on 2.0.1 with my .net client usage pattern. In fact working really well on client side as collections of simple data objects is a common pattern for .net and works well for building the client UI.

Tuesday, 11 December 2007

Web vs. Application development

Have noticed Im have come full circle. Im not writting a web application any more in Ruby on Rails. I am builder a n-tier rich client application, the difference is the client is javascript+html in a web browser as a container. I now finding the MVC part moving to javascript with rails supplying the initial page template and then a few restful json data structures to handle change in state. Affraid cant see the point in the X part of ajax when talking from ruby to javascript its a classic cut out the middle man xml. The .xml there on the action but .to_json faster then .to_xml for moving the data.

I have been reading the ajax is evil etc talk, and this may be true to public wildly distributed view anywhere application. But I'm after the best user experience for a known set of clients for in-house usage. For my style of application JavaScript and Ajax is a boom as take away the web bar at the top with Mozilla prism and user just think its a richer client application like the host of .net application. In fact in user pilot beat a competitor thick client swing application as user rated the web page as having better windows integration (odd but true).