Oracle Data Guard es un producto que nos asegura la alta disponibilidad, protección de datos, y un sitio alterno o disaster recovery (Standby Database) en caso de algún fallo  de carácter físico o lógico de nuestra base de datos principal. Oracle Data Guard nos ayuda a mantener estas bases de datos standby como copias de nuestra base de datos de producción, lo cual nos permite que durante mantenimientos que tienen un tiempo muy prolongado disponibilizar el servicio de nuestra base de datos, minimizando el tiempo de pérdida del servicio de nuestra base de datos comparado con el tiempo del mantenimiento programado.

 

La implementación del sitio de contingencia fue desarrollado en un ambiente que cuenta con las siguientes características:

SITIO PRIMARIO

  • Sistema Operativo CentOS 7.5 64 bits
  • Base de Datos Oracle 12c Release 2 configurada en Stand Alone
  • Modo Archive activo (es necesario y obligatorio para la implementación del sitio alterno o standby)
  • Conexión entre servidores sin restricciones, no hay firewall en medio de ambos.
  • Almacenamiento en filesystem
  • Listener configurado por defecto (puerto 1521)

 

SITIO STANDBY

  • Sistema Operativo CentOS 7.5 64 bits
  • Software Base de Datos Oracle 12c Release 2
  • Almacenamiento en filesystem
  • Listener configurado por defecto (puerto 1521)

Antes de iniciar con la implementación de nuestro Dataguard Físico debemos asegurarnos que existe conectividad y resolución de hostname por medio de ssh entre los servidores que intervendrán en esta configuración:

a) Edición de archivo /etc/hosts

Es muy importante que la resolución de los hostnames de los servidores que intervendrán en esta configuración se lo realice localmente por medio del archivo /etc/hosts o  por medio de un DNS.

Archivo /etc/hosts en servidor PRIMARIO y STANDBY
[root@primaria ~]# cat /etc/hosts
127.0.0.1 localhost localhost
###################
## BASE DE DATOS ##
## PRIMARIA ##
###################
192.168.56.22 primaria primaria
###################
## BASE DE DATOS ##
## STANDBY ##
###################
192.168.56.23 standby standby
[root@standby ~]# cat /etc/hosts
127.0.0.1 localhost localhost
###################
## BASE DE DATOS ##
## PRIMARIA ##
###################
192.168.56.22 primaria primaria
###################
## BASE DE DATOS ##
## STANDBY ##
###################
192.168.56.23 standby standby
view raw hosts.txt hosted with ❤ by GitHub
b) Ping entre servidores 
PING ENTRE SERVIDOR PRIMARIO Y STANDBY
[root@primaria ~]# ping standby
PING standby (192.168.56.23) 56(84) bytes of data.
64 bytes from standby (192.168.56.23): icmp_seq=1 ttl=64 time=0.465 ms
64 bytes from standby (192.168.56.23): icmp_seq=2 ttl=64 time=0.506 ms
64 bytes from standby (192.168.56.23): icmp_seq=3 ttl=64 time=0.528 ms
--- standby ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.465/0.499/0.528/0.036 ms
[root@standby ~]# ping primaria
PING primaria (192.168.56.22) 56(84) bytes of data.
64 bytes from primaria (192.168.56.22): icmp_seq=1 ttl=64 time=0.331 ms
64 bytes from primaria (192.168.56.22): icmp_seq=2 ttl=64 time=1.14 ms
64 bytes from primaria (192.168.56.22): icmp_seq=3 ttl=64 time=0.511 ms
--- primaria ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.331/0.661/1.143/0.349 ms
view raw ping.txt hosted with ❤ by GitHub
c) Conectividad SSH
CONECTIVIDAD SSH ENTRE PRIMARIO Y STANDBY
[oracle@primaria admin]$ ssh oracle@standby
oracle@standby's password:
Last login: Wed Apr 3 15:18:00 2019 from primaria
[oracle@standby ~]$
[oracle@standby ~]$ ssh oracle@primaria
oracle@primaria's password:
Last login: Wed Apr 3 14:58:54 2019 from 192.168.56.23
view raw ssh.txt hosted with ❤ by GitHub

Luego de haber comprobado que la resolución de hostnames en los servidores primario y standby son correctos y que la conectividad ssh se realiza correctamente, podemos continuar con las configuraciones necesarias para crear nuestro STANDBY FISICO

1)  Base de Datos en Modo Archive

