11gR2; Automatic restart of DB Console

August 2nd, 2011 | Posted in 11gR2, Blog, grid infrastructure, oracle restart, RAC | 5 Comments

   

Download the pdf version here: DB console Au Restart EN

Introduction:

Oracle Restart is a component added to the 11gR2 in order to improve the high availability of different database resources.
Database instances, listeners are resources that can be automatically restarted after a hardware or software failure or whenever the server host restarts.
These components can be easily added to the Oracle Restart using the crsctl add command.

The procedure of adding the DB Console as a resource is different. In this article, I am going to show you how to add this component to the Oracle Restart.
More info about oracle restart: http://docs.oracle.com/cd/E14072_01/server.112/e10595/restart001.htm

Test Environment: The following procedure has been tested on an 11.2.0.2.2 database, single standalone grid infrastructure under Redhat Enterprise Linux.
The same procedure could be applied in a RAC environment, in this case, you could apply the same procedure on the different nodes of your cluster.
Remember, the database version must be from 11gR2.

The procedure:

Step1: With your gird user, create 2 scripts under $GRID_HOME/crs/script, in my case: /opt/11.2.0/grid/crs/script/.
See the content of those 2 scripts below;

-bash-3.2$ cat agentstartup.sh

#!/bin/bash

#

# dbcagent.sh - script to start and stop the dbconsole 11gR2 agent

#

# description: Oracle 11gR2 database console agent

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

LIBRARY_PATH=$ORACLE_HOME/lib

ORACLE_SID=orawiss

ORACLE_UNQNAME=$ORACLE_SID

export ORACLE_BASE

export ORACLE_HOME

export LD_LIBRARY_PATH

export ORACLE_SID

export ORACLE_UNQNAME

touch /tmp/test20.log

agent_start () {

 touch /tmp/test22.log

 $ORACLE_HOME/bin/emctl start dbconsole

}

agent_stop () {

  $ORACLE_HOME/bin/emctl stop dbconsole

}

agent_check () {

  $ORACLE_HOME/bin/emctl status dbconsole

}

case "$1" in

  start)

         touch /tmp/test22.log

          agent_start

        ;;

  stop)

        agent_stop

        ;;

  check)

    agent_check

        ;;

  clean)

    agent_clean $(ps -C emagent -o pid=)

    ;;

  *)

        echo $"Usage: `basename $0` {start|stop|status|clean}"

        exit 1

esac

-bash-3.2$

-bash-3.2$ cat crs_dbconsole.sh

#!/bin/bash

#

# dbcagent.sh - script to start and stop the dbconsole 11gR2 agent

#

# description: Oracle 11gR2 database console agent

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

LIBRARY_PATH=$ORACLE_HOME/lib

ORACLE_SID=orawiss
ORACLE_UNQNAME=$ORACLE_SID

PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_BASE

export ORACLE_HOME

export LD_LIBRARY_PATH

export ORACLE_SID

export ORACLE_UNQNAME

export PATH

agent_start () {

sudo -u oracle  /opt/11.2.0/grid/crs/script/agentstartup.sh start

}

agent_stop () {

sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh stop

}

agent_check () {

  sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh check

}

case "$1" in

  start)

        agent_start

        ;;

  stop)

        agent_stop

        ;;

  check)

    agent_check

        ;;

  clean)

    agent_clean $(ps -C emagent -o pid=)

    ;;

  *)

        echo $"Usage: `basename $0` {start|stop|status|clean}"

        exit 1

esac

-bash-3.2$

Step2: Give the appropriate privileged to the 2 scripts created in the step1;


-bash-3.2$ su - grid

-bash-3.2$ cd  /opt/11.2.0/grid/crs/script/

-bash-3.2$ chmod 755 *

-bash-3.2$ ls -rtl

total 8

-rwxr-xr-x 1 grid oinstall 1017 Jul  8 14:38 crs_dbconsole.sh

-rwxr-xr-x 1 grid oinstall  892 Jul  8 15:10 agentstartup.sh

