Oracle DG--Rman backup set to build a backup database

There are two common ways to build online backup databases: Rman auxiliary and Rman backup set recovery.
When the environment configuration is OK, a Rman command can be used to complete the initialization synchronization of the standby database, which is relatively simple.

# Land
rman target sys/Oracle123@orcl_pri auxiliary sys/Oracle123@orcl_dg
# Start to build auxiliary database
RMAN>duplicate target database for standby nofilenamecheck from active database;

The recovery steps of Rman backup set are relatively more, but not very complicated.
(1) planning database parameters

DB db_name db_unique_name tnsname
primary orcl orcl orcl_pri
standby orcl orcl_s orcl_dg
DB db_file_base log_file_base
primary /oradata/orcl /oradata/log
standby /oradata/orcl_dg /oradata/log_dg

(2) main database parameter configuration (do not consider failover, only configure the least parameters)

alter system set log_archive_config = 'dg_config=(orcl,orcl_s)';
alter system set log_archive_dest_2 = 'SERVICE=orcl_dg ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl_s' scope=both;
alter system set log_archive_dest_state_2 = ENABLE;
alter system set standby_file_management = auto;
# Generate pfile as the parameter file for standby database startup
create pfile=/home/oracle/pfile.ora' from spfile;

(3) the standby database directly modifies the pfile.ora parameter and starts to the nomount state

#  Start database
create spfile from pfile='/home/oracle/pfile.ora'
startup nomount

(4) configuration of tnsnames.ora and listener.ora
(5) backup the main database and upload it to the standby database

# Full library
RMAN> run {
 allocate channel t1 type disk;
 backup database FORMAT '/oradata/backup/data_%T_%s'; 
 release channel t1;
# Control file backup
RMAN> backup current controlfile for standby format '/oradata/backup/control.bak';

(5) backup database recovery

# Restore control file
RMAN> RESTORE STANDBY CONTROLFILE FROM '/oradata/backup/control.bak';

# Start database to mount state
RMAN> sql 'alter database mount'

# Recover database
RMAN> catalog start with '/oradata/backup/';
RMAN> restore database;
RMAN> recover database;
# Error reported in recovery, can be ignored
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/17/2017 09:33:30
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence xx  and starting SCN of xxxx

(6) create standby log file for real-time data synchronization

alter system set standby_file_management = manual;
ALTER DATABASE ADD standby LOGFILE group  11 '/oradata/log_dg/std11.log' size 500m ;
ALTER DATABASE ADD standby LOGFILE group  12 '/oradata/log_dg/std12.log' size 500m ;
ALTER DATABASE ADD standby LOGFILE group  13 '/oradata/log_dg/std13.log' size 500m ;
ALTER DATABASE ADD standby LOGFILE group  14 '/oradata/log_dg/std14.log' size 500m ;

(7) start real-time log application and open database

select open_mode ,flashback_on,current_scn from v$database;
# Application log
alter database recover managed standby database disconnect from session;
# View the application status, switch logs in the main database, and view the sequence changes
select max(sequence#),applied,archived from v$archived_log group by applied,archived;
# Open database
alter database recover managed standby database cancel;
alter database open;
alter database recover managed standby database disconnect from session using current logfile;

Oracle DG is one of the most commonly used database architectures. You must be able to skillfully build a DG environment and master the DG failover /switchover and recovery methods.

Tags: Database rman Oracle Session

Posted on Mon, 02 Dec 2019 00:08:57 -0500 by jeff_lawik