Es indispensable que nuestro sitio PRIMARIO tenga  habilitado el  MODO ARCHIVE  para que la implementación de nuestro sitio alterno o standby sea correcto debido a que Oracle Data Guard utilizará los archivelogs para aplicarlos en nuestro STANDBY, y de esta manera tener una copia exacta de nuestra base de datos PRIMARIA

VALIDACIÓN MODO ARCHIVE
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Next log sequence to archive 4
Current log sequence 4

2) Habilitamos FORCE LOGGING

Para garantizar la consitencia de la base de datos STANDBY debemos habilitar FORCE LOGGING a nivel de la base de datos PRIMARIA. Este característica, que viene deshabilitada por defecto, nos ayuda a que todos los cambios que se realizan dentro de la base de datos PRIMARIA sean registrado dentro de los REDO LOGS, incluso se registrará las transacciones u operaciones que tienen NOLOGGING.

SQL> select DBID,NAME,FORCE_LOGGING from v$database;
DBID NAME FORCE_LOGGING
---------- --------- ---------------------------------------
16603101 PRIMARIA NO
SQL> alter database force logging;
Database altered.
SQL> select DBID,NAME,FORCE_LOGGING from v$database;
DBID NAME FORCE_LOGGING
---------- --------- ---------------------------------------
16603101 PRIMARIA YES
view raw gistfile1.txt hosted with ❤ by GitHub

3) Agregamos Standby Redo Logs en base de datos PRIMARIA

A pesar que los Standby Redo logs son exclusivos para los sitios alternos o standby, en caso de realizar un cambio de roles entre la base de datos Standby y Primaria, se los va a tener que crear almomento de realizar esta transición de roles.

SQL> alter database add standby logfile ('/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/standby_log_1a','/u01/app/oracle/oradata/PRIMARIA/onlinelog/standby_log_1b' ) size 200M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/standby_log_2a',''/u01/app/oracle/oradata/PRIMARIA/onlinelog/standby_log_2b) size 200M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/standby_log_3a','/u01/app/oracle/oradata/PRIMARIA/onlinelog/standby_log_3b') size 200M;
Database altered.
view raw stdby_redo.txt hosted with ❤ by GitHub

4) Mapeo en tnsnames.ora

tnsnames.ora EN PRIMARIA y STANDBY
PRIMARIA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primaria)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primaria)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
view raw dg_tnsnames.txt hosted with ❤ by GitHub
5) Cambio de parámetros inicialización en base de datos PRIMARIA

Para el correcto funcionamiento de Oracle Dataguard es necesario modifcar los siguientes parámetros de inicialización en nuestra base de datos PRIMARIA.

SQL> alter system set FAL_SERVER=standby;
System altered.
SQL> alter system set FAL_CLIENT=primaria;
System altered.
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(primaria,standby)';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primaria';
System altered.
SQL> alter system set log_archive_dest_2='service="standby"','SYNC AFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="standby" net_timeout=30','valid_for=(online_logfile,all_roles)';
System altered.
SQL> alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile;
System altered.
SQL> alter system set STANDBY_FILE_MANAGEMENT=AUTO;
System altered.
SQL> alter system set DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/STANDBY/standby/','/u01/app/oracle/oradata/PRIMARIA/' scope=spfile;
System altered.
SQL> alter system set LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/STANDBY/onlinelog/','/u01/app/oracle/oradata/PRIMARIA/onlinelog/','/u01/app/oracle/fast_recovery_area/standby/STANDBY/onlinelog/','/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/' scope=spfile;
System altered.
SQL> alter system set dg_broker_start=TRUE;
System altered.

6) Reinicio de base de datos PRIMARIA

Para que tomen efecto los parámetros que no son dinámicos en la base de datos es necesario realizar un reinicio de la misma.

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1157627904 bytes
Fixed Size 8619936 bytes
Variable Size 754976864 bytes
Database Buffers 385875968 bytes
Redo Buffers 8155136 bytes
Database mounted.
Database opened.

7) Creación de PFILE para STANDBY

SQL> create pfile='/tmp/init_prim.ora' from spfile;
File created.
view raw pfile.txt hosted with ❤ by GitHub

8) Respaldo RMAN completo de la base de datos PRIMARIA

