GoldenGate – RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process.

1- One of the obsolete integrated extract was causing Rman not to delete expired archive logs.


orcl:/u02/DBA/scripts ->./delete_arch.sh
The Oracle base remains unchanged with value /u01/app/oracle

Recovery Manager: Release 12.1.0.2.0 - Production on Fri Feb 9 15:25:15 2018

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

connected to target database: ORCL (DBID=1450870477)

RMAN> 2> 3> 4> 5> 6>
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=255 device type=DISK
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_153_f7w7xolv_.arc RECID=139 STAMP=967649093
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_154_f7w7xtxh_.arc RECID=140 STAMP=967649098
Crosschecked 2 objects


released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=255 device type=DISK
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_153_f7w7xolv_.arc thread=1 sequence=153
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_154_f7w7xtxh_.arc thread=1 sequence=154

RMAN>

 

2- Deleted the extracts but didn’t unregister from the database


orcl:/u01/ogg ->./ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Jun 30 2017 16:12:28
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved.



GGSCI (oradb1.localdomain) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     ABENDED     E1TEST      00:00:09      601:55:43
REPLICAT    ABENDED     R1TEST      00:00:00      601:56:10


GGSCI (oradb1.localdomain) 2> dblogin USERID GGUSER, PASSWORD gguser
Successfully logged into database.

GGSCI (oradb1.localdomain as GGUSER@orcl) 3> delete *test
Are you sure you want to delete all groups? y
Deleted EXTRACT E1TEST.

Deleted REPLICAT R1TEST.


GGSCI (oradb1.localdomain as GGUSER@orcl) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING

 

3- Check the database to see what is the extract holding the arch logs


SQL> SELECT CAPTURE_NAME, 
            CAPTURE_TYPE, STATUS, 
            to_char(REQUIRED_CHECKPOINT_SCN,'999999999999999')as REQ_SCN ,
            to_char(OLDEST_SCN,'999999999999999')as OLDEST_SCN 
     FROM DBA_CAPTURE;

CAPTURE_NAME             CAPTURE_TY STATUS   REQ_SCN          OLDEST_SCN
------------------------ ---------- -------- ---------------- ----------------
OGG$CAP_E1TEST           LOCAL      ENABLED  2255523          2255523

1 row selected.

 

4- Because database still have the GoldenGate integrated capture registered, the database won’t delete the arch logs required


orcl:/u02/DBA/scripts ->./delete_arch.sh
The Oracle base remains unchanged with value /u01/app/oracle

Recovery Manager: Release 12.1.0.2.0 - Production on Fri Feb 9 15:23:00 2018

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

connected to target database: ORCL (DBID=1450870477)

RMAN> 2> 3> 4> 5> 6>
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=284 device type=DISK
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_150_f7w7q3tq_.arc RECID=136 STAMP=967648886
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_151_f7w7q3st_.arc RECID=137 STAMP=967648886
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_152_f7w7q7t7_.arc RECID=138 STAMP=967648893
Crosschecked 3 objects


released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=284 device type=DISK
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_150_f7w7q3tq_.arc thread=1 sequence=150
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_151_f7w7q3st_.arc thread=1 sequence=151
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_152_f7w7q7t7_.arc thread=1 sequence=152

RMAN>

 

5- Unregister the GoldenGate Integrated capture from the database


orcl:/u01/ogg ->./ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Jun 30 2017 16:12:28
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved.



GGSCI (oradb1.localdomain) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING


GGSCI (oradb1.localdomain) 2> dblogin userid gguser, password gguser
Successfully logged into database.

GGSCI (oradb1.localdomain as gguser@orcl) 3> UNREGISTER EXTRACT e1test database

2018-02-09 15:28:41  INFO    OGG-01750  Successfully unregistered EXTRACT E1TEST from database.

 

6- Delete the arch logs successfully


orcl:/u02/DBA/scripts ->./delete_arch.sh
The Oracle base remains unchanged with value /u01/app/oracle

Recovery Manager: Release 12.1.0.2.0 - Production on Fri Feb 9 15:29:04 2018

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

connected to target database: ORCL (DBID=1450870477)

RMAN> 2> 3> 4> 5> 6>
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=255 device type=DISK
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_153_f7w7xolv_.arc RECID=139 STAMP=967649093
validation succeeded for archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_154_f7w7xtxh_.arc RECID=140 STAMP=967649098
Crosschecked 2 objects


released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=255 device type=DISK
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
139     1    153     A 09-FEB-18
        Name: /u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_153_f7w7xolv_.arc

140     1    154     A 09-FEB-18
        Name: /u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_154_f7w7xtxh_.arc

deleted archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_153_f7w7xolv_.arc RECID=139 STAMP=967649093
deleted archived log
archived log file name=/u02/fast_recovery_area/ORCL/archivelog/2018_02_09/o1_mf_1_154_f7w7xtxh_.arc RECID=140 STAMP=967649098
Deleted 2 objects


RMAN>

Recovery Manager complete.
Advertisements

How to see the oldest flashback available?

Using the following query one can see the flashback data available.

