Skip Headers

Oracle® Database Administrator’s Reference
10g Release 1 (10.1) for UNIX Systems: AIX-Based Systems, hp HP-UX PA-RISC (64-bit), hp Tru64 UNIX, Linux x86, and Solaris Operating System (SPARC)
Part No. B10812-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous Next  

2 Starting and Stopping Oracle Software

This chapter describes how to identify Oracle Database processes running on UNIX systems, and provides basic information about how to stop and restart them. For more information about administering the products, see the appropriate product specific documentation. This chapter contains information about the following:

Stopping and Starting Oracle Processes

This section describes how to stop and start the processes for the following Oracle products:

Database or Automatic Storage Management Instances

This section describes how to stop and start database or Automatic Storage Management (ASM) instances.


Stopping Database or ASM Instances

To stop an Oracle database or ASM instance, follow these steps:

  1. If necessary, to identify the SID and Oracle home directory for the instance that you want to shut down, enter the following command:

    • For Solaris:

      $ cat /var/opt/oracle/oratab
      
      
    • For other operating systems:

      $ cat /etc/oratab
      
      

    The oratab file contains lines similar to the following, which identify the SID and corresponding Oracle home directory for each database or ASM instance on the system:

    sid:oracle_home_directory:[Y|N]
    
    

    Note:

    Oracle recommends that you use the plus sign (+) as the first character in the SID of ASM instances.


    Caution:

    Do not stop an ASM instance until you have stopped all Oracle database instances that use that ASM instance to manage their storage.

  2. Depending on your default shell, run the oraenv or coraenv script to set the environment variables for the instance that you want to shut down:

    • For the Bourne, Bash or Korn shell:

      $ . /usr/local/bin/oraenv
      
      
    • For the C shell:

      $ source /usr/local/bin/coraenv
      
      

    When prompted, specify the SID for the instance.

  3. Enter the following commands to shut down the instance:

    $ sqlplus /nolog
    SQL> CONNECT SYS/sys_password as SYSDBA
    SQL> SHUTDOWN NORMAL
    
    

    After the instance shuts down, you can exit from SQL*Plus.


Restarting Database or ASM Instances

To restart an Oracle database or Automatic Storage Management instance, follow these steps:

  1. If necessary, repeat steps 1 and 2 in the previous subsection to set the ORACLE_SID and ORACLE_HOME environment variables to identify the SID and Oracle home directory for the instance that you want to start.


    Caution:

    If the database instance uses ASM for storage management, you must start the ASM instance before you start the database instance.

  2. Enter the following commands to start the instance:

    $ sqlplus /nolog
    SQL> CONNECT SYS/sys_password as SYSDBA
    SQL> STARTUP
    
    

    After the instance starts, you can exit from SQL*Plus.

Oracle Net Listener

This section describes how to stop and start Oracle Net Listener.


Stopping Oracle Net Listener

To stop an Oracle Net listener, follow these steps:

  1. Enter the following command to determine the listener name and Oracle home directory for the Oracle Net listener that you want to stop:

    $ ps -ef | grep tnslsnr
    
    

    This command displays a list of the Oracle Net Listeners running on the system, similar to the following, where listenername1 and listenername2 are the names of the listeners:

    94248 ?? I 0:00.18 oracle_home1/bin/tnslsnr listenername1 -inherit
    94248 ?? I 0:00.18 oracle_home2/bin/tnslsnr listenername2 -inherit
    
    
  2. Set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for the listener that you want to stop:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home1
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      % setenv ORACLE_HOME oracle_home1
      
      
  3. Enter the following command to stop the Oracle Net listener:

    $ $ORACLE_HOME/bin/lsnrctl stop listenername
    
    

    Note:

    If the name of the listener is the default name LISTENER, you do not have to specify the name in this command.


Restarting Oracle Net Listener

To start an Oracle Net listener, follow these steps:

  1. If necessary, set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for the listener that you want to start:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home1
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      % setenv ORACLE_HOME oracle_home1
      
      
  2. Enter the following command to restart the Oracle Net Listener:

    $ $ORACLE_HOME/bin/lsnrctl start [listenername]
    
    

    You must specify the listener name only if it is different from the default listener name LISTENER. To determine the listener name, enter the following command to view the listener.ora file:

    $ more $ORACLE_HOME/network/admin/listener.ora
    
    

iSQL*Plus

This section describes how to stop and start iSQL*Plus.


Stopping iSQL*Plus

To stop iSQL*Plus, follow these steps:

  1. Set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for iSQL*Plus:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      $ setenv ORACLE_HOME oracle_home
      
      
  2. Enter the following command to stop iSQL*Plus:

    $ $ORACLE_HOME/bin/isqlplusctl stop
    
    