RMAN> backup database plus archivelog;
Starting backup at 04-APR-19
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=1 STAMP=1001196052
input archived log thread=1 sequence=2 RECID=2 STAMP=1001206280
input archived log thread=1 sequence=3 RECID=3 STAMP=1004625102
input archived log thread=1 sequence=4 RECID=4 STAMP=1004663216
input archived log thread=1 sequence=5 RECID=5 STAMP=1004699181
input archived log thread=1 sequence=6 RECID=6 STAMP=1004700377
input archived log thread=1 sequence=7 RECID=7 STAMP=1004702134
channel ORA_DISK_1: starting piece 1 at 04-APR-19
channel ORA_DISK_1: finished piece 1 at 04-APR-19
piece handle=/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/backupset/2019_04_04/o1_mf_annnn_TAG20190404T115535_gbdfr7vg_.bkp tag=TAG20190404T115535 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 04-APR-19
Starting backup at 04-APR-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_system_g78xrjkj_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_sysaux_g78xsmr6_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_undotbs1_g78xtdyv_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_users_g78xtg2r_.dbf
channel ORA_DISK_1: starting piece 1 at 04-APR-19
channel ORA_DISK_1: finished piece 1 at 04-APR-19
piece handle=/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/backupset/2019_04_04/o1_mf_nnndf_TAG20190404T115543_gbdfrhhx_.bkp tag=TAG20190404T115543 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 04-APR-19
Starting backup at 04-APR-19
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=8 STAMP=1004702158
channel ORA_DISK_1: starting piece 1 at 04-APR-19
channel ORA_DISK_1: finished piece 1 at 04-APR-19
piece handle=/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/backupset/2019_04_04/o1_mf_annnn_TAG20190404T115558_gbdfryqj_.bkp tag=TAG20190404T115558 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 04-APR-19
Starting Control File and SPFILE Autobackup at 04-APR-19
piece handle=/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/autobackup/2019_04_04/o1_mf_s_1004702159_gbdfrzyk_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 04-APR-19
view raw bkp_full.txt hosted with ❤ by GitHub

9) Creación de standby controlfile

STANDBY CONTROLFILE
SQL> alter database create standby controlfile as '/tmp/standby_control.ctl';
Database altered.
view raw stanby_ctl.txt hosted with ❤ by GitHub

10) Envío de respaldo RMAN, standby controlfile, pfile y password file hacia servidor de contingencia

