Setting up Oracle 11g

Thanks to Don Doherty from Brainstage for contributing these notes.

These notes are instructions to set up and ORACLE instance prepared for use with RDF on a virtual machine running Red Hat Enterprise Linux 5. They don't yet include specific instructions for loading the RDF distribution, but it is hoped these will come in due time. If you have success doing that, please send a note to the [mailto:neurocommons-rdf@googlegroups.com mailing list].

by Charles Borromeo, Brainstage

= Oracle Installation instructions =

Initial note
These install instructions apply to installing Oracle 11g on Red Hat Enterprise Linux 5 64 bit. The Red Hat OS was installed on a Mac OS X Server running OS X 10.5 (Leopard). Red Hat was running as a virtual server using VMWare's Fusion product.

Install Red Hat for Oracle was quite useful.

This HOWTO was even more useful.

Run the Red Hat installation
During the Red Hat installation, make sure you include the "Legacy Development Software" package. I did not initially include it and I was missing some packages that Oracle needs for the installation. There is a possibility that these packages sysstat-7.0.0 and libaio-devel-0.3.106 never get installed, but I can't confirm this.

Install libraries
To manually install sysstat-7.0.0 and libaio-devel-0.3.106:

(Log onto the Linux OS)

rpm -Uvh [name of the .rpm file]
 * 1) log into the Red Hat https://rhn.redhat.com using a Red Hat account.
 * 2) Click "search for: Packages"
 * 3) Type the name of the packages you need.
 * 4) Download the appropriate .rpm files
 * 5) Open terminal
 * 6) cd to the directory containing the .rpm files
 * 7) Run the following command:

Create Oracle Linux user and DBA group
groupadd dba -g 501 mkdir -p /home/oracle useradd -c “Oracle Software Owner” -G dba -u 1115 –d /home/oracle oracle chown -R oracle:dba passwd oracle [you will be prompted to set the password for the oracle user]
 * 1) Log in as root
 * 2) Open terminal
 * 3) Run the following commands:

Change the kernel settings

 * 1) Log in as root
 * 2) cd to /etc
 * 3) edit the sysctl.conf file add the following settings:

net.core.rmem_default=262144 net.core.rmem_max=4194304 net.core.wmem_default=262144 net.core.wmem_max=4194304 kernel.sem = 256 32000 100 150 net.ipv4.ip_local_port_range = 1024 65000
 * 1) Oracle settings for cluster

Reboot the server

Adjust swap space
I also ran into a problem with my swap space. The following instructions create a 3GB swap file. dd if=/dev/zero of=/swapfile bs=1M count=3094 mkswap /swapfile swapon /swapfile
 * 1) Log in as root
 * 2) Run the following commands from terminal:
 * 1) cd to /etc
 * 2) edit fstab
 * 3) look for a line in the file like: /file/xyz   swap    swap   defaults 0  0
 * 4) Change the line to /swapfile    swap   swap   defaults 0   0
 * 5) reboot the server

Running the Oracle installer

 * 1) Download the Linux Oracle installer to the Linux machine
 * 2) Log in as oracle
 * 3) unzip the installer and cd to the directory
 * 4) from terminal run the runInstaller file

I used the basic settings in the installer.

Disable SELinux
SELinux acts as a security layer within the OS. Many of the Oracle tools I use (tnsping, sqlplus) are blocked from execution because of SELinux. I have seen other people posting complaints about SELinux on Red Hat Enterprise 5.

To disable SELinux:
 * 1) Log in as root
 * 2) cd to /etc/selinux
 * 3) edit conf
 * 4) Change the line SELINUX=enforcing to SELINX=permissive
 * 5) Reboot the server.

Disable Linux firewall

 * 1)  Log in as root
 * 2) Open terminal
 * 3) run the command 'service iptables save'
 * 4) run  'service iptables stop'
 * 5) run 'chkconfig iptables off'

I had trouble starting the Oracle server after reboots. I needed to do the following:


 * 1) open Terminal
 * 2) run the sqlplus command
 * 3) for username type '/ as SYSDBA'
 * 4) within SQL*PLUS type 'startup pfile=/home/oracle/app/oracle/product/11.1.0/db_1/dbs'
 * 5) quit SQL*PLUS
 * 6) from Terminal run dbstart (this launches the TNS Listener)

Use the command 'tnsping ORCL' to see if the listener is available, but log into the instance to make sure it is running!!

Execute the 11g RDF related scripts

 * 1)  Open terminal
 * 2) run the sqlplus command
 * 3) for username type '/ as SYSDBA'
 * 4) within SQL*PLUS type '@/home/oracle/app/oracle/product/11.1.0/db_1/md/admin/catsem11i.sql'
 * 5) exit SQL*PLUS

Run Oracle Jena adapter patch

 * 1)  search Oracle's website for the Semantic Technologies
 * 2)  download the Jena Adapter patch and follow the install instructions (there is a link to the instructions on the same page as the patches)

Create a user account for the RDF data

 * 1. log into SQL*PLUS as SYSTEM
 * 2. Create the rdf_users tablespace by running the following command:

Note: In the datafile path, replace the  and  with appropriate folder name of your ORACLE_HOME create tablespace rdf_users datafile '/home/oracle/oradata//rdf_users01.dbf' size 128M reuse autoextend on next 64M maxsize unlimited segment space management auto; Run the following command: create temporary tablespace rdf_temp tempfile '/home/oracle/oradata//rdf_temp01.dbf' size 128M reuse autoextend on next 32M maxsize unlimited;
 * 3. Run the following commands to create the User:

create user rdfuser identified by rdfuser default tablespace rdf_users temporary tablespace rdf_temp;

grant create session, resource to rdfuser;
 * 4. Add a new datafile to the rdf_users tablespace. Otherwise, the load will eat up too much space.

'''use the rdfuser account to insert data. Don't use SYSTEM or any other admin account!!'''

Install the Oracle data examples

 * 1) Go to the web page containing the Oracle Linux Installer
 * 2) Click the "See All" link
 * 3) Select the Oracle Database 11g Examples

To start Oracle

 * 1) open SQL*Plus using sys as sysdba (don't specify the @onto1 instance)
 * 2) startup pfile='/home/oracle/app/oracle/product/11.1.0/db_1/dbs/initonto1ora'

Performance improvements
To improve performance across all models:
 * 1) open SQL*Plus using SYSTEM (this possibly could be done using MDSYS)
 * 2) run the following: 'execute sem_perf.gather_stats;'

To improve perfomance on a single model:
 * 1) open SQL*Plus using SYSTEM (this possibly could be done using MDSYS)
 * 2) run the following: 'execute sem_apis.analyze_model(' ');'