设为首页 收藏本站
查看: 631|回复: 0

[经验分享] 基于RHEL 6.5安装Oracle 11g详细教程(7)——配置Oracle自启动

[复制链接]

尚未签到

发表于 2018-9-12 08:44:55 | 显示全部楼层 |阅读模式
7  配置Oracle自启动
  将/etc/oratab文件中的orcl:/u01/app/oracle/product/11.2.0/db_1:N修改为
           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


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-573134-1-1.html 上篇帖子: Linux oracle cool back scritp-Permanent 下篇帖子: Linux Oracle Rac 10G 搭建& Patch-fatherhome
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表