Showing posts with label Oracle 11g Data Guard. Show all posts
Showing posts with label Oracle 11g Data Guard. Show all posts

Monday, 22 August 2016

Resize Redo Log size in Data Guard ( Primary and Standby) Oracle 11g


-----------Resize Redo Log in Primary Database-------

alter database drop logfile group 2;
alter database add logfile  group 2 '/u01/app/oracle/oradata/orcl/redo02.log' size 5m;

alter database drop logfile group 3;
alter database add logfile  group 3 '/u01/app/oracle/oradata/orcl/redo03.log' size 5m;

alter system switch logfile

alter database drop logfile group 1;

--Error Come----

ORA-01624: log 1 needed for crash recovery of instance orcl (thread 1)
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'

select group#,status from v$log;

alter system checkpoint;

alter database drop logfile group 1;

alter database add logfile  group 1 '/u01/app/oracle/oradata/orcl/redo01.log' size 5m;


alter database drop logfile group 4;

ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 '/u01/app/oracle/oradata/orcl/stby04.log' size 5m;

alter database drop logfile group 5;

ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 '/u01/app/oracle/oradata/orcl/stby05.log' size 5m;

alter database drop logfile group 6;

ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 '/u01/app/oracle/oradata/orcl/stby06.log' size 5m;

-----------Resize Redo Log in Standby Database-------

Check Database Status

SQL> select status,instance_name,database_role from v$database,v$Instance;

STATUS       INSTANCE_NAME    DATABASE_ROLE
------------ ---------------- ----------------
OPEN         orcls         PHYSICAL STANDBY

SQL>

Check if the parameter standby_file_management is set to AUTO or MANUAL on standby database. If it is not set to MANUAL, then set it.

SQL> show parameter standby_file_management

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_file_management              string      auto
SQL>


SQL> alter system set standby_file_management=manual;

System altered.

SQL>
SQL> show parameter standby_file_management

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_file_management              string      MANUAL
SQL>

SQL> select group#,status from v$standby_log;

    GROUP# STATUS
---------- ----------
         4 ACTIVE
         5 UNASSIGNED
         6 UNASSIGNED

SQL> select group#,status from v$log;

    GROUP# STATUS
---------- ----------------
         1 CLEARING
         2 CLEARING
         3 CURRENT

SQL> alter database drop logfile group 1;
alter database drop logfile group 1
*
ERROR at line 1:
ORA-01156: recovery or flashback in progress may need access to files

Now to solve this issue we have cancel the managed recovery session
and set  "standby_file_management"  to manual and drop the standby redolog file  as

SQL> alter database recover managed standby database cancel ;

Database altered.

SQL>
SQL> alter database drop logfile group 1;
alter database drop logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of instance orcls (thread 1)
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcls/redo01.log'

SQL> select group#,status from v$log;

    GROUP# STATUS
---------- ----------------
         1 CLEARING
         2 CLEARING
         3 CURRENT


If the status of standby redolog show the "clearing_current" then we cannot drop "clearing_current" status
logs,and for that we have to sync with Primary and clear the log first before dropping as

SQL> alter database clear logfile group 1;

SQL> select group#,status from v$log;

    GROUP# STATUS
---------- ----------------
         1 UNUSED
         2 CLEARING
         3 CURRENT

SQL>  alter database drop logfile group 1;

Database altered.

SQL> alter database add logfile  group 1 '/u01/app/oracle/oradata/orcls/redo01.log' size 5m;

Database altered.

SQL> alter database clear logfile group 2;

Database altered.

SQL>  alter database drop logfile group 2;

Database altered.

SQL> alter database add logfile  group 2 '/u01/app/oracle/oradata/orcls/redo02.log' size 5m;
SQL> alter database add logfile  group 3 '/u01/app/oracle/oradata/orcls/redo03.log' size 5m;

---Now Remove Standby Redolog file---

SQL> select group#,status from v$standby_log;

    GROUP# STATUS
---------- ----------
         4 UNASSIGNED
         5 ACTIVE
         6 UNASSIGNED

SQL> alter database drop standby logfile group 4;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 '/u01/app/oracle/oradata/orcls/stby04.log' size 5m;