-bash-3.2$

Step3:
As a root user, edit the /etc/sudoers file;

First, change the file permission from 440 to 640.

As a root user:

[root@myhost ~]# chmod 640 /etc/sudoers

In the bottom of the file, add the following 3 lines;

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh start

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh stop

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh check

Where, myhost is the hostname of the database server and the system user “oracle” owner of the oracle software.

Don’t forget to comment out the line ;

#Defaults requiretty

After doing that change, roll back the file permission to 440;

[root@myhost ~]# chmod 440 /etc/sudoers

Step4:
As oracle user,
change the permissions of the following files:

chmod 664 /opt/app/oracle/product/11.2.0/db_1/sysman/config/emd.properties

chmod 664 /opt/app/oracle/product/11.2.0/db_1/myhost_orawiss/sysman/config/emd.properties

chmod 755 /opt/app/oracle/product/11.2.0/db_1/bin/emctl

Step5: Add a new resource “crs_dbconsole” to the Oracle Restart.


-bash-3.2$

-bash-3.2$ crsctl delete res crs_dbconsole

CRS-2613: Could not find resource 'crs_dbconsole'.

CRS-4000: Command Delete failed, or completed with errors.

-bash-3.2$ crsctl add resource crs_dbconsole -type local_resource -attr " ACTION_SCRIPT=/opt/11.2.0/grid/crs/script/crs_dbconsole.sh,

DESCRIPTION=Local DB Console Ressource for DB Console Agent, DEGREE=1, ENABLED=1, AUTO_START=restore, START_TIMEOUT=120, UPTIME_THRESHOLD=1h,

CHECK_INTERVAL=60, STOP_TIMEOUT=120, SCRIPT_TIMEOUT=120, RESTART_ATTEMPTS=3, OFFLINE_CHECK_INTERVAL=60, START_DEPENDENCIES=, STOP_DEPENDENCIES=,"

-bash-3.2$ crsctl start res crs_dbconsole

CRS-2672: Attempting to start 'crs_dbconsole' on 'myhost'

CRS-2676: Start of 'crs_dbconsole' on 'myhost' succeeded

Step6: Check the crs_dbconsole resource;

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  ONLINE       myhost

dbcagent

               OFFLINE OFFLINE      myhost

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost

ora.ons

               OFFLINE OFFLINE      myhost

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  ONLINE       myhost                    Open

ora.cssd

      1        OFFLINE OFFLINE

ora.diskmon

      1        OFFLINE OFFLINE

ora.evmd

      1        ONLINE  ONLINE       myhost

-bash-3.2$

Step7: To test the procedure, we are going to reboot the server.


As a root user:

init 6

login as: grid

-bash-3.2$

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS                                                                                              

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  OFFLINE      myhost                    STARTING                                                                                                   

dbcagent

               OFFLINE OFFLINE      myhost                                                                                                                               

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost                                                                                                                               

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost                                                                                                                               

ora.ons

               OFFLINE OFFLINE      myhost                                                                                                                               

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  OFFLINE                               STARTING                                                                                                   

ora.cssd

      1        OFFLINE OFFLINE                                                                                                                                          

ora.diskmon

      1        OFFLINE OFFLINE                                                                                                                                          

ora.evmd

      1        ONLINE  INTERMEDIATE myhost                                                                                                                               

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  ONLINE       myhost

dbcagent

               OFFLINE OFFLINE      myhost

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost

ora.ons

               OFFLINE OFFLINE      myhost

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  ONLINE       myhost                    Open

ora.cssd

      1        OFFLINE OFFLINE

ora.diskmon

      1        OFFLINE OFFLINE

ora.evmd

      1        ONLINE  ONLINE       myhost

-bash-3.2$

-bash-3.2$

-bash-3.2$ su - oracle

Password:

-bash-3.2$ emctl status dbconsole

Oracle Enterprise Manager 11g Database Control Release 11.2.0.2.0

Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.

https://myhost:1158/em/console/aboutApplication

