With Standard edition it's not possible to set RMAN Archivelog deletion policy on Primary to "Applied on Standby".
Customers often want to prevent their RMAN backup scripts on primary database to delete archived logs which were not yet applied to Dbvisit Standby database.
This KB article describes possible way how to mimic this deletion policy using Dbvisit Standby components.
Problem Details
Problem Statement
NA
Applicable Error Code
NA
Affected Versions
NA
Affected Platforms
NA
Workaround
In this workaround we will use dbvnet and dbvctl commands to obtain Standby Datbase recovery sequence and use this sequence number to perform archivelog deletion on primary database.
Step 1. Create Sample RMAN deletion script:
vi delete_archlogs.rman
run {
delete archivelog until sequence &1;
}
Step 2: Create Sample Shell script to determine Standby Recovery Sequence
vi delete_archlogs.sh
#!/bin/bash
# Define Variables
DBVISIT_BASE=/usr/dbvisit
DDC=DBVSIX
DESTINATION=czlin0182
# Get recovery SCN of standby DB
CMD_SCN="$DBVISIT_BASE/standby/dbvctl -f recovery_scn_time -d $DDC | head -1"
STB_SCN=`$DBVISIT_BASE/dbvnet/dbvnet -a $DESTINATION -p 7890 -e "$CMD_SCN"`
# Transform SCN to recovery Sequence
STB_SEQ=`$DBVISIT_BASE/standby/dbvctl -f scn_to_sequence -d $DDC -a scn=$STB_SCN | cut -d= -f3`
# substract 1 to get last applied sequence
let STB_SEQ=STB_SEQ-1
# start RMAN backup script for deleting archlogs
rman target / @delete_archlogs.rman $STB_SEQ
$ ./dbvctl -d DBVSIX -i
Dbvisit Standby log gap report for DBVSIX at 202004011959:
-------------------------------------------------------------
Description | SCN | Timestamp
-------------------------------------------------------------
Source 52800404 2020-04-01:19:59:05 +02:00
Destination 52800321 2020-04-01:19:57:50 +02:00
Standby database time lag (DAYS-HH:MI:SS): +00:01:15
Report for Thread 1
-------------------
SOURCE
Current Sequence 90
Last Archived Sequence 89
Last Transferred Sequence 85
Last Transferred Timestamp 2020-04-01 19:58:44
DESTINATION
Next Required Recovery Sequence 85
Transfer Log Gap 4
Apply Log Gap 5
$ ./rman_backup.sh
Recovery Manager: Release 18.0.0.0.0 - Production on Wed Apr 1 19:59:18 2020
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved.
connected to target database: DBVSIX (DBID=574695139)
RMAN> run {
2> delete archivelog until sequence 84;
3> }
4>
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=268 device type=DISK
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_77_h89msbf1_.arc RECID=120 STAMP=1036610890
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_78_h89mscdt_.arc RECID=121 STAMP=1036610891
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_79_h89msdyq_.arc RECID=122 STAMP=1036610892
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_80_h89msygt_.arc RECID=123 STAMP=1036610910
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_81_h89mv3tv_.arc RECID=124 STAMP=1036610947
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_82_h89ojwdr_.arc RECID=125 STAMP=1036612668
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_83_h89ojx9z_.arc RECID=126 STAMP=1036612669
deleted archived log
archived log file name=/u01/app/oracle/fast_recovery_area/DBVSIX/archivelog/2020_04_01/o1_mf_1_84_h89ojz0p_.arc RECID=127 STAMP=1036612671
Deleted 8 objects
Recovery Manager complete.
Comments