SELECT to_char(sysdate,'YYYY-MM-DD HH24:MI') current_time, to_char(f.oldest_flashback_time, 'YYYY-MM-DD HH24:MI') OLDEST_FLASHBACK_TIME,
(sysdate – f.oldest_flashback_time)*24*60 HIST_MIN FROM v$database d, V$FLASHBACK_DATABASE_LOG f;

CURRENT_TIME OLDEST_FLASHBACK HIST_MIN
—————- —————- ———-
2012-04-25 07:34 2012-04-25 05:48 106.066667

RMAN – incremental backup

RMAN command to create level 0 backup which is needed before running of incremental backup
RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE;

RMAN command to run level 1 backup. Level 1 backup will backup all blocks changed since most recent cumulative or differential backup. If a level 0 backup doesn’t exists, when running INCREMENTAL backup Oracle will perform a full backup.
RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;

RMAN command to run level 1 cumulative backup. Level 1 backup will backup all blocks changed since most recent Level 0 backup. If a level 0 backup doesn’t exists, when running INCREMENTAL backup Oracle will perform a full backup.
RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;

RMAN command to backup database level 1 and skip datafiles and archived redo logs that cannot be read due to I/O errors to be excluded from backup
RMAN> BACKUP INCREMENTAL LEVEL 1 INACCESSIBLE DATABASE;

How to fix issue when the online redo logs are missing?

If for some reason the online redo log were lost or when cloning the copy of shutdown database you don’t have the on-line redo logs, you would need to open the database with “RESETLOGS” option which will create the online redo logs.

Example:
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 521936896 bytes
Fixed Size 2177328 bytes
Variable Size 356517584 bytes
Database Buffers 155189248 bytes
Redo Buffers 8052736 bytes
SQL> alter database mount;

Database altered.
SQL> recover database until cancel;
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.

-- shows online redo logs have been recreated
SQL> select member from v$logfile;

MEMBER
—————————————–
E:\ORACLE\DB\TESTDB\ORADATA\REDO01A.LOG
E:\ORACLE\DB\TESTDB\ORADATA\REDO01B.LOG
E:\ORACLE\DB\TESTDB\ORADATA\REDO02A.LOG
E:\ORACLE\DB\TESTDB\ORADATA\REDO02B.LOG
E:\ORACLE\DB\TESTDB\ORADATA\REDO03A.LOG
E:\ORACLE\DB\TESTDB\ORADATA\REDO03B.LOG

6 rows selected.

One has perform “RECOVER DATABASE UNTIL CANCEL” before opening the database, if one doesn’t Oracle will generate the following error when trying to open with resetlogs:
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

How to check if RMAN catalog is installed for a database?

There are couple of ways to determine if RMAN database is registered with a catalog.

Using RMAN when you connect to RMAN catalog and try to run a RMAN command like “list backup” it will generate an error as shown below
calora4db01q:/home/oracle $ rman target / catalog rmancataloguser/rmancatalogpassword@catalogdb

Recovery Manager: Release 10.2.0.4.0 – Production on Sun Jul 17 08:33:42 2011

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

connected to target database: TESTDB (DBID=1023910334)
connected to recovery catalog database

RMAN> list backup;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 07/17/2011 08:33:48
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

Another way would be to connect to the catalog schema through SQL*Plus and check view RC_DATABASE
$ sqlplus rmancataloguser/rmancatalogpassword@catalogdb
SQL*Plus: Release 10.2.0.4.0 – Production on Sun Jul 17 08:45:58 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from rc_database where name = ‘TESTDB’;

no rows selected

redo log generation during unrecoverable/nologging

# Capture amount of redo logs generated when table is created in UNRECOVERABLE
SQL> select vs.name, vm.value
from v$mystat vm, v$statname vs
where vm.statistic# = vs.statistic#
and vs.name like '%redo size%';

NAME VALUE
—————————————————————- ———-
redo size 597736

SQL> create table test_all unrecoverable as (select * from all_objects);

Table created.

SQL> select vs.name, vm.value
from v$mystat vm, v$statname vs
where vm.statistic# = vs.statistic#
and vs.name like '%redo size%';

NAME VALUE
—————————————————————- ———-
redo size 648936

CREATE TABLE with NOLOGGING option
SQL> select vs.name, vm.value
from v$mystat vm, v$statname vs
where vm.statistic# = vs.statistic#
and vs.name like '%redo size%';

NAME VALUE
—————————————————————- ———-
redo size 1193320

SQL> create table test_all nologging as (select * from all_objects);

Table created.

SQL> select vs.name, vm.value
from v$mystat vm, v$statname vs
where vm.statistic# = vs.statistic#
and vs.name like '%redo size%';

NAME VALUE
—————————————————————- ———-
redo size 1244436

Amount of redo logs generated for CREATE TABLE AS
– without UNRECOVERABLE/NOLOGGING option = 478904
– UNRECOVERABLE option = 51200
– NOLOGGING option = 51116
The amount of redo size is considerable less when nologging/unrecoverable is used.
Note: The database has to be in ARCHIVELOG mode to see the difference, if the database is in NOARCHIVELOG mode you won't see the difference.