乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      How to Automate Startup/Shutdown of Oracle Database on Linux [ID 222813.1]

       浸心閣 2015-05-31
      How to Automate Startup/Shutdown of Oracle Database on Linux [ID 222813.1]

        Modified 22-NOV-2010     Type BULLETIN     Status PUBLISHED  

      In this Document
        Purpose
        Scope and Application
        How to Automate Startup/Shutdown of Oracle Database on Linux
        References


      Applies to:

      Oracle Server - Enterprise Edition - Version: 8.0.3.0 to 10.1.0.2 - Release: 8.0.3 to 10.1
      Linux OS - Version: 2.4 to 2.6]
      Linux x86
      Linux x86-64
      Linux Itanium
      Linux Kernel - Version: 2.4 to 2.6
      This document applies to:
      SLES7, SLES8, SLES9, SLES10
      RHAS 2.1, RHEL 3,4,5, OEL 4,5

      ***Checked for relevance on 22-November-2010***

      Purpose

      This document aims to demonstrate automatic startup and shutdown of Oracle databases on Linux. 

      Scope and Application

      The information in this document is useful for system administrators and database administrators trying to automate Oracle database startup and shutdown. The document describes the detailed steps for configuration on Red Hat Advanced Server 2.1, RedHat Enterprise Linux (RHEL) 3,4,5, SuSE SLES7, United Linux 1.0 (SuSE SLES8 Edition), SLES9, SLES10, Oracle Enterprise Linux (OEL) 4,5.  The information may not apply to other Linux distributions.

      The following configuration is done to allow Oracle database be up and running in runlevels 3 (character mode) and 5 (X-Window system) and the start / stop commands does not provide the exhaustive list of all possibilities and it presents an example. Therefore the exact scripts may not work with your configuration

      Since the configuration is based on dbstart and dbshut scripts provided by the Oracle Server installation, please see Note 207508.1

      The configuration also facilitates automated startup shutdown of Intelligent Agent, Management Server and HTTP Server, which are available with Oracle Server.

      The information in this document does not apply to Oracle Internet Application Server. Still the script can be configured to handle starting up and shutting  down iAS processes. 

      How to Automate Startup/Shutdown of Oracle Database on Linux


      1. Update 'oratab' (under /etc or /var/opt/oracle) as:

         <SID>:<ORACLE_HOME>:Y
      where Y states that the database can be started up and shutdown using 
      dbstart/dbshut.

      2. Create the service script:

           /etc/init.d/dbora
      Note: In Red Hat Advanced Server 2.1, the /etc/init.d is is a symbolic link to  /etc/rc.d/init.d 

      Content of the script is as follows:

      1. #!/bin/bash  
      2.   #  
      3.   # chkconfig: 2345 99 10     
      4.   # description: Starts and stops Oracle processes  
      5.   #  
      6.   # Set ORA_HOME to be equivalent to the $ORACLE_HOME  
      7.   # from which you wish to execute dbstart and dbshut;  
      8.   #  
      9.   # Set ORA_OWNER to the user id of the owner of the  
      10.   # Oracle database in ORA_HOME.  
      11.   #  
      12.   ORA_HOME=<Type your ORACLE_HOME in full path here>  
      13.   ORA_OWNER=<Type your Oracle account name here>  
      14.   
      15.   case "$1" in  
      16.     'start')  
      17.        # Start the TNS Listener  
      18.        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"  
      19.        # Start the Oracle databases:  
      20.        # The following command assumes that the oracle login  
      21.        # will not prompt the user for any values  
      22.        su - $ORA_OWNER -c $ORA_HOME/bin/dbstart  
      23.        # Start the Intelligent Agent  
      24.        if [ -f $ORA_HOME/bin/emctl ]; then  
      25.           su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start agent"  
      26.        elif [ -f $ORA_HOME/bin/agentctl ]; then  
      27.           su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl start"  
      28.        else  
      29.           su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_start"  
      30.        fi  
      31.        # Start Management Server  
      32.        if [ -f $ORA_HOME/bin/emctl ]; then  
      33.           su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"  
      34.        elif [ -f $ORA_HOME/bin/oemctl ]; then  
      35.           su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl start oms"  
      36.        fi  
      37.        # Start HTTP Server  
      38.        if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then  
      39.           su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"  
      40.        fi  
      41.        touch /var/lock/subsys/dbora  
      42.        ;;  
      43.     'stop')  
      44.        # Stop HTTP Server  
      45.        if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then  
      46.           su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"  
      47.        fi  
      48.        # Stop the TNS Listener  
      49.        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"  
      50.        # Stop the Oracle databases:  
      51.        # The following command assumes that the oracle login  
      52.        # will not prompt the user for any values  
      53.        su - $ORA_OWNER -c $ORA_HOME/bin/dbshut  
      54.        rm -f /var/lock/subsys/dbora  
      55.        ;;  
      56.   esac  
      57.   # End of script dbora  

      or


      1. #! /bin/sh  
      2. #  
      3. # MEmes: 03/07/2011: Oracle SysV script  
      4. #  
      5. # chkconfig: 2345 98 2  
      6. # description: Oracle database start/stop script  
      7.   
      8. ### BEGIN INIT INFO  
      9. # Provides:             oracle  
      10. # Required-Start:       $network  
      11. # Required-Stop:  
      12. # Default-Start:        2 3 4 5  
      13. # Default-Stop:         0 1 6  
      14. # Short-Description:    Oracle database start/stop script  
      15. # Description:          Automatically starts/stops oracle instance  
      16. ### END INIT INFO  
      17.   
      18. ORACLE_USER=${ORACLE_USER:-oracle}  
      19. ORACLE_SID=${ORACLE_SID:-oracle}  
      20. ORAENV_ASK=NO  
      21. PATH=/usr/local/bin:/usr/bin:/bin  
      22. [ -r /usr/local/bin/oraenv ] &&     . /usr/local/bin/oraenv > /dev/null 2>/dev/null  
      23.   
      24. . /etc/rc.d/init.d/functions  
      25.   
      26. prep ()  
      27. {  
      28.     # Test for valid ORACLE_HOME  
      29.     if [ ! -d "${ORACLE_HOME}" ]; then  
      30.         failure $"ORACLE_HOME is not a valid directory: ${ORACLE_HOME}"  
      31.         echo  
      32.         exit 1  
      33.     fi  
      34.     # Test for SQL*Plus executable  
      35.     SQLPLUS=${SQLPLUS:-"${ORACLE_HOME}/bin/sqlplus"}  
      36.     if [ ! -x "${SQLPLUS}" ]; then  
      37.         failure $"Cannot locate SQL*Plus executable: ${SQLPLUS}"  
      38.         echo  
      39.         exit 1  
      40.     fi  
      41.     # Test for lsnrctl executable  
      42.     LSNRCTL=${LSNRCTL:-"${ORACLE_HOME}/bin/lsnrctl"}  
      43.     if [ ! -x "${LSNRCTL}" ]; then  
      44.         failure $"Cannot locate lsnrctl executable: ${LSNRCTL}"  
      45.         echo  
      46.         exit 1  
      47.     fi  
      48.     return 0  
      49. }  
      50.   
      51. startup ()  
      52. {  
      53.     # Modify network to reflect current hostname  
      54.     #sed -i -e "s/HOST = [^)]*/HOST = $(hostname -f)/g" ${ORACLE_HOME}/network/admin/tnsnames.ora  
      55.     #sed -i -e "s/HOST = [^)]*/HOST = $(hostname -f)/g" ${ORACLE_HOME}/network/admin/listener.ora  
      56.     # Start Oracle database and listener  
      57.     echo -n $"Starting Oracle DB: "  
      58.     su -c "${SQLPLUS} /nolog" ${ORACLE_USER} > /dev/null 2>&1 <<EOF  
      59. connect / as sysdba  
      60. startup  
      61. exit  
      62. EOF  
      63.     success  
      64.     echo  
      65.     echo -n $"Starting Oracle Listener: "  
      66.     su -c "${LSNRCTL} start" ${ORACLE_USER} > /dev/null 2>&1  
      67.     success  
      68.     echo  
      69. }  
      70.   
      71. shutdown ()  
      72. {  
      73.     # Shutdown Oracle listener and database  
      74.     echo -n $"Stopping Oracle Listener: "  
      75.     su -c "${LSNRCTL} stop" ${ORACLE_USER} > /dev/null 2>&1  
      76.     success  
      77.     echo  
      78.     echo -n $"Stopping Oracle DB: "  
      79.     su -c "${SQLPLUS} /nolog" ${ORACLE_USER} > /dev/null 2>&1 <<EOF  
      80. connect / as sysdba  
      81. shutdown immediate  
      82. exit  
      83. EOF  
      84.     success  
      85.     echo  
      86. }  
      87.   
      88. case "$1" in  
      89.     start)  
      90.         # Oracle listener and instance startup  
      91.         prep  
      92.         startup  
      93.         ;;  
      94.     stop)  
      95.         # Oracle listener and instance shutdown  
      96.         prep  
      97.         shutdown  
      98.         ;;  
      99.     reload|restart)  
      100.         prep  
      101.         shutdown  
      102.         startup  
      103.         ;;  
      104.     *)  
      105.         echo "Usage: $(basename $0) start|stop|restart|reload"  
      106.         exit 1  
      107. esac  
      108.   
      109. exit 0  



      NOTE1:

      The lines:

        # chkconfig: 35 99 10   
        # description: Starts and stops Oracle database
      are mandatory since they describe the characteristics of the service where:
      • 35 means that the service will be started in init levels 3 and 5 and will be  stopped in other levels.
      • 99 means that the service will be started at the near end of the init level processing
      • 10 means that the service will be stopped at the near beginning of the init level processing
      NOTE 2: 
      The Management Server is not shut down during service stop since it requires interaction and there is no harm in system killing the processes since the database is shut down already.

      3. Set script permissions:

      1. chmod 755 /etc/init.d/dbora  

      4. Register the Service

      1. /sbin/chkconfig --add dbora  

      This action registers the service to the Linux service mechanism. On SuSE SLES7 and Red Hat Advanced Server 2.1 it will arrange symbolic links under rc<runlevel>.d directories to /etc/init.d/dbora script.

      The above configuration applies also to RHEL 3,4,5 and OEL 4.5.


      Finished!


      NOTE 3:
      The chkconfig utility calls 'insserv' to register and add services. The 'insserv' version shipped with SUSE SLES8, SLES9 and SLES10 is using the following header to define run level and start/shutdown order.
          ### BEGIN INIT INFO
          # Provides:       dbora      
          # Required-Start: $local_fs $remote_fs $netdaemons
          # Required-Stop:
          # Default-Start:  3 5
          # Default-Stop:   0 1 2 3 4 5 6
          # Description:    Oracle Startup
          ### END INIT INFO
      
      On SuSE SLES7 the following symbolic links are created:
      • /etc/init.d/rc0.d/K10dbora
      • /etc/init.d/rc1.d/K10dbora
      • /etc/init.d/rc2.d/K10dbora
      • /etc/init.d/rc3.d/S99dbora
      • /etc/init.d/rc4.d/K10dbora
      • /etc/init.d/rc5.d/S99dbora
      • /etc/init.d/rc6.d/K10dbora
      On Red Hat Advanced Server 2.1 the following symbolic links are created:
      • /etc/rc.d/rc0.d/K10dbora
      • /etc/rc.d/rc1.d/K10dbora
      • /etc/rc.d/rc2.d/K10dbora
      • /etc/rc.d/rc3.d/S99dbora
      • /etc/rc.d/rc4.d/K10dbora
      • /etc/rc.d/rc5.d/S99dbora
      • /etc/rc.d/rc6.d/K10dbora
      The symbolic links are not created in SLES8 and after  with the 'chkconfig -add' command. To have the symbolic links created run the following in addition:
         /sbin/chkconfig --set dbora 35
      After this action, the following symbolic links will be created pointing to /etc/init.d/dbora script:
      • /etc/init.d/rc3.d/S01dbora
      • /etc/init.d/rc3.d/K22dbora
      • /etc/init.d/rc5.d/S01dbora
      • /etc/init.d/rc5.d/K22dbora
      In all cases, the 'dbora' service will be running in runlevels 3,5 and it will be stopped in other runlevels (i.e. 0,1,2,4,6).

      NOTE 4:
      The script in this document assumes that:
      • ORACLE_HOME and other required environment settings are done in the login script of ORA_OWNER
      • There is no auto-running script like multiple ORACLE_HOME selection in the login profile of ORA_OWNER
      NOTE 5:
      If SELinux is enabled use "sudo su" instead of "su" in the dbora script. See Note 357906.1

      References

      NOTE:1016388.102 - LINUX: DBSHUT FAILS WHEN ISSUING REBOOT, INIT6, OR SHUTDOWN.
      NOTE:1074016.6 - 'dbora' does Not Work on RedHat Linux
      NOTE:126146.1 - Customizing System Startup in RedHat Linux
      NOTE:207508.1 - Dbstart does not work if using an spfile only
      NOTE:357906.1 - Automated Database Startup Fails When SELinux Is Enabled
      Linux man page: chkconfig (8)
      Linux man page: chmod (1)
      Linux man page: init.d (7)
      Linux man page: ln (1)

      Show Related Information Related


      Products
      • Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition
      • Oracle Linux and Virtualization > Oracle Linux > Operating System > Linux OS
      Keywords
      START LISTENER; RUNLEVEL; INIT

        本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多