Configuring Automatic Restart of an Oracle Database (Single instance)

Neste artigo vou simular o acréscimo de um banco Oracle no recurso do HAS (High Availability Service)/Oracle Restart. No exemplo abaixo, vemos que não temos banco configurado:

[grid@oel7 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DG_DATA.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.DG_FRA.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.DG_GRID.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.DG_RECO.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       oel7                     STABLE
ora.asm
               ONLINE  ONLINE       oel7                     Started,STABLE
ora.ons
               OFFLINE OFFLINE      oel7                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       oel7                     STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       oel7                     STABLE
--------------------------------------------------------------------------------
[grid@oel7 ~]$

Com o usuário que pertence à instância do database, basta usar o utilitário srvctl conforme exemplo abaixo, populando com os dados necessários em cada parâmetro:

[oracle@oel7 ~]$ srvctl add database -db cortex -oraclehome /oracle/19.3.0/product -domain localdomain -spfile +DG_DATA/CORTEX/PARAMETERFILE/spfile.265.1039034301 -role PRIMARY -startoption OPEN -dbname cortex -policy AUTOMATIC -diskgroup "DG_DATA,DG_FRA,DG_RECO"
[oracle@oel7 ~]$

Realizando o start do banco de dados e checando o seu status:

[oracle@oel7 ~]$ srvctl start database -db cortex
[oracle@oel7 ~]$ srvctl status database -db cortex
Database is running.
[oracle@oel7 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jan 5 22:52:45 2021
Version 19.3.0.0.0
 
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
 
SQL> select instance_name,status from v$instance;
 
INSTANCE_NAME    STATUS
---------------- ------------
cortex           OPEN
 
SQL>

Ao consultar novamente os serviços do Oracle Restart, agora conseguimos ver que o database está sendo listado:

[oracle@oel7 ~]$ su - grid
Password:
Last login: Tue Jan  5 22:37:05 -03 2021 on pts/0
[grid@oel7 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DG_DATA.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.DG_FRA.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.DG_GRID.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.DG_RECO.dg
               ONLINE  ONLINE       oel7                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       oel7                     STABLE
ora.asm
               ONLINE  ONLINE       oel7                     Started,STABLE
ora.ons
               OFFLINE OFFLINE      oel7                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cortex.db
      1        ONLINE  ONLINE       oel7                     Open,HOME=/oracle/19
                                                             .3.0/product,STABLE
ora.cssd
      1        ONLINE  ONLINE       oel7                     STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       oel7                     STABLE
--------------------------------------------------------------------------------
[grid@oel7 ~]$

Leave a Comment

Your email address will not be published.