Showing posts with label DataGuard. Show all posts
Showing posts with label DataGuard. Show all posts

Tuesday, 31 March 2020

Add online redo log group in standby database

How to add online redo log group in standby database
1. Change the value of standby database state to "APPLY-OFF" in dgmgrl
DGMGRL> show database verbose testdgbdr;

Database - testdgbdr 

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON

DGMGRL> edit database testdgbdr set state='APPLY-OFF';
DGMGRL> show database verbose testdgbdr;

Database - testdgbdr 

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-OFF

2. Add online redo log group in standby database
SQL> select db_unique_name from v$database

DB_UNIQUE_NAME
------------------------------
testdgbdr 

SQL> select group#, bytes/1024/1024 MB from v$log;

    GROUP#         MB
---------- ----------
         1         50
         2         50
         3         50

SQL> alter database add logfile group 4 ('/u01/app/redo/testdgb/redo04.log') SIZE 50M;

Database altered.

SQL> select group#, bytes/1024/1024 MB from v$log;

    GROUP#         MB
---------- ----------
         1         50
         2         50
         3         50
         4         50

3. Change the value of standby database state to "APPLY-ON" in dgmgrl
DGMGRL> show database verbose testdgbdr;

Database - testdgbdr 

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-OFF

DGMGRL> edit database testdgbdr set state='APPLY-ON';
DGMGRL> show database verbose testdgbdr;

Database - testdgbdr 

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON

Wednesday, 20 July 2016

"ORA-600 [3020]" / "ORA-16472" Perform failover after restore standby backup on standby site

If you got the error with "ORA-600 [3020]" or "ORA-16472" after performed failover on target standby database, you can try to perform a data-loss failover on target standby database.

As refer to the oracle document, this error is caused by the database configured the protection mode with "MaxAvailability" or "MaxPerformance" , data loss is detected during failover process.

For solve this issue, you can change the database protection mode to "Max Performance" before failover operation on target standby database or perform a data-loss failover on target standby database.

Here is the example:

Background:
1. The original protection mode of database is configured with "Max Availability".
2. The database is configured in physical standby database.
3. Oracle 12c Database on Oracle Linux
4. Both way are restored from same backup with applied the latest archive log, for plan A is unnecessary to perform a data-loss failover on target standby database.

A. Perform failover after changed the protection mode

RMAN> recover database;

Starting recover at 02-DEC-15
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=56
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=57
channel ORA_DISK_1: reading from backup piece /data_02/rman_disk/a_3045506482_20151202_151
channel ORA_DISK_1: piece handle=/data_02/rman_disk/a_3045506482_20151202_151 tag=TAG20151202T120618
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/arch/testdgbdr/1_56_896806709.dbf thread=1 sequence=56
archived log file name=/u01/app/arch/testdgbdr/1_57_896806709.dbf thread=1 sequence=57
media recovery complete, elapsed time: 00:00:02
Finished recover at 02-DEC-15

RMAN> alter database set standby database to maximize performance;

Statement processed

RMAN> exit


Recovery Manager complete.
[oracle@standby02 rman_disk]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 2 17:22:25 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select db_unique_name, protection_mode from v$database;

DB_UNIQUE_NAME       PROTECTION_MODE
------------------------------ --------------------
testdgbdr       MAXIMUM PERFORMANCE

SQL> alter database failover to testdgbdr;

Database altered.

SQL> select db_unique_name, database_role, protection_mode from v$database;

DB_UNIQUE_NAME       DATABASE_ROLE PROTECTION_MODE
------------------------------ ---------------- --------------------
testdgbdr       PRIMARY MAXIMUM PERFORMANCE

SQL> exit

Also, you can perform manual failover using DGMGRL (i.e. DG Broker).

DGMGRL> FAILOVER TO testdgdbr;


B. Perform failover without change the protection mode

RMAN> recover database;

Starting recover at 02-DEC-15
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=56
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=57
channel ORA_DISK_1: reading from backup piece /data_02/rman_disk/a_3045506482_20151202_151
channel ORA_DISK_1: piece handle=/data_02/rman_disk/a_3045506482_20151202_151 tag=TAG20151202T120618
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/arch/testdgbdr/1_56_896806709.dbf thread=1 sequence=56
archived log file name=/u01/app/arch/testdgbdr/1_57_896806709.dbf thread=1 sequence=57
media recovery complete, elapsed time: 00:00:03
Finished recover at 02-DEC-15

RMAN> exit


Recovery Manager complete.
[oracle@standby02 rman_disk]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 2 17:34:11 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select db_unique_name, database_role, protection_mode from v$database;

DB_UNIQUE_NAME       DATABASE_ROLE PROTECTION_MODE
------------------------------ ---------------- --------------------
testdgbdr       PHYSICAL STANDBY MAXIMUM AVAILABILITY

SQL> alter database failover to testdgbdr;
alter database failover to testdgbdr
*
ERROR at line 1:
ORA-16472: failover failed due to data loss

SQL> alter database activate physical standby database;

Database altered.

SQL> exit

Also, you can perform manual failover using DGMGRL (i.e. DG Broker).

DGMGRL> FAILOVER TO testdgdbr immediate;

Reference:
https://docs.oracle.com/database/121/SBYDB/role_management.htm#SBYDB4773
https://docs.oracle.com/database/121/DGBKR/sofo.htm#DGBKR370