Oracle Enterprise Manager 11g is running.

------------------------------------------------------------------

Logs are generated in directory /opt/app/oracle/product/11.2.0/db_1/myhost_orawiss/sysman/log

-bash-3.2$

Now, the DB Console restarts automatically when the database host computer restarts.
Hope it helps!

Télécharger le version en pdf, ici: DB console Au Restart FR
Introduction:

Oracle Restart est un composant ajouté à la version 11gR2 de Oracle pour assurer la haute disponibilité de certains ressources de Oracle. Les instances de bases de données, les listeners (processus d’écoutes) sont automatiquement redemandées après redémarrage du serveur de bases de données. Pour ajouter ces ressources à Oracle restart il suffit d’exécuter la commande srvctl add.

La procédure d’ajouter le DB Console comme ressource de Oracle Restart est un différente..
Dans cet article, nous allons vous montrer cette procédure.

Environnement de Teste: La procédure suivante a été testée sur une base 11.2.0.2.2, simple infrastructure sous Red hat Enterprise Linux.

La même procédure pourra être appliquée sur une environnement de RAC. Dans ce cas, il suffit d’applique la même démarche sur tous les nodes du cluster.

La procédure:

Etape1: Avec l’utilisateur grid, il faut créer deux scripts sous le répertoire $GRID_HOME/crs/script, dans mon cas: /opt/11.2.0/grid/crs/script/.

Voir le contenu des deux fichiers;


-bash-3.2$ cat agentstartup.sh

#!/bin/bash

#

# dbcagent.sh - script to start and stop the dbconsole 11gR2 agent

#

# description: Oracle 11gR2 database console agent

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

LIBRARY_PATH=$ORACLE_HOME/lib

ORACLE_SID=orawiss

ORACLE_UNQNAME=$ORACLE_SID

export ORACLE_BASE

export ORACLE_HOME

export LD_LIBRARY_PATH

export ORACLE_SID

export ORACLE_UNQNAME

touch /tmp/test20.log

agent_start () {

 touch /tmp/test22.log

 $ORACLE_HOME/bin/emctl start dbconsole

}

agent_stop () {

  $ORACLE_HOME/bin/emctl stop dbconsole

}

agent_check () {

  $ORACLE_HOME/bin/emctl status dbconsole

}

case "$1" in

  start)

         touch /tmp/test22.log

          agent_start

        ;;

  stop)

        agent_stop

        ;;

  check)

    agent_check

        ;;

  clean)

    agent_clean $(ps -C emagent -o pid=)

    ;;

  *)

        echo $"Usage: `basename $0` {start|stop|status|clean}"

        exit 1

esac

-bash-3.2$

-bash-3.2$ cat crs_dbconsole.sh

#!/bin/bash

#

# dbcagent.sh - script to start and stop the dbconsole 11gR2 agent

#

# description: Oracle 11gR2 database console agent

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

LIBRARY_PATH=$ORACLE_HOME/lib

ORACLE_SID=orawiss
ORACLE_UNQNAME=$ORACLE_SID

PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_BASE

export ORACLE_HOME

export LD_LIBRARY_PATH

export ORACLE_SID

export ORACLE_UNQNAME

export PATH

agent_start () {

sudo -u oracle  /opt/11.2.0/grid/crs/script/agentstartup.sh start

}

agent_stop () {

sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh stop

}

agent_check () {

  sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh check

}

case "$1" in

  start)

        agent_start

        ;;

  stop)

        agent_stop

        ;;

  check)

    agent_check

        ;;

  clean)

    agent_clean $(ps -C emagent -o pid=)

    ;;

  *)

        echo $"Usage: `basename $0` {start|stop|status|clean}"

        exit 1

esac

-bash-3.2$

Etape2: Donner les droits à ces deux scripts;


-bash-3.2$ su - grid

-bash-3.2$ cd  /opt/11.2.0/grid/crs/script/

-bash-3.2$ chmod 755 *

-bash-3.2$ ls -rtl

