Tuesday 25 August 2020

ORA-10562: Error occurred while applying redo to data block

 

Issue:- ORA-10562: Error occurred while applying redo to data block


While recovering the standby database found the below error in alert log

Sun Aug 09 03:21:37 2020 

Errors in file /u01/app/testdb/oracle/diag/rdbms/testdb/testdb/trace/testdb_mrp0_15081.trc: 

ORA-10562: Error occurred while applying redo to data block (file# 4, block# 7173) 

ORA-10564: tablespace TOOLS 

ORA-01110: data file 4: '/u01/app/testdb/oradata02/testdb/tools_01.dbf' 

ORA-10561: block type 'TRANSACTION MANAGED DATA BLOCK', data object# 304906 

ORA-00607: Internal error occurred while making a change to a data block 

ORA-00602: internal programming exception 

ORA-07445: exception encountered: core dump [kdr9ir2rst0()+886] [SIGSEGV] 

[ADDR:0x7FFC05A5AFE0] [PC:0xB589B86] [Address not mapped t 

Sun Aug 09 03:21:37 2020 

MRP0: Background Media Recovery process shutdown (testdb)


To Resolve the issue I have implemented the below steps

1) Take the backup of the data file which is impacted (Backup need to take from primary database)

 In  My case data file 4 is impacted 

connect to RMAN on primary 

rman target / 

 Recovery Manager: Release 12.1.0.2.0 - Production on Sun Aug 9 03:54:26 2020 

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

 connected to target database: prod (DBID=3642994164)


RMAN> backup datafile 4 format '/u01/app/prod/backup/Datafilefile_4.bk';

2) Transfer the backup piece to standby database

   You can use any tool to move file from primary to standby(i.e scp,ftp)

3) catalog the backup piece location on the standby side

 RMAN> catalog backuppiece '/u01/app/backup/Datafilefile_4.bk';

4) check  and confirm the backup piece

RMAN> list backuppiece '/u01/app/backup/Datafilefile_4.bk';

RMAN> list backup of datafile 4;


once confirm the backup

5) check mrp is running if mrp is running stop it .

alter database recover managed standby database cancel;

6)once MRP down restore the backup

RMAN> Restore datafile 4;


channel ORA_DISK_1: restore complete, elapsed time: 00:02:20

Finished restore at 09-Aug-20

7) start the MRP on standby database

SQl> Alter database recover managed standby disconnect from session;

check the alert log it will start applying the alert log 

Hope it will help to resolve issue

Thank you .


 



Saturday 30 May 2020

Manual Switchover to Standby Database

We will see how to switchover the database role from primary to standby and vice versa

Switchover is the process or allowing to the primary/standby database to switch their role with their
respective primary/standby database. Where there is no any data loss during the role change this is known as switchover.

There are two main database role

              1)    Primary database
              2)    Standby database

Primary Database:-

           Is the database where all the active user connection are coming from end user.

Standby Database:-

      The database is connected to primary database any work happens  on the primary database will get reflect to standby database in the form of redo data. In some times it is used for reporting purpose (read only) mode.

Before going to switch over need to consider below things.

       1)      Standby database need to be in sync with primary.
       2)      Check network connection between primary and standby it need to be active
       3)      Check Standby redo logs(SRL’s) are configured on primary side.

Starting Manual Switchover

      1)      On Primary Database
      
          1.1) check switchover status

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
-----------------------------
To STANDBY

Note:- You will get output  Active session OR  To standby

1.2)  Change the switchover status

SQL> Alter database commit to switchover to physical standby with session shutdown;
Database altered

SQL> shutdown immediate

SQL> startup nomount

SQL>alter database mount standby database;

       2)    On Standby Database
          
            2.1) check the switchover status

      SQL> select switchover_status from v$database;

      SWITCHOVER_STATUS
       --------------------
      TO PRIMARY

      2.2) Stop the Managed Recovery Process (MRP)

      SQL> alter database recover managed standby database cancel;

       2.3) execute below command to switchover standby database to Primary

       SQL> Alter database commit to switchover to primary;

       SQL> shut immediate

       SQL> startup

       2.4) now check the database role it is now primary.

       SQL> select name,open_mode,database_role from v$database;

       NAME     OPEN_MODE DATABASE_ROLE
        --------- -------------------- ----------------
       TESTDB    READ WRITE PRIMARY

     3)  Now on  newly created standby database start Recovery (MRP)

       SQL>alter database recover managed standby database disconnect from session;

        Media recovery completed


.