Starting iSQL*Plus

To start iSQL*Plus, follow these steps:

  1. If necessary, set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for the iSQL*Plus instance that you want to start:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      $ setenv ORACLE_HOME oracle_home
      
      
  2. Enter the following command to start iSQL*Plus:

    $ $ORACLE_HOME/bin/isqlplusctl start
    
    

Oracle Ultra Search

This section describes how to stop and start Oracle Ultra Search.


Stopping Oracle Ultra Search

To stop Oracle Ultra Search, follow these steps:

  1. If necessary, set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for Oracle Ultra Search:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      $ setenv ORACLE_HOME oracle_home
      
      
  2. Enter the following command to stop Oracle Ultra Search:

    $ $ORACLE_HOME/bin/searchctl stop
    
    

Starting Oracle Ultra Search

To start Oracle Ultra Search, follow these steps:

  1. If necessary, set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for Oracle Ultra Search:

    $ ORACLE_HOME=oracle_home
    $ export ORACLE_HOME
    
    
  2. Enter the following command to start Oracle Ultra Search:

    $ $ORACLE_HOME/bin/searchctl start
    
    

Oracle Enterprise Manager Database Control

This section describes how to stop and start Oracle Enterprise Manager Database Control (Database Control).


Stopping Database Control

To stop Database Control, follow these steps:

  1. Depending on your default shell, run the oraenv or coraenv script to set the environment for the database managed by the Database Control that you want to shut down:

    • For the coraenv script:

      $ source /usr/local/bin/coraenv
      
      
    • For the oraenv script:

      $ . /usr/local/bin/oraenv
      
      
  2. Enter the following command to stop the Database Control:

    $ $ORACLE_HOME/bin/emctl stop dbconsole
    
    

Starting Database Control

To start Database Control, follow these steps:

  1. If necessary, set the ORACLE_SID and ORACLE_HOME environment variables to identify the SID and Oracle home directory for the database control that you want to start:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home
      $ ORACLE_SID=sid
      $ export ORACLE_HOME ORACLE_SID
      
      
    • For the C or tcsh shell:

      $ setenv ORACLE_HOME oracle_home
      $ setenv ORACLE_SID sid
      
      
  2. Enter the following command to start the Database Control:

    $ $ORACLE_HOME/bin/emctl start dbconsole
    
    

Oracle Management Agent

If you are using Oracle Enterprise Manager Grid Control to manage multiple Oracle products from a central location, you must have an Oracle Management Agent installed on each host system. Typically, the Oracle Management Agent is installed in its own Oracle home directory.

This section describes how to stop and start Oracle Management Agent.


Stopping Oracle Management Agent

To stop Oracle Management Agent, follow these steps:

  1. If necessary, enter the following command to determine the Oracle home directory for Oracle Management Agent:

    $ ps -ef | grep emagent
    
    

    This command displays information about the Oracle Management Agent processes, similar to the following:

    94248 ?? I 0:00.18 oracle_home/agent/bin/emagent ...
    
    
  2. Set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for the Oracle Management Agent:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      $ setenv ORACLE_HOME oracle_home
      
      
  3. Enter the following command to stop Oracle Management Agent:

    $ $ORACLE_HOME/agent/bin/emctl stop agent
    
    

Starting Oracle Management Agent

To start Oracle Management Agent, follow these steps:

  1. If necessary, set the ORACLE_HOME environment variable to specify the appropriate Oracle home directory for the Oracle Management Agent:

    • For the Bourne, Bash, or Korn shell:

      $ ORACLE_HOME=oracle_home
      $ export ORACLE_HOME
      
      
    • For the C or tcsh shell:

      $ setenv ORACLE_HOME oracle_home
      
      
  2. Enter the following command to start Oracle Management Agent:

    $ $ORACLE_HOME/agent/bin/emctl start agent
    
    

Automating Startup and Shutdown


Note:

The procedure described in this section applies to single-instance databases only.

Oracle recommends that you configure your system to automatically start Oracle databases when the system starts up, and to automatically shut them down when the system shuts down. Automating database startup and shutdown guards against incorrect database shutdown.

To automate database startup and shutdown, use the dbstart and dbshut scripts, located in the $ORACLE_HOME/bin directory. The scripts refer to the same entries in the oratab file, and so must apply to the same set of databases. You cannot, for example, have the dbstart script automatically start sid1, sid2, and sid3, and have the dbshut script shut down only sid1. However, you can specify that the dbshut script shuts down a set of databases while the dbstart script is not used at all. To do this, include a dbshut entry in the system shutdown file, but omit the dbstart entry from the system startup files.


