Friday 29 September 2017

Automating Database Startup and Shutdown on Windows server

To automate database startup and shutdown by using Oracle Administration Assistant for Windows:

1. From the Start menu, select All Programs, then select Oracle - HOMENAME,then select Configuration
    and Migration Tools, and then select Administration Assistant for Windows.
   
                        

2.    Right-click the SID.

3.    Select Startup/Shutdown Options.

                       

4.    Select the Oracle Instance tab.

5.    Select start up instance when service is started.

                  

                     
6.    Select the Oracle NT Service tab.

7.    Select Automatic in Oracle NT Service Startup Type.

                  

8.    Click Apply.

9.    Click OK.

Done. All set now, Oracle database will start automatically when system reboots on windows machine

Automating Database Startup and Shutdown on Linux/AIX server

To automate database startup and shutdown by using the dbstart and dbshut scripts:

1. Create autorestart configuration script for each users like below,

For e.g., below I did for oracle user DEV instance, similarly do the same for other instances,

      

Note:
    dbstart and dbshut script can only stop Oracle Net listener for which a password has not been set.
    In addition, if the listener name is not the default name, LISTENER, then you must specify the
    listener name in the stop and start commands:

           $ORACLE_HOME/bin/lsnrctl {start|stop} listener_name

2. After that log in as the root user.

3. Edit the oratab file
    a. On Linux, vi /etc/oratab
    b. Database entries in the oratab file are displayed in the following format:
        $ORACLE_SID:$ORACLE_HOME:<N|Y>
        You should select option as Y to automate shutdown and startup database.
        As the values Y and N specify whether you want the scripts to start or shut down the database,
        respectively. For each database for which you want to automate shutdown and startup, first determine
        the instance identifier (SID) for that database, which is identified by the SID in the first field.
        Then, change the last field for each to Y.

      

4. Change directory to one of the following, depending on the operating system:

      


5. Create a file called dbora, and copy the following lines into this file:

      

6. 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

7. Create symbolic links to the dbora script in the appropriate run-level script directories, as follows:

      
       

Give execution permission to all the scripts and reboot your server then test your automation.

Good Luck !!!