[oracle@primaria ~]$ scp /tmp/init_prim.ora oracle@standby:/tmp/init_prim.ora
oracle@standby's password:
init_prim.ora 100% 1992 1.2MB/s 00:00
[oracle@primaria ~]$ scp /tmp/standby_control.ctl oracle@standby:/tmp/standby_control.ctl
oracle@standby's password:
standby_control.ctl 100% 10MB 38.9MB/s 00:00
[oracle@primaria dbs]$ scp $ORACLE_HOME/dbs/orapwprimaria oracle@standby:$ORACLE_HOME/dbs/orapwstandby
oracle@standby's password:
orapwprimaria 100% 3584 2.8MB/s 00:00
[oracle@primaria ~]$ scp /u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/backupset/2019_04_04/* oracle@standby:/u01/stage/backup_PRIMARIA/
oracle@standby's password:
o1_mf_annnn_TAG20190404T115535_gbdfr7vg_.bkp 100% 668MB 50.3MB/s 00:13
o1_mf_annnn_TAG20190404T115558_gbdfryqj_.bkp 100% 13KB 7.5MB/s 00:00
o1_mf_nnndf_TAG20190404T115543_gbdfrhhx_.bkp 100% 1087MB 50.4MB/s 00:21
view raw gistfile1.txt hosted with ❤ by GitHub

11) Creación de directorios faltantes para base de datos STANDBY

[oracle@standby tmp]$ mkdir -p /u01/app/oracle/fast_recovery_area/standby
[oracle@standby tmp]$ mkdir -p /u01/app/oracle/admin/standby/adump
[oracle@standby tmp]$ mkdir -p /u01/app/oracle/oradata/STANDBY/controlfile/
[oracle@standby tmp]$ mkdir -p /u01/app/oracle/oradata/STANDBY/
[oracle@standby tmp]$ mkdir -p /u01/app/oracle/fast_recovery_area/primaria/STANDBY/controlfile/
[oracle@standby tmp]$ mkdir -p /u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog
view raw directorios.txt hosted with ❤ by GitHub

12) Copia de Standby Controlfile

[oracle@standby tmp]$ cp /tmp/standby_control.ctl /u01/app/oracle/oradata/STANDBY/controlfile/control_01.ctl
[oracle@standby tmp]$ cp /tmp/standby_control.ctl /u01/app/oracle/fast_recovery_area/primaria/STANDBY/controlfile/control_02.ctl
view raw copia_ctl.txt hosted with ❤ by GitHub

13) Edición de PFILE en servidor STANDBY

Editamos el archivo PFILE que fue enviado desde nuestro sitio PRIMARIO con los valores de acuerdo a nuestro sitio de contingencia

*.db_unique_name='standby'
*.audit_file_dest='/u01/app/oracle/admin/standby/adump'
*.control_files= '/u01/app/oracle/oradata/STANDBY/controlfile/control_01.ctl','/u01/app/oracle/fast_recovery_area/primaria/STANDBY/controlfile/control_02.ctl'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/standby'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=standbyXDB)'
*.fal_client='STANDBY'
*.fal_server='PRIMARIA'
*.local_listener='(address_list=(ADDRESS=(PROTOCOL=tcp)(HOST=standby)(PORT=1521)))'
*.log_archive_dest_2='SERVICE=primaria ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primaria'
view raw stdby_param.txt hosted with ❤ by GitHub

14) Creación de SPFILE desde PFILE editado

Creamos un SPFILE a partir del PFILE anteriormente editado, para montar la base de datos

SQL> create spfile from pfile='/tmp/init_prim.ora';
File created.

15) Montamos la base de datos STANDBY

SQL> startup mount
ORACLE instance started.
Total System Global Area 1157627904 bytes
Fixed Size 8619936 bytes
Variable Size 754976864 bytes
Database Buffers 385875968 bytes
Redo Buffers 8155136 bytes
Database mounted.
view raw montar_bdd.txt hosted with ❤ by GitHub

16) Catalogamos respaldos RMAN 

Debido a que los repaldos RMAN enviados desde el servidor PRIMARIO se encuentran en un directorio distinto al origen debemos catalogarlos nuevamente.

[oracle@standby backup_PRIMARIA]$ rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Thu Apr 4 16:03:01 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRIMARIA (DBID=16603101, not open)
RMAN> catalog start with '/u01/stage/backup_PRIMARIA/';
using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/stage/backup_PRIMARIA/
List of Files Unknown to the Database
=====================================
File Name: /u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115535_gbdfr7vg_.bkp
File Name: /u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115558_gbdfryqj_.bkp
File Name: /u01/stage/backup_PRIMARIA/o1_mf_nnndf_TAG20190404T115543_gbdfrhhx_.bkp
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115535_gbdfr7vg_.bkp
File Name: /u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115558_gbdfryqj_.bkp
File Name: /u01/stage/backup_PRIMARIA/o1_mf_nnndf_TAG20190404T115543_gbdfrhhx_.bkp

17) Restaruramos Base de Datos STANDBY a partir de respaldo RMAN enviado de sitio PRIMARIO

RMAN> restore database;
Starting restore at 04-APR-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_system_g78xrjkj_.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_sysaux_g78xsmr6_.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_undotbs1_g78xtdyv_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/PRIMARIA/datafile/o1_mf_users_g78xtg2r_.dbf
channel ORA_DISK_1: reading from backup piece /u01/stage/backup_PRIMARIA/o1_mf_nnndf_TAG20190404T115543_gbdfrhhx_.bkp
channel ORA_DISK_1: piece handle=/u01/stage/backup_PRIMARIA/o1_mf_nnndf_TAG20190404T115543_gbdfrhhx_.bkp tag=TAG20190404T115543
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 04-APR-19

18) Renombramos Redo logs

Una vez completa la restauración de la base de datos STANDBY, debemos renombrar los redologs.

SQL> select member, type from v$logfile;
MEMBER TYPE
------------------------------------------------------------------------------------------------------------------------------------------------------ -------
/u01/app/oracle/oradata/PRIMARIA/onlinelog/o1_mf_3_g78xvjwb_.log ONLINE
/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/o1_mf_3_g78xvk9l_.log ONLINE
/u01/app/oracle/oradata/PRIMARIA/onlinelog/o1_mf_2_g78xvhht_.log ONLINE
/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/o1_mf_2_g78xvj52_.log ONLINE
/u01/app/oracle/oradata/PRIMARIA/onlinelog/o1_mf_1_g78xvhgp_.log ONLINE
/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/o1_mf_1_g78xvj2d_.log ONLINE
/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/standby_log_1 STANDBY
/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/standby_log_2 STANDBY
/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/standby_log_3 STANDBY
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;
System altered.
SQL> ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/PRIMARIA/onlinelog/o1_mf_3_g78xvjwb_.log' TO '/u01/app/oracle/oradata/STANDBY/onlinelog/o1_mf_3_g78xvjwb_.log';
Database altered.
SQL> ALTER DATABASE RENAME FILE '/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/o1_mf_3_g78xvk9l_.log' TO '/u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog/o1_mf_3_g78xvk9l_.log';
Database altered.
SQL> ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/PRIMARIA/onlinelog/o1_mf_2_g78xvhht_.log' TO '/u01/app/oracle/oradata/STANDBY/onlinelog/o1_mf_2_g78xvhht_.log';
Database altered.
SQL> ALTER DATABASE RENAME FILE '/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/o1_mf_2_g78xvj52_.log' TO '/u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog/o1_mf_2_g78xvj52_.log';
Database altered.
SQL> ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/PRIMARIA/onlinelog/o1_mf_1_g78xvhgp_.log' TO '/u01/app/oracle/oradata/STANDBY/onlinelog/o1_mf_1_g78xvhgp_.log';
Database altered.
SQL> ALTER DATABASE RENAME FILE '/u01/app/oracle/fast_recovery_area/primaria/PRIMARIA/onlinelog/o1_mf_1_g78xvj2d_.log' TO '/u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog/o1_mf_1_g78xvj2d_.log';
Database altered.
view raw rename_redo.txt hosted with ❤ by GitHub

19) Recover de base de datos STANDBY

RMAN> run
{
recover database;
}
Starting recover at 04-APR-19
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_DISK_1: reading from backup piece /u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115535_gbdfr7vg_.bkp
channel ORA_DISK_1: piece handle=/u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115535_gbdfr7vg_.bkp tag=TAG20190404T115535
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch1_7_1001182623.dbf thread=1 sequence=0
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=8
channel ORA_DISK_1: reading from backup piece /u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115558_gbdfryqj_.bkp
channel ORA_DISK_1: piece handle=/u01/stage/backup_PRIMARIA/o1_mf_annnn_TAG20190404T115558_gbdfryqj_.bkp tag=TAG20190404T115558
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/arch1_8_1001182623.dbf thread=1 sequence=8
media recovery complete, elapsed time: 00:00:00
Finished recover at 04-APR-19

20) Recreamos standby redo logs

SQL> select group#, member from v$logfile;
GROUP# MEMBER
---------- ------------------------------------------------------------------------------------------------------------------------
1 /u01/app/oracle/oradata/STANDBY/onlinelog/o1_mf_1_g78xvhgp_.log
1 /u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog/o1_mf_1_g78xvj2d_.log
2 /u01/app/oracle/oradata/STANDBY/onlinelog/o1_mf_2_g78xvhht_.log
2 /u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog/o1_mf_2_g78xvj52_.log
3 /u01/app/oracle/fast_recovery_area/primaria/STANDBY/onlinelog/o1_mf_3_g78xvk9l_.log
3 /u01/app/oracle/oradata/STANDBY/onlinelog/o1_mf_3_g78xvjwb_.log
4 /u01/app/oracle/fast_recovery_area/primaria/STANDBY/standby_log_1
5 /u01/app/oracle/fast_recovery_area/primaria/STANDBY/standby_log_2
6 /u01/app/oracle/fast_recovery_area/primaria/STANDBY/standby_log_3
SQL> alter database DROP logfile group 4;
Database altered
SQL> alter database DROP logfile group 5;
Database altered
SQL> alter database DROP logfile group 6;
Database altered
SQL> alter database add standby logfile ('/u01/app/oracle/fast_recovery_area/primaria/STANDBY/standby_log_1a','/u01/app/oracle/oradata/STANDBY/onlinelog/standby_log_1b') size 200M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/fast_recovery_area/primaria/STANDBY/standby_log_2a','/u01/app/oracle/oradata/STANDBY/onlinelog/standby_log_2b') size 200M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/fast_recovery_area/primaria/STANDBY/standby_log_3a','/u01/app/oracle/oradata/STANDBY/onlinelog/standby_log_3b') size 200M;
Database altered.
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
System altered.

21) Iniciamos proceso APPLY en base de datos  STANDBY

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.