I. Tujuan
Sebagai acuan teori untuk prosedur startup-shutdown database dan listener otomatis ORACLE 10g Single di LINUX centos 4.2

II. Cara Pengerjaan
1. pembuatan script start database di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi startora10g
#!/bin/sh
# Start the oracle database
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ubs
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/dbstart
exit 0

[oracle@ubs bin]$ chmod u+x startora10g

2. pembuatan script stop database di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi stopora10g
#!/bin/sh
# Start the oracle database
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ubs
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/dbshut
exit 0

[oracle@ubs bin]$ chmod u+x stopora10g

3. pembuatan script restart, start dan stop di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi oracle10g
#!/bin/sh
#
# chkconfig: 345 51 49
# description: startup and shutdown the Oracle 8i database
#
echo “Oracle 10g database start/stop/restart”
ORA_OWNER=oracle
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
case “$1” in
‘start’)
# Start the database
echo -n “Starting the database for 10g: ”
su – $ORA_OWNER -c $ORA_HOME/bin/startora10g
echo
;;
‘stop’)
# Stop the database
echo -n “Shutting down database for 10g: ”
su – $ORA_OWNER -c $ORA_HOME/bin/stopora10g
echo
;;
‘restart’)
# Restart the Oracle databases:
echo -n “Restarting database for 10g: ”
$0 stop
$0 start
echo
;;
*)
echo “Usage: oracle10g [ start | stop | restart }”
exit 1
esac
exit 0
[oracle@ubs bin]$ chmod u+x oracle10g

4. Login root dan edit /etc/oratab.
[oracle@ubs bin]$ su – root
Password:
[root@ubs ~]# vi /etc/oratab
ubs:/u01/app/oracle/product/10.2.0/db_1:N
menjadi
ubs:/u01/app/oracle/product/10.2.0/db_1:Y

5. copykan script oracle10g ke /etc/rc.d/init.d/
[root@ubs ~]# cp /u01/app/oracle/product/10.2.0/db_1/bin/oracle10g /etc/rc.d/init.d/
[root@ubs ~]# cd /etc/rc.d/init.d
[root@ubs init.d]# chmod 700 oracle10g

6. jika menggunakan Oracle 10g Release 2, edit script dbstart atau jika terjadi error dengan message:
Failed to auto-start Oracle Net Listener using /ade/vikrkuma_new/oracle/bin/tnslsnr
edit file “$ORACLE_HOME/bin/dbstart” ganti /edit (line 78):
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
dengan :
ORACLE_HOME_LISTNER=$ORACLE_HOME

7. test script oracle10g start dengan login sebagai root
[root@ubs ~]# cd /etc/rc.d/init.d
[root@ubs ~]# ./oracle10g
Oracle 10g database start/stop/restart
Usage: oracle10g [ start | stop | restart }

[root@ubs init.d]# ./oracle10g start
Oracle 10g database start/stop/restart
Starting the database for 10g: Processing Database instance “ubs”: log file /u01/app/oracle/product/10.1.0/db_1/startup.log

8. test script oracle10g restart
[root@ubs init.d]# ./oracle10g restart
Oracle 10g database start/stop/restart
Restarting database for 10g: Oracle 10g database start/stop/restart
Shutting down database for 10g:
Oracle 10g database start/stop/restart
Starting the database for 10g: Processing Database instance “ubs”: log file /u01/app/oracle/product/10.1.0/db_1/startup.log

9. test script oracle10g stop
[root@ubs init.d]# ./oracle10g stop
Oracle 10g database start/stop/restart
Shutting down database for 10g:

10. chkconfig pada script oracle10g
[root@ubs init.d]# /sbin/chkconfig –add oracle10g
[root@ubs init.d]# /sbin/chkconfig –list oracle10g
oracle10g 0:off 1:off 2:off 3:on 4:on 5:on 6:off

LISTENER
11. pembuatan script status listener di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi statuslsnr
#!/bin/sh
# Start the oracle listener
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ubs
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/lsnrctl status
exit 0