total 8

-rwxr-xr-x 1 grid oinstall 1017 Jul  8 14:38 crs_dbconsole.sh

-rwxr-xr-x 1 grid oinstall  892 Jul  8 15:10 agentstartup.sh

-bash-3.2$

Etape3:

Se connecter avec l’utilisateur root; éditer le fichier /etc/sudoers;

D’abord, changer les droits de ce fichier de 440 à 640.

Comme utilisateur root:

[root@myhost ~]# chmod 640 /etc/sudoers

A la fin du fichier, ajouter les trois lignes suivantes;


grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh start

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh stop

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh check

N’oubliez pas de commenter la ligne suivante ;

#Defaults requiretty

Maintenant, donner les droits 440 au fichier;

[root@myhost ~]# chmod 440 /etc/sudoers

Etape4:

Comme utilisateur Oracle;
changer les droits des fichiers suivants:


chmod 664 /opt/app/oracle/product/11.2.0/db_1/sysman/config/emd.properties

chmod 664 /opt/app/oracle/product/11.2.0/db_1/myhost_orawiss/sysman/config/emd.properties

chmod 755 /opt/app/oracle/product/11.2.0/db_1/bin/emctl

Etape5: Ajouter une nouvelle ressource nommée “crs_dbconsole” au Oracle Restart.


-bash-3.2$

-bash-3.2$ crsctl delete res crs_dbconsole

CRS-2613: Could not find resource 'crs_dbconsole'.

CRS-4000: Command Delete failed, or completed with errors.

-bash-3.2$ crsctl add resource crs_dbconsole -type local_resource -attr " ACTION_SCRIPT=/opt/11.2.0/grid/crs/script/crs_dbconsole.sh,

DESCRIPTION=Local DB Console Ressource for DB Console Agent, DEGREE=1, ENABLED=1, AUTO_START=restore, START_TIMEOUT=120, UPTIME_THRESHOLD=1h,

CHECK_INTERVAL=60, STOP_TIMEOUT=120, SCRIPT_TIMEOUT=120, RESTART_ATTEMPTS=3, OFFLINE_CHECK_INTERVAL=60, START_DEPENDENCIES=, STOP_DEPENDENCIES=,"

-bash-3.2$ crsctl start res crs_dbconsole

CRS-2672: Attempting to start 'crs_dbconsole' on 'myhost'

CRS-2676: Start of 'crs_dbconsole' on 'myhost' succeeded

Etape6: Vérifiez le statut de la nouvelle ressource;


-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  ONLINE       myhost

dbcagent

               OFFLINE OFFLINE      myhost

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost

ora.ons

               OFFLINE OFFLINE      myhost

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  ONLINE       myhost                    Open

ora.cssd

      1        OFFLINE OFFLINE

ora.diskmon

      1        OFFLINE OFFLINE

ora.evmd

      1        ONLINE  ONLINE       myhost

-bash-3.2$

Etape7: Pour tester la procédure, nous allons redémarrer le serveur de la base de données;


Comme Utilisateur root:

init 6

login as: grid

-bash-3.2$

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS                                                                                              

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  OFFLINE      myhost                    STARTING                                                                                                   

dbcagent

               OFFLINE OFFLINE      myhost                                                                                                                               

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost                                                                                                                               

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost                                                                                                                               

ora.ons

               OFFLINE OFFLINE      myhost                                                                                                                               

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  OFFLINE                               STARTING                                                                                                   

ora.cssd

      1        OFFLINE OFFLINE                                                                                                                                          

ora.diskmon

      1        OFFLINE OFFLINE                                                                                                                                          

ora.evmd

      1        ONLINE  INTERMEDIATE myhost                                                                                                                               

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  ONLINE       myhost

dbcagent

               OFFLINE OFFLINE      myhost

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost

ora.ons

               OFFLINE OFFLINE      myhost

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  ONLINE       myhost                    Open

ora.cssd

      1        OFFLINE OFFLINE

