SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>
[root@ora11g init.d]# uname -r
2.6.32-200.13.1.el5uek
[root@ora11g init.d]# pwd
/etc/init.d
[root@ora11g init.d]# vim dbora
#!/bin/bash
#
#
#
# chkconfig: 35 99 01
# description: This script starts your Oracle databases
### BEGIN INIT INFO
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
### END INIT INFO
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for you installation
ORACLE_USER=oracle
ORACLE_HOME=/u01/oracle/product/11.2.0/dbhome_1
case $1 in
'start')
echo "$0: starting up"
echo "Starting Oracle databases"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
;;
'stop')
echo "$0: shutting down"
echo "stopping Oracle databases"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
[root@ora11g init.d]# chgrp dba dbora
[root@ora11g init.d]# chmod 750 dbora [root@ora11g init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
[root@ora11g init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
[root@ora11g init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
[root@ora11g init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
[root@ora11g init.d]# ls ../rc*.d/*db*
ls: ../rc*.d/*db*: No such file or directory
[root@ora11g init.d]# chkconfig --add dbora
[root@ora11g init.d]# ls ../rc*.d/*db*
../rc0.d/K01dbora ../rc2.d/K01dbora ../rc4.d/K01dbora ../rc6.d/K01dbora
../rc1.d/K01dbora ../rc3.d/S99dbora ../rc5.d/S99dbora
[oracle@ora11g bin]$ /etc/init.d/dbora start
/etc/init.d/dbora: starting up
Starting Oracle databases
Processing Database instance "ora11g": log file /u01/oracle/product/11.2.0/dbhome_1/startup.log
[oracle@ora11g bin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-MAR-2012 23:02:47
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora11g.example.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 26-MAR-2012 23:02:24
Uptime 0 days 0 hr. 0 min. 22 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/oracle/diag/tnslsnr/ora11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
Service "ora11g.service" has 1 instance(s).
Instance "ora11g", status UNKNOWN, has 1 handler(s) for this service...
Service "ora11gXDB" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@ora11g bin]$ /etc/init.d/dbora stop
/etc/init.d/dbora: shutting down
stopping Oracle databases
Processing Database instance "ora11g": log file /u01/oracle/product/11.2.0/dbhome_1/shutdown.log
[oracle@ora11g bin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-MAR-2012 23:03:02
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora11g.example.com)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
[oracle@ora11g bin]$
REF:
Automating Database Startup and Shutdown on Other Operating Systems
http://docs.oracle.com/html/B10812_06/chapter2.htm#CHDBGJAC