SQL> alter database drop standby logfile group 5;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 '/u01/app/oracle/oradata/orcls/stby05.log' size 5m;

SQL> alter database drop standby logfile group 6;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 '/u01/app/oracle/oradata/orcls/stby06.log' size 5m;

----Now check the status of red log and standby redo log status----

SQL> select group#,status from v$standby_log;

    GROUP# STATUS
---------- ----------
         4 UNASSIGNED
         5 UNASSIGNED
         6 UNASSIGNED

SQL> select group#,status from v$log;

    GROUP# STATUS
---------- ----------------
         1 CURRENT
         2 UNUSED
         3 UNUSED

-------Check the size of redo log and standby redo log file size

SQL> select group#,sum(bytes/1024/1024)"size in MB" from v$standby_log group by group#;

    GROUP# size in MB
---------- ----------
         6          5
         4          5
         5          5

SQL> select group#,sum(bytes/1024/1024)"size in MB" from v$log group by group#;

    GROUP# size in MB
---------- ----------
         1          5
         2          5
         3          5


Once all the Standby Redo Logs and Online Redo Logs have been resize on both Primary and standby database,
set the STANDBY_FILE_MANAGEMENT to AUTO on the standby database and start the recovery (MRP) on standby database.

SQL> alter system set standby_file_management=auto;
SQL> alter database recover managed standby database disconnect from session using current logfile;

Database altered.

SQL> select process,status,sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
.
.
PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING              66
.
.
.

RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                  0

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                  0
RFS       IDLE                 68
MRP0      APPLYING_LOG         68

41 rows selected.

SQL>


-----In Primary Database

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
            67

-----In Standby Database

SQL> select max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
            66


Cheers !!!!!!!!!!!!! If any confusion Please give me buzz !!!!!

Saturday, 20 August 2016

ORA-01196 ORA-01110: ORA-10458 signalled during: alter database open read only...


Error Log: Following errors are coming in alert log

Recovery of Online Redo Log: Thread 1 Group 5 Seq 47 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/agentdbs/stby05.log
Sun Aug 21 11:19:07 2016
Standby crash recovery failed to bring standby database to a consistent
point because needed redo hasn't arrived yet.
MRP: Wait timeout: thread 1 sequence# 0
Standby crash recovery aborted due to error 16016.
Errors in file /u01/app/oracle/diag/rdbms/agentdbs/agentdbs/trace/agentdbs_ora_23900.trc:
ORA-16016: archived log for thread 1 sequence# 47 unavailable
Recovery interrupted!
Some recovered datafiles maybe left media fuzzy
Media recovery may continue but open resetlogs may fail
Completed standby crash recovery.
Errors in file /u01/app/oracle/diag/rdbms/agentdbs/agentdbs/trace/agentdbs_ora_23900.trc:
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/u01/app/oracle/oradata/agentdbs/system01.dbf'
ORA-10458 signalled during: alter database open read only...



Solution:   The error mention in the trace file

[oracle@agentdbstdsrv ~]$ vim /u01/app/oracle/diag/rdbms/agentdbs/agentdbs/trace/agentdbs_ora_23900.trc

*** 2016-08-21 11:19:07.359
ORA-16016: archived log for thread 1 sequence# 47 unavailable
MRP: Prodding archiver at standby for thread 1 seq 47

*** 2016-08-21 11:19:07.360
Media Recovery drop redo thread 1
KCBR: Number of read descriptors = 1024
KCBR: Influx buffers flushed = 3 times

*** 2016-08-21 11:19:07.360
Completed Media Recovery
In-flux buffer recovery was not started because datafiles were fuzzy beyond in-flux recovery target.
Highest datafile fuzzy SCN: 0.1396075
In-flux buffer recovery target SCN: 0.1383731

Managed Recovery: Not Active posted.


We need to do the following changes in Primary Database