ora.diskmon

      1        OFFLINE OFFLINE

ora.evmd

      1        ONLINE  ONLINE       myhost

-bash-3.2$

-bash-3.2$

-bash-3.2$ su - oracle

Password:

-bash-3.2$ emctl status dbconsole

Oracle Enterprise Manager 11g Database Control Release 11.2.0.2.0

Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.

https://myhost:1158/em/console/aboutApplication

Oracle Enterprise Manager 11g is running.

------------------------------------------------------------------

Logs are generated in directory /opt/app/oracle/product/11.2.0/db_1/myhost_orawiss/sysman/log

-bash-3.2$

Enfin, la nouvelle ressource est redemandée avec le redémarrage du serveur de bases de données.

Merci,

Descargar le version en pdf, aqui: DB console Au Restart ES

Introducción:

Oracle Restart es un componente Oracle que fue añadido desde la versión 11gR2.
Este componente es responsable de la alta disponibilidad de algunos recursos de bases de datos como por ejemplo las instancias de bases de datos y los listeners, etc…
Esos recursos pueden ser añadidos usando la linea de comando; srvctl add.
El procedimiento de añadir el DB Console es diferente. En este articulo, vamos a ver como añadir el DB console a Oracle Restart.

Entorno de test: Es siguiente procedimiento fue testeado sobre una base de datos 11.2.0.2.2, en simple infraestructura de grid, bajo Red hat Enterprise Linux.

El mismo procedimiento puede ser aplicado a unas instancias de RAC, en aquel caso, recuerda de aplicarlo en todos los nodos del cluster.

El procedimiento:

Etapa1: Con el usuario grid, creamos 2 escripts bajo la carpeta de $GRID_HOME/crs/script, en mi caso: /opt/11.2.0/grid/crs/script/.

Este es el contenido de los 2 escripts;


-bash-3.2$ cat agentstartup.sh

#!/bin/bash

#

# dbcagent.sh - script to start and stop the dbconsole 11gR2 agent

#

# description: Oracle 11gR2 database console agent

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

LIBRARY_PATH=$ORACLE_HOME/lib

ORACLE_SID=orawiss

ORACLE_UNQNAME=$ORACLE_SID

export ORACLE_BASE

export ORACLE_HOME

export LD_LIBRARY_PATH

export ORACLE_SID

export ORACLE_UNQNAME

touch /tmp/test20.log

agent_start () {

 touch /tmp/test22.log

 $ORACLE_HOME/bin/emctl start dbconsole

}

agent_stop () {

  $ORACLE_HOME/bin/emctl stop dbconsole

}

agent_check () {

  $ORACLE_HOME/bin/emctl status dbconsole

}

case "$1" in

  start)

         touch /tmp/test22.log

          agent_start

        ;;

  stop)

        agent_stop

        ;;

  check)

    agent_check

        ;;

  clean)

    agent_clean $(ps -C emagent -o pid=)

    ;;

  *)

        echo $"Usage: `basename $0` {start|stop|status|clean}"

        exit 1

esac

-bash-3.2$

-bash-3.2$ cat crs_dbconsole.sh

#!/bin/bash

#

# dbcagent.sh - script to start and stop the dbconsole 11gR2 agent

#

# description: Oracle 11gR2 database console agent

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

LIBRARY_PATH=$ORACLE_HOME/lib

ORACLE_SID=orawiss
ORACLE_UNQNAME=$ORACLE_SID

PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_BASE

export ORACLE_HOME

export LD_LIBRARY_PATH

export ORACLE_SID

export ORACLE_UNQNAME

export PATH

agent_start () {

sudo -u oracle  /opt/11.2.0/grid/crs/script/agentstartup.sh start

}

agent_stop () {

sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh stop

}

agent_check () {

  sudo -u oracle /opt/11.2.0/grid/crs/script/agentstartup.sh check

}

