Sincronizar dos bases de datos Oracle con los redo logs

Categorías:

No se si estoy mal enfocao o que jodas, el caso es que según los que me entregaron estas bases de datos me indican lo siguiente, tengo una base de datos de producción y una en standby, o sea en espera que la de produccion se joda…

Para ello, debo tener ambas bases de datos sincronizaditas haciendo uso de los Redo Logs. Mas adelante investigaré como es que es la vuelta completa.

Por ahora, limitemonos a realizar la sincronización de los Redo Logs.

Empezamos por …..

 

1) Stop the managed recovery process (MRP) on the STANDBY database (StandBy es apolo)

ICEPRDSTB][DB12C]oradb@apolo:oradb $ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Feb 3 15:49:25 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

SQL>  ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

SQL> 

Ahora toca seguir leyendo el manual, seguimos en el mismo servidor Apolo, que es el que aloja la base de datos Standby

2) Determine the SCN of the STANDBY database.

SQL> SELECT CURRENT_SCN FROM V$DATABASE;

CURRENT_SCN
-----------
 3709164956

SQL> select min(f.fhscn) from x$kcvfh f, v$datafile d where f.hxfil =d.file# and d.enabled != 'READ ONLY'; 

MIN(F.FHSCN)
----------------
3709164957

SQL> 

Ahora nos vamos al servidor que tiene la base de datos principal, en este caso Piscis.

3) Take an incremental backup of the PRIMARY database (Primary es Piscis).

En este caso, ejecutamos lo siguiente….

[ICEPRD][DB12C]oracle@piscis:oracle $ rman target /                                                              

Recovery Manager: Release 12.1.0.1.0 - Production on Wed Feb 3 15:54:39 2016

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ICE_PRD (DBID=3835273413)

RMAN> BACKUP INCREMENTAL FROM SCN 3709164957 DATABASE FORMAT '/orafra/backup_set/BCKSTB/ForStandby_{29abae026baad3be178e8b4d9df8b452ab37360abfdefacab414000aba9cdfd4}U' tag 'FORSTANDBY';

Starting backup at 03-FEB-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=160 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=+DGDATA/ICE_PRD/DATAFILE/ice_tbs.326.885031479
input datafile file number=00005 name=+DGDATA/ICE_PRD/DATAFILE/ice_tbs.325.885031479
input datafile file number=00002 name=+DGDATA/ICE_PRD/DATAFILE/sysaux.328.885031481
input datafile file number=00007 name=+DGDATA/ICE_PRD/DATAFILE/idx_ice_tbs.327.885031479
input datafile file number=00003 name=+DGDATA/ICE_PRD/DATAFILE/undotbs1.330.885031481
input datafile file number=00001 name=+DGDATA/ICE_PRD/DATAFILE/system.329.885031481
input datafile file number=00004 name=+DGDATA/ICE_PRD/DATAFILE/users.331.885031481
channel ORA_DISK_1: starting piece 1 at 03-FEB-16
channel ORA_DISK_1: finished piece 1 at 03-FEB-16
piece handle=/orafra/backup_set/BCKSTB/ForStandby_0kqt0qbe_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:08:55
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 03-FEB-16
channel ORA_DISK_1: finished piece 1 at 03-FEB-16
piece handle=/orafra/backup_set/BCKSTB/ForStandby_0lqt0qs6_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 03-FEB-16

RMAN> 

Ahora es momento de pasar al 4 punto.

4) Transfer all backup sets to STANDBY server

Antes tenemos que comprimir esta información resultante, esto lo hacemos de la siguiente forma, primero, miramos los archivos que generó el proceso anterior

[ICEPRD][DB12C]oracle@piscis:BCKSTB $ ls -ltr 
total 5051348
drwxr-xr-x 2 oracle oinstall       4096 feb  1 10:13 Feb01_2016
-rw-r--r-- 1 oracle oinstall  910283171 feb  1 10:18 Feb01_2016.tgz
-rw-r----- 1 oracle asmadmin   10977280 feb  1 10:34 ForStandby_09qsquou_1_1
-rw-r----- 1 oracle asmadmin 4240326656 feb  3 16:04 ForStandby_0kqt0qbe_1_1
-rw-r----- 1 oracle asmadmin   10977280 feb  3 16:04 ForStandby_0lqt0qs6_1_1
[ICEPRD][DB12C]oracle@piscis:BCKSTB $ tar zcvf Backup.tgz ForStandby_0kqt0qbe_1_1 ForStandby_0lqt0qs6_1_1 
ForStandby_0kqt0qbe_1_1
ForStandby_0lqt0qs6_1_1
[ICEPRD][DB12C]oracle@piscis:BCKSTB $ ls -ltr Backup.tgz             
-rw-r--r-- 1 oracle oinstall 1071873642 feb  3 16:17 Backup.tgz