See Also:

For more information about system startup and shutdown procedures, see the init command in your UNIX system documentation.

The following section describes how to automate startup and shutdown of Oracle Database.

Automating Database Startup and Shutdown

Use dbstart and dbshut scripts to automate database startup and shutdown. Perform the following tasks to set up these scripts so that they are called at system start up and shut down. Perform these steps for every new database that you want to configure for automated startup and shutdown:

  1. Log in as the root user.

  2. Edit the oratab file for your platform:

    • On Solaris systems, the oratab file is located in the /var/opt/oracle directory

    • On other operating systems, the oratab file is located in the /etc directory.

    Database entries in the oratab file appear in the following format:

    SID:ORACLE_HOME:{Y|N}
    
    

    In this example, Y or N specifies whether you want the scripts to start up or shut down the database. For each database that you want to start up and shut down, find the instance identifier (SID) for that database, identified by the SID in the first field, and change the last field for each to Y.

  3. Change directory to one of the following, depending on your platform:

    • On AIX, change directory to /etc

    • On Linux and Solaris, change directory to /etc/init.d

    • On HP-UX and Tru64 UNIX, change directory to /sbin/init.d

  4. Create a file called dbora with the following contents. Change the value specified for the ORACLE_HOME environment variable to an Oracle home directory for your installation, and change the value of ORACLE environment variable to the value of the owner of the database installed in the Oracle home directory (typically oracle):

    #! /bin/sh  -x
    #
    # Change the value of ORACLE_HOME to specify the correct Oracle home
    # directory for you installation
    
    ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1
    #
    # change the value of ORACLE to the login name of the 
    # oracle owner at your site
    #
    
    ORACLE=oracle
    
    PATH=${PATH}:$ORACLE_HOME/bin
    HOST=`hostname`
    PLATFORM=`uname`
    export ORACLE_HOME PATH
    #
    if [ ! "$2" = "ORA_DB" ] ; then
       if [ "$PLATFORM" = "HP-UX" ] ; then
          remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
          exit
       else
          rsh $HOST -l $ORACLE  $0 $1 ORA_DB
          exit
       fi
    fi
    #
    LOG=$ORACLE_HOME/startup.log
    touch $LOG
    chmod a+r $LOG
    #
    
    case $1 in
    'start')
            echo "$0: starting up" >> $LOG
            date >> $LOG
            # Start Oracle Net
            if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
            then
                 echo "starting Oracle Net Listener"
                 $ORACLE_HOME/bin/lsnrctl start >> $LOG 2>&1 &
            fi
            echo "Starting Oracle databases"
            $ORACLE_HOME/bin/dbstart >> $LOG 2>&1 &
            ;;
    'stop')
            echo "$0: shutting down" >> $LOG
            date >> $LOG
            # Stop Oracle Net
            if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
            then
                 echo "stopping Oracle Net Listener"
                 $ORACLE_HOME/bin/lsnrctl stop >> $LOG 2>&1 &
            fi
            echo "stopping Oracle databases"
            $ORACLE_HOME/bin/dbshut >> $LOG 2>&1 &
            ;;
    *)
            echo "usage: $0 {start|stop}" 
            exit 
            ;;
    esac
    #
    exit
    

    Note:

    This script assumes that a password has not been set for the listener. If a password has been set for the listener, this script cannot stop the listener. Also, if the listener name is not the default name LISTENER, you must specify the listener name in the stop and start commands:
    $ORACLE_HOME/bin/lsnrctl {start|stop} listener_name
    
    

  5. Change the group of the dbora file to the OSDBA group (typically dba) and set the permissions to 750.

    # chgrp dba dbora
    # chmod 750 dbora
    
    
  6. Create symbolic links to the dbora script in the appropriate run-level script directories, as follows:

    • On AIX, enter the following commands:

      # ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora
      # ln -s /etc/dbora /etc/rc.d/rc2.d/K01dbora
      
      
    • On HP-UX systems, enter the following commands:

      # ln -s /sbin/init.d/dbora /sbin/rc3.d/S990dbora
      # ln -s /sbin/init.d/dbora /sbin/rc3.d/K001dbora
      
      
    • On Linux systems, enter the following commands:

      # ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
      # ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
      # ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
      # ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
      
      
    • On Solaris systems, enter the following commands:

      # ln -s /etc/init.d/dbora /etc/rc3.d/K01dbora
      # ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
      
      
    • Tru64 UNIX systems, enter the following commands:

      # ln -s /sbin/init.d/dbora /sbin/rc3.d/S99dbora
      # ln -s /sbin/init.d/dbora /sbin/rc3.d/K01dbora