case "$1" in

  start)

        agent_start

        ;;

  stop)

        agent_stop

        ;;

  check)

    agent_check

        ;;

  clean)

    agent_clean $(ps -C emagent -o pid=)

    ;;

  *)

        echo $"Usage: `basename $0` {start|stop|status|clean}"

        exit 1

esac

-bash-3.2$

Etapa2: Dar los privilegios a esos 2 escripts;


-bash-3.2$ su - grid

-bash-3.2$ cd  /opt/11.2.0/grid/crs/script/

-bash-3.2$ chmod 755 *

-bash-3.2$ ls -rtl

total 8

-rwxr-xr-x 1 grid oinstall 1017 Jul  8 14:38 crs_dbconsole.sh

-rwxr-xr-x 1 grid oinstall  892 Jul  8 15:10 agentstartup.sh

-bash-3.2$

Etapa3:

Como usuario root, edita el fichero /etc/sudoers;

Primero, cambiamos los privilegios de este fichero de 440 a 640.

Como usuario root:

[root@myhost ~]# chmod 640 /etc/sudoers

Al final del fichero, añadirnos las 3 siguientes lineas;


grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh start

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh stop

grid myhost =(oracle) NOPASSWD: /opt/11.2.0/grid/crs/script/agentstartup.sh check

No olvidamos de comentar la siguiente linea dentro del fichero etc/sudoers;

#Defaults requiretty

Ahora, volvemos a dar los permisos 440 al fichero etc/sudoers;

[root@myhost ~]# chmod 440 /etc/sudoers

Etapa4:

Como usuario oracle,
Cambiamos los permisos de los seguientes ficheros:


chmod 664 /opt/app/oracle/product/11.2.0/db_1/sysman/config/emd.properties

chmod 664 /opt/app/oracle/product/11.2.0/db_1/myhost_orawiss/sysman/config/emd.properties

chmod 755 /opt/app/oracle/product/11.2.0/db_1/bin/emctl

Etapa5: Añadir el recurso “crs_dbconsole” al Oracle Restart.


-bash-3.2$

-bash-3.2$ crsctl delete res crs_dbconsole

CRS-2613: Could not find resource 'crs_dbconsole'.

CRS-4000: Command Delete failed, or completed with errors.

-bash-3.2$ crsctl add resource crs_dbconsole -type local_resource -attr " ACTION_SCRIPT=/opt/11.2.0/grid/crs/script/crs_dbconsole.sh,

DESCRIPTION=Local DB Console Ressource for DB Console Agent, DEGREE=1, ENABLED=1, AUTO_START=restore, START_TIMEOUT=120, UPTIME_THRESHOLD=1h,

CHECK_INTERVAL=60, STOP_TIMEOUT=120, SCRIPT_TIMEOUT=120, RESTART_ATTEMPTS=3, OFFLINE_CHECK_INTERVAL=60, START_DEPENDENCIES=, STOP_DEPENDENCIES=,"

-bash-3.2$ crsctl start res crs_dbconsole

CRS-2672: Attempting to start 'crs_dbconsole' on 'myhost'

CRS-2676: Start of 'crs_dbconsole' on 'myhost' succeeded

Etapa6: Verificar el recurso crs_dbconsole;


-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  ONLINE       myhost

dbcagent

               OFFLINE OFFLINE      myhost

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost

ora.ons

               OFFLINE OFFLINE      myhost

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  ONLINE       myhost                    Open

ora.cssd

      1        OFFLINE OFFLINE

ora.diskmon

      1        OFFLINE OFFLINE

ora.evmd

      1        ONLINE  ONLINE       myhost

-bash-3.2$

Etapa7: Testar el nuevo recurso añadido, por eso, vamos a reiniciar el servidor.


Como usuario root:

init 6

login as: grid

-bash-3.2$

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS                                                                                              

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  OFFLINE      myhost                    STARTING                                                                                                   

dbcagent

               OFFLINE OFFLINE      myhost                                                                                                                               

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost                                                                                                                               

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost                                                                                                                               

ora.ons

               OFFLINE OFFLINE      myhost                                                                                                                               

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  OFFLINE                               STARTING                                                                                                   