Lo que hicimos con el proceso anterior fue comprimir en un solo archivo, el par de archivos resaltados, estos son los generados por el proceso con RMAN

Una vez comprimidos, debemos pasarlos al servidor que aloja la base de datos secundaria o STANDBY

[ICEPRD][DB12C]oracle@piscis:BCKSTB $ scp Backup.tgz oradb@apolo:/orafra/backup_set/BCKSTB
oradb@apolo's password: 
Backup.tgz                                         100{29abae026baad3be178e8b4d9df8b452ab37360abfdefacab414000aba9cdfd4} 1022MB 163.3KB/s 1:46:52

Aquí nos demoramos eternidades, pero la idea es que el paso de estos archivos demore mucho menos.

Luego de transferidos el comprimido, descomprimimos el archivo en el servidor destino, en este caso apolo

[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ ls -ltr 
total 1047780
-rw-r--r-- 1 oradb oinstall 1071873642 Feb  3 18:07 Backup.tgz
[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ /bin/gunzip Backup.tgz 
[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ tar xvf Backup.tar 
ForStandby_0kqt0qbe_1_1
ForStandby_0lqt0qs6_1_1
[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ ls -ltr 
total 8311460
-rw-r----- 1 oradb oinstall 4240326656 Feb  3 16:04 ForStandby_0kqt0qbe_1_1
-rw-r----- 1 oradb oinstall   10977280 Feb  3 16:04 ForStandby_0lqt0qs6_1_1
-rw-r--r-- 1 oradb oinstall 4251310080 Feb  3 18:07 Backup.tar
[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ rm -rf Backup.tar

Como se puede apreciar, se ejecutó el comando gunzip al archivo, y luego tar xvf para extraer el contenido, arrojandonos dos archivos necesarios para sincronizar nuestras bases de datos.

Ahora, procedemos al 5to punto

5) Catalog the backups in STANDBY controlfile

Para este punto, ejecutamos el comando rman target /

[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ rman target / 

Recovery Manager: Release 12.1.0.1.0 - Production on Wed Feb 3 18:22:37 2016

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ICE_PRD (DBID=3835273413, not open)

RMAN> CATALOG START WITH '/orafra/backup_set/BCKSTB/';

using target database control file instead of recovery catalog
searching for all files that match the pattern /orafra/backup_set/BCKSTB/

List of Files Unknown to the Database
=====================================
File Name: /orafra/backup_set/BCKSTB/ForStandby_0kqt0qbe_1_1
File Name: /orafra/backup_set/BCKSTB/ForStandby_0lqt0qs6_1_1

Do you really want to catalog the above files (enter YES or NO)? yes

Debemos indicar la ruta donde tenemos los archivos que extraimos del archivo comprimido, una vez el sistema los encuentra, nos pregunta si queremos catalogar los archivos encontrados, respondemos con un yes

Y el proceso continúa..

cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /orafra/backup_set/BCKSTB/ForStandby_0kqt0qbe_1_1
File Name: /orafra/backup_set/BCKSTB/ForStandby_0lqt0qs6_1_1

RMAN> 

Ya estamos listo para el siguiente paso….

6) Recover the STANDBY database with the cataloged incremental backup:

Actualizar la base de datos con el backup incremental

RMAN> RECOVER DATABASE NOREDO;                                              

Starting recover at 03-FEB-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1041 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: +DG_DATA/ICEPRDSTB/DATAFILE/system.362.886346055
destination for restore of datafile 00002: +DG_DATA/ICEPRDSTB/DATAFILE/sysaux.361.886346055
destination for restore of datafile 00003: +DG_DATA/ICEPRDSTB/DATAFILE/undotbs1.360.886346055
destination for restore of datafile 00004: +DG_DATA/ICEPRDSTB/DATAFILE/users.363.886345895
destination for restore of datafile 00005: +DG_DATA/ICEPRDSTB/DATAFILE/ice_tbs.359.886346055
destination for restore of datafile 00006: +DG_DATA/ICEPRDSTB/DATAFILE/ice_tbs.358.886346055
destination for restore of datafile 00007: +DG_DATA/ICEPRDSTB/DATAFILE/idx_ice_tbs.357.886346055
channel ORA_DISK_1: reading from backup piece /orafra/backup_set/BCKSTB/ForStandby_0kqt0qbe_1_1
channel ORA_DISK_1: piece handle=/orafra/backup_set/BCKSTB/ForStandby_0kqt0qbe_1_1 tag=FORSTANDBY
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45

Finished recover at 03-FEB-16

Ahora estamos listos para el paso 7

7) In RMAN, connect to the PRIMARY database and create a standby control file backup:

Lo que hacemos es que en producción ejecutamos el siguiente comando con rman target /

[ICEPRD][DB12C]oracle@piscis:BCKSTB $ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Wed Feb 3 18:28:25 2016

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ICE_PRD (DBID=3835273413)

RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/orafra/backup_set/BCKSTB/ForStandby_{29abae026baad3be178e8b4d9df8b452ab37360abfdefacab414000aba9cdfd4}U' tag 'FORSTANDBY';

Starting backup at 03-FEB-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=367 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 03-FEB-16
channel ORA_DISK_1: finished piece 1 at 03-FEB-16
piece handle=/orafra/backup_set/BCKSTB/ForStandby_0mqt13au_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 03-FEB-16

RMAN> 

Se crea un archivo de control que se pasa al servidor con la base de datos STANDBY

8) Copy the standby control file backup to the STANDBY system.

[ICEPRD][DB12C]oracle@piscis:BCKSTB $ scp ForStandby_0mqt13au_1_1 oradb@apolo:/orafra/backup_set/BCKSTB
oradb@apolo's password: 
ForStandby_0mqt13au_1_1                  100{29abae026baad3be178e8b4d9df8b452ab37360abfdefacab414000aba9cdfd4}   10MB   2.6MB/s   00:04    
[ICEPRD][DB12C]oracle@piscis:BCKSTB $ 

Nos vamos al servidor Apolo, en donde cargamos el archivo que transferimos

9) Capture datafile information in STANDBY database.

[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Feb 3 18:35:36 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

SQL> spool datafile_names_step8.txt
SQL> set lines 200
SQL> col name format a60
SQL> select file#, name from v$datafile order by file# ;

     FILE# NAME
---------- ------------------------------------------------------------
   1 +DG_DATA/ICEPRDSTB/DATAFILE/system.362.886346055
   2 +DG_DATA/ICEPRDSTB/DATAFILE/sysaux.361.886346055
   3 +DG_DATA/ICEPRDSTB/DATAFILE/undotbs1.360.886346055
   4 +DG_DATA/ICEPRDSTB/DATAFILE/users.363.886345895
   5 +DG_DATA/ICEPRDSTB/DATAFILE/ice_tbs.359.886346055
   6 +DG_DATA/ICEPRDSTB/DATAFILE/ice_tbs.358.886346055
   7 +DG_DATA/ICEPRDSTB/DATAFILE/idx_ice_tbs.357.886346055

7 rows selected.

SQL> spool off
SQL> quit
Disconnected from Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

Este punto que hicimos, la verdad no veo una utilidad tangible, pero, toca hacerlo. Y seguimos con el siguiente punto.

10) From RMAN, connect to STANDBY database and restore the standby control file:

Nos conectamos con rman target / , apagamos la instancia y la subimos sin montarla. Luego restauramos el archivo de control.

[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Wed Feb 3 18:37:49 2016

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ICE_PRD (DBID=3835273413, not open)

RMAN> SHUTDOWN IMMEDIATE;

using target database control file instead of recovery catalog
database dismounted
Oracle instance shut down

RMAN> STARTUP NOMOUNT;

connected to target database (not started)
Oracle instance started

Total System Global Area   26723696640 bytes

Fixed Size                     7584272 bytes
Variable Size               7583303152 bytes
Database Buffers           19058917376 bytes
Redo Buffers                  73891840 bytes

RMAN> RESTORE STANDBY CONTROLFILE FROM '/orafra/backup_set/BCKSTB/ForStandby_0mqt13au_1_1';

Starting restore at 03-FEB-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=183 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DG_DATA/ICEPRDSTB/CONTROLFILE/current.356.886335905
output file name=+DG_FRA/ICEPRDSTB/CONTROLFILE/current.310.886335905
Finished restore at 03-FEB-16

RMAN>

Una vez finalizado el proceso, volvemos a bajar la instancia y la volvemos a subir en modo mount

11) Shut down the STANDBY database and startup mount:

RMAN> SHUTDOWN IMMEDIATE;

Oracle instance shut down

RMAN> STARTUP MOUNT;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area   26723696640 bytes

Fixed Size                     7584272 bytes
Variable Size               7583303152 bytes
Database Buffers           19058917376 bytes
Redo Buffers                  73891840 bytes

12) Catalog datafiles in STANDBY if location/name of datafiles is different