[oracle@ubs bin]$ chmod u+x statuslsnr

12. pembuatan script start listener di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi startlsnr
#!/bin/sh
# Start the oracle listener
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ubs
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/lsnrctl start
exit 0

[oracle@ubs bin]$ chmod u+x startlsnr

13. pembuatan script stop listener di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi stoplsnr
#!/bin/sh
# Start the oracle listener
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ubs
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/lsnrctl stop
exit 0

[oracle@ubs bin]$ chmod u+x stoplsnr

14. pembuatan script status,start dan stop listener di $ORACLE_HOME/bin
[oracle@ubs bin]$ cd $ORACLE_HOME/bin
[oracle@ubs bin]$ vi listener10g
#!/bin/sh
#
# chkconfig: 345 51 49
# description: startup and shutdown the Oracle 10g listener
#
echo “Oracle 10g listener start/stop/status”
ORA_OWNER=oracle
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1

case “$1” in
‘start’)
# Start the listener
echo -n “Starting the Listener for 10g: ”
su – $ORA_OWNER -c $ORA_HOME/bin/startlsnr
echo
;;
‘stop’)

# Stop the listener
echo -n “Shutting down Listener for 10g: ”
su – $ORA_OWNER -c $ORA_HOME/bin/stoplsnr
echo
;;

‘status’)

# Status the listener
echo -n “Status Listener for 10g: ”
su – $ORA_OWNER -c $ORA_HOME/bin/statuslsnr
echo
;;

‘restart’)
# Restart the Oracle databases:
echo -n “Restarting Listener for 10g: ”
$0 stop
$0 start
echo
;;

*)
echo “Usage: listener10g [ status | start | stop | restart }”
exit 1
esac
exit 0

[oracle@ubs bin]$ chmod u+x listener10g

15. test script listener10g sebagai root
[oracle@ubs bin]$ su – root
Password:
[root@ubs ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin
[root@ubs bin]# ./listener10g
Oracle 10g listener start/stop/status
Usage: listener10g [ status | start | stop | restart }

[root@ubs bin]# ./listener10g status
Oracle 10g listener start/stop/status
Status Listener for 10g:
LSNRCTL for Linux: Version 10.2.0.1.0 – Production on 04-OCT-2007 16:13:57

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ubs)(PORT=1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 – Production
Start Date 04-OCT-2007 15:51:45
Uptime 0 days 0 hr. 22 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.1.0/db_1/network/log/listener.log
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ubs)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary…
Service “PLSExtProc” has 1 instance(s).
Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully

16. copykan script listener10g ke /etc/rc.d/init.d/
[root@ubs bin]# cp /u01/app/oracle/product/10.2.0/db_1/bin/listener10g /etc/rc.d/init.d/

[root@ubs bin]# cd /etc/rc.d/init.d/
[root@ubs init.d]# chmod 700 listener10g

17. chkconfig pada script listener10g
[root@ubs init.d]# /sbin/chkconfig –add listener10g
[root@ubs init.d]# /sbin/chkconfig –list listener10g
listener10g 0:off 1:off 2:off 3:on 4:on 5:on 6:off

3 responses to “Startup – Shutdown otomatis ORACLE 10g”

  1. Singgih Octafianto Avatar
    Singgih Octafianto

    mas,
    saya ijin ambil ya artikelnya. saya sudah gunakan dasar artikel ini untuk oracle 10g di fedora 10 dan berjalan setelah oprak-oprek. saya akan tulis kembali untuk dokumentasi saya di testbed pc yang saya pergunakan.

    terima kasih banyak tutorial ya mas, gampang diikuti. berhasil buat saya yang pertama install oracle di fedora 10, meskipun menghabiskan waktu 3 hari 🙂

    singgih octafianto

    1. senang saya kl artikel yang aku tulis bermanfaat……….
      maju terus IT di indonesia

  2. Saya ijin Copy coz buat Data base mas….
    dah 2 hri blm kmu juga…
    thx bgt yach….

Leave a comment

Trending