ora.cssd

      1        OFFLINE OFFLINE                                                                                                                                          

ora.diskmon

      1        OFFLINE OFFLINE                                                                                                                                          

ora.evmd

      1        ONLINE  INTERMEDIATE myhost                                                                                                                               

-bash-3.2$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

crs_dbconsole

               ONLINE  ONLINE       myhost

dbcagent

               OFFLINE OFFLINE      myhost

ora.LISTENER.lsnr

               ONLINE  ONLINE       myhost

ora.LISTENER_OUT.lsnr

               ONLINE  ONLINE       myhost

ora.ons

               OFFLINE OFFLINE      myhost

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.orawiss.db

      1        ONLINE  ONLINE       myhost                    Open

ora.cssd

      1        OFFLINE OFFLINE

ora.diskmon

      1        OFFLINE OFFLINE

ora.evmd

      1        ONLINE  ONLINE       myhost

-bash-3.2$

-bash-3.2$

-bash-3.2$ su - oracle

Password:

-bash-3.2$ emctl status dbconsole

Oracle Enterprise Manager 11g Database Control Release 11.2.0.2.0

Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.

https://myhost:1158/em/console/aboutApplication

Oracle Enterprise Manager 11g is running.

------------------------------------------------------------------

Logs are generated in directory /opt/app/oracle/product/11.2.0/db_1/myhost_orawiss/sysman/log

-bash-3.2$

Ahora, tenemos el recurso DB Console arrancado automaticamente, gracias al Oracle restart.

Scridb filter


5 Comments to “11gR2; Automatic restart of DB Console”

  1. marcos cubric says:

    Very Good!

    You also should let Oracle Support know about this.
    I asked them some time ago if this was possible and they could not answer.

    Regards

  2. wissem says:

    Thanks Marcos :)

  3. john says:

    How about dependencies ?
    Dbconsole must start after the database and listener.
    Do you think we need to set dependency ?

  4. Brian says:

    Thank you for this solution. Absolutely AMAZES me how Metalink could not provide this information !!!

  5. SB says:

    great work !! hats off !


Leave a Comment





Subscribe


Polls

which oracle topic interests you most?

View Results

Loading ... Loading ...


Oracle Class Tweets


Recent Posts


Recent Comments

  • Jaspreet: Brilliant explanation.
  • Yousuf: Very Nice… Just wanted to check you have done all patching at Node 1 only.. is there any thing need to...
  • Yousuf: Very Nice.. Thanks for sharing.. Once question.. You have executed all commands on Node 1 only.. Is there any...
  • Emir: Thanks… Great article
  • borse firmate: Thank you for another informative blog. The place else may just I am getting that kind of information...
  • leandro: why this parameter is systemwide? could you read from a asm instance from one failure group and from the...
  • Mohammad: paul, we create pfile from target database to source database and later we change database name, and...
  • Muhammad Ikram: Thanks Brother for sharing pearls of knowledge. May ALLAH reward you for this both here and...
  • rgrover: Thanks for the POST. I recently encounter similar issue. Your POST helped.
  • gopalredy: really its very use full to dbas
  • Vivian: This is awesome! Thank you so much!
  • henry zhong: CDB=DB, and PDB=SCHEMA but in a sub dictionary?
  • Dehbashee: Salam Brother, Thanx for sharing, however, i would be interested in chaging the password for the grid user...
  • wissem: No we don’t need that :) Just the scripts I posted above
  • Md. Tanweer: Thanks for posting the material. I really appreciate if you can send me, if you have tutorial for 11g...
  • christiaan: Thanks!! This has been bugging the hell out of me for so long.
  • Rajasekhar: Thank you
  • Samarjit Panigrahy: Very Nice and Simple Demo… Cool :)
  • cq: Any reason not to use auto patch for both CRS and RAC homes with one command? Or use opatch auto for RAC home as...
  • Hitesh: Hi, Can we use this RACcheck tool on oracle SE version ? Thanks