SQL> show parameter log_archive_dest_state_2

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_2             string      ENABLE
log_archive_dest_state_20            string      enable
log_archive_dest_state_21            string      enable
log_archive_dest_state_22            string      enable
log_archive_dest_state_23            string      enable
log_archive_dest_state_24            string      enable
log_archive_dest_state_25            string      enable
log_archive_dest_state_26            string      enable
log_archive_dest_state_27            string      enable
log_archive_dest_state_28            string      enable
log_archive_dest_state_29            string      enable
SQL> alter system set log_archive_dest_state_2=DEFER;

System altered.

SQL> alter system set log_archive_dest_state_2=ENABLE;

System altered.

Now we need to do the following in Standby Database

SQL> startup mount
ORACLE instance started.

Total System Global Area 3.7413E+10 bytes
Fixed Size                  2236168 bytes
Variable Size            1.7314E+10 bytes
Database Buffers         1.9998E+10 bytes
Redo Buffers               98414592 bytes
Database mounted.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

SQL> ALTER DATABASE OPEN READ ONLY;

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

Sunday, 19 October 2014

MRP process not start in standby / Archive log not applying in standby Database

Applies to:

 Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.
***Checked for relevance on 31-Aug-2012***
***Checked for relevance on 5-Aug-2014*** 




Symptoms

Physical standby recovery reports error in alert log:

Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Log /back/flash_recovery_area/STLBAST/archivelog/1_28158_842022897.arc
Errors in file /u01/app/oracle/diag/rdbms/stlbast/STLBAST/trace/STLBAST_pr00_27378.trc  (incident=640459):
ORA-00600: internal error code, arguments: [2619], [28158], [], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/stlbast/STLBAST/incident/incdir_640459/STLBAST_pr00_27378_i640459.trc
Sun Oct 19 16:40:53 2014
Completed:  alter database recover managed standby database disconnect from session
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Errors with log /back/flash_recovery_area/STLBAST/archivelog/1_28158_842022897.arc
MRP0: Background Media Recovery terminated with error 600
Errors in file /u01/app/oracle/diag/rdbms/stlbast/STLBAST/trace/STLBAST_pr00_27378.trc:
ORA-00600: internal error code, arguments: [2619], [28158], [], [], [], [], [], [], [], [], [], []
Recovery interrupted!
Errors in file /u01/app/oracle/diag/rdbms/stlbast/STLBAST/trace/STLBAST_pr00_27378.trc:
ORA-00600: internal error code, arguments: [2619], [28158], [], [], [], [], [], [], [], [], [], []
Slave exiting with ORA-600 exception
Errors in file /u01/app/oracle/diag/rdbms/stlbast/STLBAST/trace/STLBAST_pr00_27378.trc:
ORA-00600: internal error code, arguments: [2619], [28158], [], [], [], [], [], [], [], [], [], []
Sun Oct 19 16:40:53 2014
Dumping diagnostic data in directory=[cdmp_20141019164053], requested by (instance=1, osid=27378 (PR00)), summary=[incident=640459].
Errors in file /u01/app/oracle/diag/rdbms/stlbast/STLBAST/trace/STLBAST_mrp0_27376.trc  (incident=640451):
ORA-00600: internal error code, arguments: [2619], [28158], [], [], [], [], [], [], [], [], [], []



Cause

ORA-600[2619] is raised due to an invalid next_change# detected in archive log.

In this case, it is caused by the archive log disk space ran out on standby site, causing that archive log not fully written on disk. This lead to ORA-600[2619] when the archive log was applied.

Per standby alert log:



Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Log /back/flash_recovery_area/STLBAST/archivelog/1_28158_842022897.arc
Errors in file /u01/app/oracle/diag/rdbms/stlbast/STLBAST/trace/STLBAST_pr00_27378.trc  (incident=640459):
ORA-00600: internal error code, arguments: [2619], [28158], [], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/oracle/diag/rdbms/stlbast/STLBAST/incident/incdir_640459/STLBAST_pr00_27378_i640459.trc




Solution

1. Clear the disk space where archive log stored on standby site

2. Copy the problem archive log (eg: 1_28158_842022897.arc) from the primary site and replace the one on the standby, then restart Managed Recovery.

Archive log should be applied properly now


SQL> alter database recover managed standby database cancel;  --- Cancel first

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Database altered.

SQL>

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;