Thursday, December 9, 2010

INSTALASI ORACLE 11g R2 di UBUNTU 10.04.1

Persiapan :

Instalasi Ubuntu 10.04.1

Instal software yang dibutuhkan untuk Oracle 10.04.1

$ sudo apt-get install build-essential libaio1 libaio-dev libmotif3 libtool expat alien ksh pdksh unixODBC unixODBC-dev sysstat elfutils libelf-dev binutils lesstif2 lsb-cxx lsb-rpm


Ubuntu terinstall libstdc++6 dan oracle 11gR2 membutuhkan libstdc++5, jika anda tidak meng-install libstdc++5 akan muncul error/masalah. Untuk menghindari hal itu terjadi lakukan langkah sebagai berikut :

$ wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_amd64.deb

$ dpkg-deb -x libstdc++5_3.3.6-17ubuntu1_amd64.deb ia64-libs
$ sudo cp ia64-libs/usr/lib/libstdc++.so.5.0.7 /usr/lib64/
$ cd /usr/lib64/
$ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

$ wget http://security.ubuntu.com/ubuntu/pool/universe/i/ia32-libs/ia32-libs_2.7ubuntu6.1_amd64.deb
$ dpkg-deb -x ia32-libs_2.7ubuntu6.1_amd64.deb ia32-libs
$ sudo cp ia32-libs/usr/lib32/libstdc++.so.5.0.7 /usr/lib32/
$ cd /usr/lib32
$ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

Buat user dan grup

Buat grup oinstall dan dba

$ sudo su -
# addgroup oinstall
# addgroup dba

Buat user dengan uid dibawah 1000

# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle -u 999

# mkdir /home/oracle
# chown -R oracle:dba /home/oracle

Buat ubuntu agar seperti layout redhat

# ln -s /usr/bin/awk /bin/awk
# ln -s /usr/bin/rpm /bin/rpm
# ln -s /usr/bin/basename /bin/basename
# mkdir /etc/rc.d
# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
# mkdir -p /u01/app/oracle
# chown -R oracle:dba /u01

Update parameter sysctl dengan menambah text dibawah ini ke bagian bawah /etc/sysctl.conf

fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
net.ipv4.ip_local_port_range = 9000 65535

Rubah limit pemilik software oracle dengan menambahkan baris berikut ini ke /etc/security/limits.conf :

oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535

kemudian aktifkan perubahan pada /etc/sysctl.conf dengan perintah :

# sysctl -p

akan terlihat hasil perubahan pada layar.
Extract dan Instal Oracle

Sebelum melakukan instalasi lakukan perintah :

# xhost +

kemudian login menggunakan user oracle :

# su – oracle

oracle yang digunakan pada praktek ini adalah versi 64bit, maka lakukan extract oracle ke direktory database sebagai berikut :

$ su – oracle
$ unzip linux.x64_11gR2_database_1of2.zip
$ unzip linux.x64_11gR2_database_2of2.zip

cek hasil extract :

$ ls -lh
total 2.2G
drwxr-xr-x 8 seiler seiler 4.0K 2009-08-20 14:34 database
-rw-r--r-- 1 seiler seiler 1.2G 2010-03-09 11:33 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 seiler seiler 1.1G 2010-03-09 12:38 linux.x64_11gR2_database_2of2.zip

Sekarang lakukan instalasi dengan menjalankan ./runInstaller :

$ cd database
$ ./runInstaller

Proses berikutnya ikuti pentunjuk instalasi OUI (Oracle Universal Installer). OUI akan memberitahukan paket yang tidak ditemukan, karena OUI melakukan pemeriksaan pada RPM, kita bisa lanjutkan instalasi dengan mengabaikan dan melanjutkan proses instalasi hingga selesai.

Setelah instalasi selesai, lakukan seting pada environmen pada /etc/profile sebagai berikut :

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export EDITOR=/usr/bin/vi

Kemudian lakukan test hasil instalasi dengan :

$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 10 23:46:42 2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> quit
$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch lsinventory
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation. All rights reserved.

dbhome_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.6.6
OUI version : 11.2.0.1.0
OUI location : /u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2010-06-10_23-46-53PM.log

Patch history file: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2010-06-10_23-46-53PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g 11.2.0.1.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

--------------------------------------------------------------------------------

OPatch succeeded.


Startup ORACLE secara otomatis pada system boot

Edit /etc/oratab seperti dibawah ini:

orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

kemudian buat file /etc/init.d/oracledb :

$ sudo pico /etc/init.d/oracle
yang isinya sebagai berikut :
#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORA_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORA_OWNR=oracle

# if the executables do not exist -- display error

if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: cannot start"

exit 1
fi

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORA_OWNR -c "$ORA_HOME/bin/dbstart $ORA_HOME"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"

#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl start dbconsole"

touch /var/lock/oracledb


echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "

#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl stop dbconsole"

su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNR -c "$ORA_HOME/bin/dbshut $ORA_HOME"

rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
#end of /etc/init.d/oracledb

Untuk membuatnya berjalan ketika start gunakan perintah :

$ sudo update-rc.d oracledb defaults

Proses instalasi selesai

No comments:

Post a Comment