RMAN> CATALOG START WITH '+DG_DATA/ICEPRDSTB/DATAFILE/';

Starting implicit crosscheck backup at 03-FEB-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=183 device type=DISK
Crosschecked 10 objects
Finished implicit crosscheck backup at 03-FEB-16

Starting implicit crosscheck copy at 03-FEB-16
using channel ORA_DISK_1
Finished implicit crosscheck copy at 03-FEB-16

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3584
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3585
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3586
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3587
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3588
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3589
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3590
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3591
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3592
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3593
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3594
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3595
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3596
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3597
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3598
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3599
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3600
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3601
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3602
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3603
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3604
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3605
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3606
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3607
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3608
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3609
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3610
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3611
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3612
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3613
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3614
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3615
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3616
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3617
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3618
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3619
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3620
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3621
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3622
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3623
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3624
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3625
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3626
File Name: +DG_FRA/ICEPRDSTB/ARCHIVELOG/thread_1_seq_3627

searching for all files that match the pattern +DG_DATA/ICEPRDSTB/DATAFILE/

List of Files Unknown to the Database
=====================================
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/ICE_TBS.359.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/ICE_TBS.358.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/IDX_ICE_TBS.357.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/SYSAUX.361.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/UNDOTBS1.360.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/SYSTEM.362.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/USERS.363.886345895

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/ICE_TBS.359.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/ICE_TBS.358.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/IDX_ICE_TBS.357.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/SYSAUX.361.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/UNDOTBS1.360.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/SYSTEM.362.886346055
File Name: +DG_DATA/ICEPRDSTB/DATAFILE/USERS.363.886345895

