Sunday, 26 May 2013

Ubuntu 13.04, Oracle 11gR2, external C programs, OCILIB

Wanting to optimize the processing and so am in the process of converting the PL/SQL for the indicator algorithms into external C programs using OCILIB.

Because I am working away from my server at the moment, and in the process of setting up ssh, I decided to put Oracle 11gR2 onto my Ubuntu 13.04 laptop. This is not really an easy process, but essentially we have the Ubuntu 12 implementation here - except we no longer need the libstdc++5 library (the link is not valid in any case, but you can find these on the Ubuntu archive site if you search for libstdc++5 if indeed you feel that you need it). This process needs to be integrated with the following document here, taking into consideration that we are installing on a deb system and not OEL 6, the important pieces are the setup of the system parameters.

Be mindful that you should install the software only first using the above guides. After implementing both guides, run 'relink all' from the $ORACLE_HOME directory. Then run netca to create the listeners and dbca to create the database itself. Then redo the Enterprise Manager having first created a password file (this is important) using emca.

The chronological order of these is ultra important otherwise you will get an 'ORA-12547 TNS lost contact' error.

Then its a question of making sure that the listener is setup correctly, this guide will help.

Also you will find that the init'dbname'.ora file is not created in the dbs directory; copy from the sample and enter the correct info, comment out the audit lines, and put in the correct Control file information.

Then OCILIB setup, and allow external program access, full database access info "host:port/service name" for the OCI_ConnectionCreate function and Robert is your father's brother.

Then its compile your programs using the following options:

gcc -Wall cprog1.c -o cprog1 -I/usr/local/include -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -locilib

This gives me is a much faster turnaround time for the rather complex and long running algorithms on PL/SQL, and allows me to play with even more complex algorithms that I have been thinking about which necessitate the use of OpenMP which I'll describe in other posts.

Comment if you need help to do something similar.

No comments:

Post a Comment