Setup OCI8 pada Ubuntu 12.04 Server

By | 13 November 2013

WebServer Apache dengan PHP dan koneksi database dengan Oracle, pasti akan lebih baik daripada menggunakan database MySQL.

Nah, saya akan bahas cara install Oracle Instant Client pada WebServer.

 

Sebelumnya, standar WebServer harus sudah terinstal.

#tasksel

pilih

(*) LAMP Server

 

Setelah web server standar ter-install, mari kita install beberapa aplikasi penting pada server yang akan berfungsi untuk compiling aplikasi lain.

 # apt-get update -y
 # apt-get install build-essential -y
 # apt-get install alien -y

Dikarena kan kita akan menginstall database Oracle , maka kita juga perlu untuk menginstall Java Runtime untuk menjalankan Oracle Instant Client nya.

# apt-get install openjdk-7-jre

atau

# apt-get install default-jre

 

 

================  SIAP Install Oracle Instant Client – OCI8 ======================

 

Sesungguhnya, OCI8 atau Oracle Instant Client tidak men-support OS Debian/Ubuntu.. Namun kita masih dapat menggunakannya dengan sedikit trik. OK, lanjutt… 🙂

  • Download dulu Oracle Instant Client di http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html.
    Pada dasarnya, kita membutuhkan file “Basic” , “SqlPlus” , “Devel” serta lebih baik dilengkapi dengan “ODBC”. Semua file tersebut masih dalam bentuk *.rpm tentunya dengan versi x86-64.
  • Convert semua file .rpm menjadi .deb menggunakan aplikasi “alien” yang sudah dibahas pada tulisan diatas.
 # alien -i oracle-instantclient-basic*.rpm
 # alien -i oracle-instantclient-devel*.rpm
 # alien -i oracle-instantclient-sqlplus*.rpm
 # alien -i oracle-instantclient-odbc*.rpm
 
  • Test hasil instalasi menggunakan sqlplus :
# sqlplus   username/[email protected]//dbhost:1521/SID

(isi “username” dan “password”, serta host database oracle nya “dbhost”)

  • Jika SQLPlus tidak berjalan dan mengeluarkan pesan error, maka install libaio.so.1
# apt-get install libaio1

 

If sqlplus complains of a missing libsqlplus.so file, follow the steps in the section “Integrate Oracle Libraries” below.

If you execute sqlplus and get “sqlplus: command not found”, see the section below about adding the ORACLE_HOME variable.

 

Integrate Oracle Libraries

If oracle applications, such as sqlplus, are complaining about missing libraries, you can add the Oracle libraries to the LD_LIBRARY_PATH each time it is used, or to add it to the system library list create a new file as follows:

sudo vi /etc/ld.so.conf.d/oracle.conf
  • and add the oracle library path as the first line. For example,

 

/usr/lib/oracle/11.1.0.1/client/lib
  • or

 

/usr/lib/oracle/11.2/client/lib/
  • Kemudian jalankan ldconfig :
    sudo ldconfig

 

ORACLE_HOME

Many Oracle database applications look for Oracle software in the location specified in the environment variable ‘ORACLE_HOME’.

Typical workstations will only have one Oracle install, and will want to define this variable in a system-wide location.

 

sudo vi /etc/profile.d/oracle.sh

Add the following:

export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client

or

export ORACLE_HOME=/usr/lib/oracle/11.2/client

Alternatively, each user can define this in their ~/.bash_profile

Note: For 11.04 sqlplus was not recognized as a command unless the following line was also included in the oracle.sh file:

export PATH=$PATH:$ORACLE_HOME/bin

 

SDK fix

Some packages may look for ‘oci.h’ in $ORACLE_HOME/include, or in $ORACLE_HOME/rdbms/public

The instant client sometimes places the include files, such as oci.h, in /usr/include/oracle/<version>/client.

Inspect your system by running the following commands

ls $ORACLE_HOME
ls -d /usr/include/oracle/*/client

If there is no ‘include’ directory under ORACLE_HOME, and it is located over in /usr/include/oracle/ , create a symbolic link to assist packages looking for these header files. For example,

 

sudo ln -s /usr/include/oracle/11.2/client $ORACLE_HOME/include

And then check it is correct

ls $ORACLE_HOME

sambungan, perlu di edit.

http://blog.ianty.com/php/php-use-of-undefined-constant-oci_commit_on_successoci8-install/

Tinggalkan Balasan