RMAN> 

En el proceso que acabamos de realizar, el sistema nos preguntará si queremos catalogar los archivos que estamos restaurando, respondemos con ‘yes’.

Ahora la guia de oracle nos indica un paso siguiente, en donde verifica que no hayan archivos redologs diferentes en producción que se hayan agregado recientemente. Un paso un poco confuso,

*To determine if any files have been added to Primary since the standby current scn:

[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Feb 3 18:47:15 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

SQL> SELECT FILE#, NAME FROM V$DATAFILE WHERE CREATION_CHANGE# > 3709164957;

no rows selected

SQL> quit
Disconnected from Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

No rows selected.  Lo cual aparentmente indica que la base de datos de Standby se encuentra sincronizada con la de producción.

Ahora nos vamos al siguiente paso…

[ICEPRDSTB][DB12C]oradb@apolo:BCKSTB $ rman target /      

Recovery Manager: Release 12.1.0.1.0 - Production on Wed Feb 3 18:48:16 2016

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ICE_PRD (DBID=3835273413, not open)

RMAN> SWITCH DATABASE TO COPY;

using target database control file instead of recovery catalog
datafile 1 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/system.362.886346055"
datafile 2 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/sysaux.361.886346055"
datafile 3 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/undotbs1.360.886346055"
datafile 4 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/users.363.886345895"
datafile 5 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/ice_tbs.359.886346055"
datafile 6 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/ice_tbs.358.886346055"
datafile 7 switched to datafile copy "+DG_DATA/ICEPRDSTB/DATAFILE/idx_ice_tbs.357.886346055"

RMAN> 

En este paso lo que se hace es activar la copia en la base de datos. Para que? Luego investigaré, me quedan dudas.

Seguimos al paso siguiente

13) On STANDBY database, clear all standby redo log groups:

Vamos a limpiar los grupos de redo log que existan.

RMAN> select member from v$logfile;



MEMBER                                                                          
--------------------------------------------------------------------------------

+DG_FRA/ice_prd/onlinelog/group_5.264.885031641
 

+DG_FRA/ice_prd/onlinelog/group_4.265.885031637
 

+DG_FRA/ice_prd/onlinelog/group_3.266.885031633
 

+DG_FRA/ice_prd/onlinelog/group_2.267.885031629
 

+DG_FRA/ice_prd/onlinelog/group_1.268.885031625
 

RMAN> ALTER DATABASE CLEAR LOGFILE GROUP 1;

Statement processed

RMAN> ALTER DATABASE CLEAR LOGFILE GROUP 2;

Statement processed

RMAN> ALTER DATABASE CLEAR LOGFILE GROUP 3;

Statement processed

RMAN> ALTER DATABASE CLEAR LOGFILE GROUP 4;

Statement processed

RMAN> ALTER DATABASE CLEAR LOGFILE GROUP 5;

Statement processed

RMAN>

Ahora sigue el último punto. Activar el MRP , proceso de recuperación.

15) On the STANDBY database, start the MRP

RMAN> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

Statement processed

Y listo, ya nos podemos ir a tomar un tequilita.

En el servidor de producción existe un script, que permite verificar si tenemos sincronizadas las bases de datos.

[ICEPRD][DB12C]oracle@piscis:oracle $ ./check_iceprd_stb.sh 
+----------------------------------------------------------------+
|                         STANDBY VALIDATE                       |
+----------------------------------------------------------------+
|  THREAD# DB_NAME      HOST_NAME        SEQUENCE#               |
+----------------------------------------------------------------+
   1 ICE_PRD	        PISCIS		     3629
+----------------------------------------------------------------+
   1 ICE_PRD	        APOLO		3627:3628
+----------------------------------------------------------------+
                                                  DIFFERENCES:  1    
+----------------------------------------------------------------+

 

 

Sin respuestas

Deja un comentario