jump to navigation

automatic startup and shutdown for oracle database in Linux 18 April 2007

Posted by Tyo in Linux, Oracle.
trackback

copy this code to a file with .sh extension then move the file to your /etc/init.d then create link in your rc5.d and rc3.d so that your oracle can start and shutdown automatically when you starting up and shutdown your Linux OS. below is the script :

========= Script Begin ===================

# chkconfig: 35 95 1
# description: init script to start/stop oracle database 10g, TNS listener, EMS
#
#
# match these values to your environment:

export ORACLE_BASE=/usr/u01/app/oracle
export ORACLE_HOME=/usr/u01/app/oracle/product/10.2.0.1
export ORACLE_TERM=xterm
export PATH=/home/oracle/bin:$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
export DISPLAY=<your ip address>:0
export ORACLE_USER=oracle

# see how we are called:
case $1 in
start)
su – “$ORACLE_USER”<<EOO
lsnrctl start
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
EOO
;;

stop)
su – “$ORACLE_USER”<<EOO
lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
EOO
;;

*)
echo “Usage: $0 {start|stop}”
;;
esac

======= script end ==================

hope it will be useful

Komentar»

1. Santosh Deshmukh - 24 April 2007

Hi,

When i start the DB server some of the oracle service are not getting started, i want every thing need to be start automatically.

Thanking you in advance

2. sulistyoas - 25 April 2007

what exactly the service do you want to start ?

on this script i’m only add service such as emctl for web-based oracle database administration. but basically what i want to start automatic is listener, and oracle database. just don’t forget this script only works using root login, and can be use like below(manual) :
service start –> to start the database
service stop –> to stop the database

thank you

3. Akshat Madan - 21 Juni 2007

Can a second listener start up automatically (Two at a time ) while the first one was running smoothly in a 10g environment ?

=> haven’t try it before, but i think if use the lsnrctl start, every listener will be start. or perhaps it can be call using the listener name i’m still not so sure. if you have try it. please let me know.

thanks

4. sulistyoas - 24 Juni 2007

lsnrctl start is only starting to default listener that you have. I read my preparation book the format to starting the listener is
lsnrctl start so if you not mention the listener name it means it only starting the default listener. if you have more than one and want to start or stop together in the script try to add :
== start listener =========
lsnrctl start
=====================

== stop listener ========
lsnrctl stop
=====================

after the lsnrctl start command.

hope that will help.

thanks.

5. Javier - 13 Juli 2007

Hi there,
I am new in Oracle and I am using the scritp stated above to start my database automatically at boot time. I was watching the boot process and when it tries to execute the script comes up with user oracle not found and nothing starts,
Have you seen this before?
thanks,
javier2893

6. sulistyoas - 19 Juli 2007

I think the problem is because, when you install oracle on linux you are using different string for “$ORACLE_USER”. the standard user for installing user is oracle. if not the same then try to export ORACLE_USER =

thank you

7. Javier - 2 Agustus 2007

Hi sulistyoas,
Actually I am using the same user=oracle.
If I try to run the commnad in the OS this is the error I get:
./dbora: line 44: stop}: command not found
any ideas?
Thanks,

8. sulistyoas - 3 Agustus 2007

try to remove this part :
*)
echo “Usage: $0 {start|stop}”
;;

thanks

9. Javier - 6 Agustus 2007

Thanks, after removing the:
*)
echo “Usage: $0 {start|stop}”
;;
it worked.

10. Prithvi - 15 April 2008

I think, we can muliple database on solaris or linux but lisntner can be one for all database.

11. Julio Gonzalez - 6 Mei 2008

all that is wrong

change the parameter in /etc/oratab

change the Y for a N at the end of the line

12. sulistyoas - 21 Mei 2008

yes, we can use oratab, somehow oratab not include shutdown mechanism when we shutdown the machine which is sometimes can gives problem on startup the database. CMIIW, thank you

13. dbametrix - 9 Oktober 2009

Hi,

Very interesting. Thanks for such great article.

Thanks and regards,
Gitesh
http://www.dbametrix.com


Tinggalkan Balasan

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.