jump to navigation

Automatic Startup – Shutdown database ORACLE 11g Desember 9, 2008

Posted by setijoagus in Oracle Administration, Oracle Install, oracle.
Tags: ,
trackback

1. create script start database
[oracle@mkt ~]$ cd $ORACLE_HOME/bin
[oracle@mkt bin]$ vi startora11g
#!/bin/sh
# Start the oracle database
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_SID=mkt
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/dbstart
exit 0

[oracle@mkt bin]$ chmod u+x startora11g

2. create script stop database
[oracle@mkt ~]$ cd $ORACLE_HOME/bin
[oracle@mkt bin]$ vi stopora11g
#!/bin/sh
# Stop the oracle database
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_SID=mkt
export ORACLE_TERM=xterm
$ORACLE_HOME/bin/dbshut
exit 0
[oracle@mkt bin]$ chmod u+x stopora11g

3. create script restart, start & stop
[oracle@mkt ~]$ cd $ORACLE_HOME/bin
[oracle@mkt bin]$ vi oracle11g
#!/bin/sh
#
# chkconfig: 345 51 49
# description: startup and shutdown the Oracle 8i database
#
echo “Oracle 11g database start/stop/restart”
ORA_OWNER=oracle
ORA_BASE=/u01/app/oracle
ORA_HOME=$ORA_BASE/product/11.1.0/db_1

case “$1″ in
’start’)
# Start the database
echo -n “Starting the database for 11g: “
su – $ORA_OWNER -c $ORA_HOME/bin/startora11g
echo
;;

’stop’)
# Stop the database
echo -n “Shutting down database for 11g: “
su – $ORA_OWNER -c $ORA_HOME/bin/stopora11g
echo
;;

‘restart’)
# Restart the Oracle databases:
echo -n “Restarting database for 11g: “
$0 stop
$0 start
echo
;;
*)

echo “Usage: oracle11g [ start | stop | restart }"
exit 1
esac
exit 0
[oracle@mkt bin]$ chmod u+x oracle11g

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

5. copy script oracle11g to /etc/rc.d/init.d/
[root@mkt ~]# cp /u01/app/oracle/product/11.1.0/db_1/bin/oracle11g /etc/rc.d/init.d/
[root@mkt ~]# chmod 700 /etc/rc.d/init.d/oracle11g

6. test script oracle11g start, stop, restart with login as root
[root@mkt ~]# cd /etc/rc.d/init.d
[root@mkt init.d]# ./oracle11g
Oracle 11g database start/stop/restart
Usage: oracle11g [ start | stop | restart }

[root@mkt init.d]# ./oracle11g start
Oracle 11g database start/stop/restart
Starting the database for 11g: ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.1.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance “mkt”: log file /u01/app/oracle/product/11.1.0/db_1/startup.log

[root@mkt init.d]# ./oracle11g stop
Oracle 11g database start/stop/restart
Shutting down database for 11g: ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
Usage: /u01/app/oracle/product/11.1.0/db_1/bin/dbshut ORACLE_HOME
Processing Database instance “mkt”: log file /u01/app/oracle/product/11.1.0/db_1/shutdown.log

[root@mkt init.d]# ./oracle11g restart
Oracle 11g database start/stop/restart
Restarting database for 11g: Oracle 11g database start/stop/restart
Shutting down database for 11g: ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
Usage: /u01/app/oracle/product/11.1.0/db_1/bin/dbshut ORACLE_HOME
Processing Database instance “mkt”: log file /u01/app/oracle/product/11.1.0/db_1/shutdown.log

Oracle 11g database start/stop/restart
Starting the database for 11g: ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.1.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance “mkt”: log file /u01/app/oracle/product/11.1.0/db_1/startup.log

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

Komentar»

1. Fabio - April 17, 2009

Muito bom, muito bom mesmo, tks…
Very good, very good yes, tks…