基于RHEL6.5安装Oracle11g详细教程(7)——配置Oracle自启动
7 配置Oracle自启动
将/etc/oratab文件中的orcl:/u01/app/oracle/product/11.2.0/db_1:N修改为
我们提供的服务有:做网站、网站建设、微信公众号开发、网站优化、网站认证、临县ssl等。为上1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的临县网站制作公司
orcl:/u01/app/oracle/product/11.2.0/db_1:Y
[root@oracle ~]# vi /etc/oratab
orcl:/u01/app/oracle/product/11.2.0/db_1:Y
[root@oracle ~]# su - oracle
[oracle@oracle ~]$ cd $ORACLE_HOME/bin
将dbstart文件中的ORACLE_HOME_LISTNER=$1修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@oracle bin]$ vi dbstart
ORACLE_HOME_LISTNER=$ORACLE_HOME
将dbshut文件中的ORACLE_HOME_LISTNER=$1修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@oracle bin]$ vi dbshut
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@oracle bin]$ ./dbshut
Processing Database instance "orcl": log file /u01/app/oracle/product/11.2.0/db_1/shutdown.log
[oracle@oracle bin]$ ./dbstart
Processing Database instance "orcl": log file /u01/app/oracle/product/11.2.0/db_1/startup.log
[oracle@oracle bin]$ exit
logout
[root@oracle ~]# cd /etc/rc.d/init.d/
[root@oracle init.d]# vi oracle
#!/bin/bash
# chkconfig: 345 99 10
# description: Startup Script for Oracle Databases
# /etc/rc.d/init.d/oracle
export ORACLE_BASE=/u01/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORA_OWNR -c "$ORACLE_HOME/bin/dbstart"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
touch /var/lock/Oracle
su - $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
#su - $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctrl start"
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
#su - $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctrl stop"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/dbshut"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
rm -f /var/lock/Oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
[root@oracle init.d]# ls -l
total 392
-rwxr-xr-x. 1 root root 1288 Aug 14 2013 abrt-ccpp
-rwxr-xr-x. 1 root root 1628 Aug 14 2013 abrtd
-rwxr-xr-x. 1 root root 1642 Aug 14 2013 abrt-oops
-rwxr-xr-x. 1 root root 1725 Dec 3 2009 acpid
-rwxr-xr-x. 1 root root 2062 Jan 20 2012 atd
-rwxr-xr-x. 1 root root 3378 Mar 14 2012 auditd
-rwxr-xr-x. 1 root root 4043 Oct 30 2013 autofs
-r-xr-xr-x. 1 root root 1340 Oct 30 2013 blk-availability
-rwxr-xr-x. 1 root root 710 Jun 30 2010 bluetooth
-rwxr-xr-x. 1 root root 2094 Jan 12 2013 certmonger
-rwxr-xr-x. 1 root root 11355 Aug 2 2013 cpuspeed
-rwxr-xr-x. 1 root root 2826 Sep 12 2013 crond
-rwxr-xr-x. 1 root root 3034 Aug 7 2013 cups
-rwxr-xr-x. 1 root root 1702 Jan 4 2013 DNSmasq
-rwxr-xr-x. 1 root root 3245 Jul 9 2013 firstboot
-rw-r--r--. 1 root root 18586 Oct 10 2013 functions
-rwxr-xr-x. 1 root root 1801 Apr 1 2011 haldaemon
-rwxr-xr-x. 1 root root 5866 Oct 10 2013 halt
-rwxr-xr-x. 1 root root 2001 Aug 2 2013 htcacheclean
-rwxr-xr-x. 1 root root 3371 Aug 2 2013 httpd
-rwxr-xr-x. 1 root root 10804 Sep 17 2013 ip6tables
-rwxr-xr-x. 1 root root 10688 Sep 17 2013 iptables
-rwxr-xr-x. 1 root root 1938 Aug 23 2013 irqbalance
-rwxr-xr-x. 1 root root 18133 Oct 22 2013 kdump
-rwxr-xr-x. 1 root root 652 Oct 10 2013 killall
-r-xr-xr-x. 1 root root 2134 Oct 30 2013 lvm2-lvmetad
-r-xr-xr-x. 1 root root 2665 Oct 30 2013 lvm2-monitor
-rwxr-xr-x. 1 root root 2571 Oct 11 2013 mdmonitor
-rwxr-xr-x. 1 root root 2200 Sep 7 2012 messagebus
-rwxr-xr-x. 1 root root 2989 Oct 10 2013 netconsole
-rwxr-xr-x. 1 root root 5428 Oct 10 2013 netfs
-rwxr-xr-x. 1 root root 6334 Oct 10 2013 network
-rwxr-xr-x. 1 root root 2205 Oct 23 2013 NetworkManager
-rwxr-xr-x. 1 root root 6364 Oct 10 2013 nfs
-rwxr-xr-x. 1 root root 3526 Oct 10 2013 nfslock
-rwxr-xr-x. 1 root root 1923 Jul 15 2013 ntpd
-rwxr-xr-x. 1 root root 2043 Jul 15 2013 ntpdate
-rwxr-xr-x. 1 root root 2261 Feb 25 2011 oddjobd
-rw-r--r-- 1 root root 1405 May 15 07:14 oracle
-rwxr-xr-x. 1 root root 2023 Feb 1 2012 portreserve
-rwxr-xr-x. 1 root root 3852 May 13 2011 postfix
-rwxr-xr-x. 1 root root 1556 Jul 10 2012 psacct
-rwxr-xr-x. 1 root root 2034 Jun 13 2013 quota_nld
-rwxr-xr-x. 1 root root 1513 Sep 17 2013 rdisc
-rwxr-xr-x. 1 root root 1822 Oct 15 2013 restorecond
-rwxr-xr-x. 1 root root 2898 Mar 20 2010 rhnsd
-rwxr-xr-x. 1 root root 1215 Oct 17 2013 rhsmcertd
-rwxr-xr-x. 1 root root 1808 Dec 3 2011 rngd
-rwxr-xr-x. 1 root root 2073 Oct 23 2012 rpcbind
-rwxr-xr-x. 1 root root 2518 Oct 10 2013 rpcgssd
-rwxr-xr-x. 1 root root 2305 Oct 10 2013 rpcidmapd
-rwxr-xr-x. 1 root root 2464 Oct 10 2013 rpcsvcgssd
-rwxr-xr-x. 1 root root 2011 Aug 15 2013 rsyslog
-rwxr-xr-x. 1 root root 1698 Oct 15 2013 sandbox
-rwxr-xr-x. 1 root root 2056 Nov 20 2012 saslauthd
-rwxr-xr-x. 1 root root 647 Oct 10 2013 single
-rwxr-xr-x. 1 root root 3002 Sep 26 2012 smartd
-rwxr-xr-x. 1 root root 2162 Sep 11 2013 snmpd
-rwxr-xr-x. 1 root root 1738 Sep 11 2013 snmptrapd
-rwxr-xr-x. 1 root root 2472 Sep 10 2013 spice-vdagentd
-rwxr-xr-x. 1 root root 4534 Sep 30 2013 sshd
-rwxr-xr-x. 1 root root 2712 Oct 23 2013 sssd
-rwxr-xr-x. 1 root root 1144 Sep 17 2013 sysstat
-rwxr-xr-x. 1 root root 2294 Oct 17 2013 udev-post
-rwxr-xr-x. 1 root root 40189 May 14 17:10 vmware-tools
-rwxr-xr-x. 1 root root 1674 Aug 24 2012 wdaemon
-rwxr-xr-x. 1 root root 1608 Oct 11 2013 winbind
-rwxr-xr-x. 1 root root 1866 Sep 7 2012 wpa_supplicant
-rwxr-xr-x. 1 root root 4799 Oct 10 2012 ypbind
[root@oracle init.d]# chmod +x oracle
[root@oracle init.d]# ls -l | grep oracle
-rwxr-xr-x 1 root root 1405 May 15 07:14 oracle
[root@oracle init.d]# chkconfig --level 2345 oracle on
[root@oracle init.d]# ./oracle
Usage: oracle start|stop|restart|reload
[root@oracle init.d]# cd /etc/rc.d/rc5.d/
[root@oracle rc5.d]# ls -l | grep oracle
lrwxrwxrwx 1 root root 16 May 15 07:18 S99oracle -> ../init.d/oracle
[root@oracle rc5.d]# reboot
Broadcast message from root@oracle.kely.com
(/dev/pts/0) at 7:21 ...
The system is going down for reboot NOW!
[root@oracle ~]# su - oracle
[oracle@oracle ~]$ ps -efw | grep ora_
oracle 2056 1 0 07:21 ? 00:00:00 ora_pmon_orcl
oracle 2058 1 0 07:21 ? 00:00:00 ora_vktm_orcl
oracle 2062 1 0 07:21 ? 00:00:00 ora_gen0_orcl
oracle 2064 1 0 07:21 ? 00:00:00 ora_diag_orcl
oracle 2066 1 0 07:21 ? 00:00:00 ora_dbrm_orcl
oracle 2068 1 0 07:21 ? 00:00:00 ora_psp0_orcl
oracle 2070 1 0 07:21 ? 00:00:00 ora_dia0_orcl
oracle 2072 1 0 07:21 ? 00:00:00 ora_mman_orcl
oracle 2074 1 0 07:21 ? 00:00:00 ora_dbw0_orcl
oracle 2076 1 0 07:21 ? 00:00:00 ora_lgwr_orcl
oracle 2078 1 0 07:21 ? 00:00:00 ora_ckpt_orcl
oracle 2080 1 0 07:21 ? 00:00:00 ora_smon_orcl
oracle 2082 1 0 07:21 ? 00:00:00 ora_reco_orcl
oracle 2084 1 0 07:21 ? 00:00:00 ora_mmon_orcl
oracle 2086 1 0 07:21 ? 00:00:00 ora_mmnl_orcl
oracle 2088 1 0 07:21 ? 00:00:00 ora_d000_orcl
oracle 2090 1 0 07:21 ? 00:00:00 ora_s000_orcl
oracle 2133 1 0 07:21 ? 00:00:00 ora_p000_orcl
oracle 2135 1 0 07:21 ? 00:00:00 ora_p001_orcl
oracle 2137 1 0 07:22 ? 00:00:00 ora_qmnc_orcl
oracle 2666 1 0 07:22 ? 00:00:00 ora_cjq0_orcl
oracle 2728 1 0 07:22 ? 00:00:00 ora_q000_orcl
oracle 2730 1 0 07:22 ? 00:00:00 ora_q001_orcl
oracle 3742 1 1 07:26 ? 00:00:00 ora_j000_orcl
oracle 3744 1 0 07:26 ? 00:00:00 ora_j001_orcl
oracle 3759 3717 0 07:26 pts/0 00:00:00 grep ora_
[oracle@oracle ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-MAY-2014 07:26:33
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle.kely.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 15-MAY-2014 07:21:46
Uptime 0 days 0 hr. 4 min. 48 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracle ~]$ ps -efw | grep LISTEN | grep -v grep
oracle 1940 1 0 07:21 ? 00:00:00 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
当前标题:基于RHEL6.5安装Oracle11g详细教程(7)——配置Oracle自启动
转载来源:http://scyanting.com/article/jseesj.html