oracle linux 5 中随系统自动启动停止数据库oracle 11g R2的脚本
[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
[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