Documente Academic
Documente Profesional
Documente Cultură
DATBASE
&
Lets consider an extended n/w failure occurred between the Primary and Standby
machines
which causes the Standby is very far behind the Primary database, then an RMAN
INCREMENTALBACKUP can be used to roll the Standby database forward faster
than redo log apply.When the archived logs are missing on the Standby database,
simply we can ship missing logsfrom the Primary to Standby database; (If missing
logs are very less count e.g. (below 15).We need to register all Shipped logs in the
Standby database so that Gap can be resolved.In this article I will demonstrate how
to resolve archive log gaps using following methods.
MOUNTED
o1_mf_1_553_cnvohcy1_.arc';
Database altered.
.
SYS> alter database register
logfile '/u01/app/oracle/flash_recovery_area/STBYCRMS/archivelog/2016_06
_01/o1_mf_1_554_cnvokk6z_.arc';
Database altered.
SYS> alter database register
logfile '/u01/app/oracle/flash_recovery_area/STBYCRMS/archivelog/2016_06
_01/o1_mf_1_555_cnvom1l4_.arc';
Database altered.
SYS> alter database register
logfile '/u01/app/oracle/flash_recovery_area/STBYCRMS/archivelog/2016_06
_01/o1_mf_1_556_cnvomxkz_.arc';
Database altered.Recovery process would start automatically or else stop
the managed recovery process (MRP)and re-start it once again;
thats it!
Archive logs
deleted/corrupted
on Primary database.In cases where a Physical Standby database is out of Sync
with Primary database. In caseof archive logs are missing/corrupt we have to
rebuild the Standby from scratch. If thedatabase size in
terabytes
again rebuilding the Standby database could be a tedious job;but we a solution
to resolve this kind of issues.As a DBA you can go for an RMAN Incremental
backup to sync a Physical Standby with thePrimary database; using the command
RMAN BACKUP INCREMENTAL FROM SCN
558
01-JUN/04:33 95
CANCEL MANAGED RECOVERY PROCEES
# On Standby databaseSYS> alter database recover managed standby
database cancel;
Database altered.
GET LAST SCN OF THE STANDBY DATABASE
Last SCN of the
STANDBY,
will be used for the RMAN Incremental backup at Primary DB Server.
# On the Standby database Server (Checking last SCN of the Standby)SYS>
select current_scn from v$database;CURRENT_SCN
-----------3473651
# On the Primary database Server (Capture current_scn at primary)SYS>
select current_scn from v$database;CURRENT_SCN
-----------4538393Note the SCN DIFFERENCE 4538393
3473651
=
1064742
(Now the Standby is lag behind).
But I want to know how long the Standby database is far behind in terms of
(hours/days).To know that I used the
scn_to_timestamp
function to translate the SCN to timestamp.
# On Primary databaseSYS> select scn_to_timestamp(4538393) from
dual;SCN_TO_TIMESTAMP(4538393)
---------------------------------------01-JUN-16
11.12.52.000000000 PM
(3473651)
of the Standby database.The last recorded SCN#
(3473651)
of the
Standby database.
# Connect target as Primary database$ rman target sys/passwd@CRMSDB
..connected to target database: CRMS (DBID=1613387466)
RMAN> backup incremental from SCN 3473651 database
format '/u03/rman-bkp/stby_%U'TAG='FOR_STBY';
Starting backup at 02-JUN-16using target database control file instead of recovery
catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=52 device
type=DISKbackup will be obsolete on date 09-JUN-16archived logs will not be
kept or backed upchannel ORA_DISK_1: starting full datafile backup setchannel
ORA_DISK_1: specifying datafile(s) in backup setinput datafile file
number=00003 name=/u01/app/oracle/oradata/crms/undotbs01.dbfinput datafile
file number=00004 name=/u01/app/oracle/oradata/crms/users01.dbfinput datafile
file number=00001 name=/u01/app/oracle/oradata/crms/system01.dbfinput datafile
file number=00002 name=/u01/app/oracle/oradata/crms/sysaux01.dbfinput
datafile file
number=00005 name=/u01/app/oracle/oradata/crms/example01.dbfinput datafile
file number=00007 name=/u01/app/oracle/oradata/crms/users02.dbfinput datafile
file number=00006 name=/u01/app/oracle/oradata/crms/users03.dbfinput datafile
file number=00008 name=/u01/app/oracle/oradata/crms/mytbs01.dbfchannel
ORA_DISK_1: starting piece 1 at 02-JUN-16channel ORA_DISK_1: finished
piece 1 at 02-JUN-16
piece handle=/u03/rman-bkp/
stby_03r73ftc_1_1
tag=FOR_STBY comment=NONEchannel ORA_DISK_1: backup set complete,
elapsed time: 00:13:13using channel ORA_DISK_1backup will be obsolete on
date 09-JUN-16archived logs will not be kept or backed upchannel ORA_DISK_1:
starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in
backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 02-JUN-16channel ORA_DISK_1:
finished piece 1 at 02-JUN-16piece handle=/u03/rman-bkp/
stby_04r73gm6_1_1
tag=FOR_STBY comment=NONEchannel ORA_DISK_1: backup set complete,
elapsed time: 00:00:04Finished backup at 02-JUN-16
CREATE A NEW STANDBY CONTROLFILE
On the Primary database, create a new Standby control file.We can use (SQL*Plus
or RMAN) to create a Standby control file; Anyone method is enough.
SYS> alter database create standby controlfile as '/home/oracle/stdb_ctrl.ctl';
Database altered.
Or
NOMOUNT PHASE
$ export ORACLE_SID=stbycrms$ rman target /
connected to target database (not started)
RMAN> startup nomount;
Oracle instance
startedTotal System Global Area 912306176 bytesFixed Size 1340244 bytesVariab
le Size 536874156 bytesDatabase Buffers 369098752 bytesRedo Buffers 4993024
bytes
# Restore Standby control files from the backup# Replacing newly created
controlfile with old filesRMAN> restore standby controlfile
from '/u03/bkp/stdb_ctrl.ctl';
Starting restore at 02-JUN-16allocated channel: ORA_DISK_1channel
ORA_DISK_1: SID=19 device type=DISKchannel ORA_DISK_1: restoring
control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/stbycrms/control01.ctloutput file na
me=/u01/app/oracle/flash_recovery_area/stbycrms/control02.ctl
Finished restore at 02-JUN-16
SHUTDOWN THE STANDBY DATABASE
&
STARTUP MOUNT
RMAN> shutdown immediate;
Oracle instance shut down
# Startup the database with new controlfileRMAN> startup mount;
connected to target database (not started)Oracle instance starteddatabase mounted
scp