{"id":73175,"date":"2015-02-17T11:27:55","date_gmt":"2015-02-17T11:27:55","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/uncategorized\/rolling-forward-a-physical-standby-database-using-the-recover-command\/"},"modified":"2026-04-15T18:45:50","modified_gmt":"2026-04-15T18:45:50","slug":"rolling-forward-a-physical-standby-database-using-the-recover-command","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/rolling-forward-a-physical-standby-database-using-the-recover-command\/","title":{"rendered":"Oracle 12c DataGuard: Roll Forward a Physical Standby with RECOVER FROM SERVICE"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-executive-summary\">Executive Summary<\/h2>\n\n\n\n<p><strong>When a physical standby database in Oracle DataGuard falls behind the primary &#8211; because archived logs were lost or redo transport was interrupted &#8211; it can be rolled forward without a full resynchronisation using the RECOVER&#8230;FROM SERVICE command. This is faster than rebuilding the standby from scratch and avoids the overhead of shipping all diverged archived logs. The command uses an incremental backup approach to close the gap between the standby&#8217;s current SCN and the primary&#8217;s current SCN. This article demonstrates the complete procedure: verifying the configuration with the primary (boston), far sync (bostonFS), and standby (london); simulating archived log loss; identifying out-of-sync datafiles on the standby; and executing and verifying the RECOVER FROM SERVICE recovery.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-rolling-forward-a-physical-standby-database-using-the-recover-command\"><b>Rolling Forward a Physical Standby Database Using the RECOVER Command<\/b><\/h2>\n\n\n\n<p>A standby database is a transactionally-consistent copy of the production database. It enables production Oracle&nbsp;database to survive disasters and data corruption. If the production database becomes unavailable because of a planned or an unplanned outage, Data Guard can switch a standby database to the production role, minimizing the downtime associated with the outage.&nbsp;Moreover, performance of production database can be improved by offloading resource-intensive backup and reporting operations to standby systems. As you can see, it\u2019s always desirable to have standby database synchronized with the primary database.<\/p>\n\n\n\n<p>A standby database might lag behind the primary for various reasons like:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Unavailability of or insufficient \u00a0network bandwidth between primary and standby database<\/li>\n\n\n\n<li>Unavailability of Standby database<\/li>\n\n\n\n<li>Corruption \/ Accidental deletion of \u00a0Archive Redo Data on primary<\/li>\n<\/ul>\n<\/div>\n\n\n<p>If standby database lags behind the primary database:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Switchover will take more time.<\/li>\n\n\n\n<li>Failover will result in data loss.<\/li>\n\n\n\n<li>An attempt to issue Real Time Query against the standby database will result in error<br><code>ORA-03172 : STANDBY_MAX_DATA_DELAY of n seconds exceeded.<\/code><\/li>\n<\/ul>\n<\/div>\n\n\n<p>Synchronizing the standby and primary databases can be done by copying and applying the archived logs from the primary database but this process is quite time consuming as it will first apply both the COMMITED and the NON COMMITED transactions followed by rolling back uncommitted transactions. Employing incremental backups of the primary database containing changes since the standby database was last refreshed is a faster alternative which will recover the standby database much faster as it will apply only the COMMITED transactions on the standby database. Moreover, incremental backups are also useful in cases when there are missing archived logs on Primary which have not been applied to the standby database<\/p>\n\n\n\n<p>Prior to 12c, in order to roll forward the standby database using incremental backups you would need to:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Create a control file for the standby database on the primary database.<\/li>\n\n\n\n<li>Take an incremental backup on the primary starting from the SCN# of the standby database.<\/li>\n\n\n\n<li>Copy the incremental backup to the standby host and catalog it with RMAN.<\/li>\n\n\n\n<li>Mount the standby database with newly created standby control file.<\/li>\n\n\n\n<li>Cancel managed recovery of the standby database and apply incremental backup to the standby database.<\/li>\n\n\n\n<li>Start managed recovery of standby database.<\/li>\n<\/ul>\n<\/div>\n\n\n<p>In 12c, this procedure has been dramatically simplified. Now you can use the RECOVER \u2026 FROM SERVICE command to synchronize the physical standby database with the primary database. &nbsp;This command does the following:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Creates an incremental backup containing the changes to the primary database. All changes to data files on the primary database, beginning with the SCN in the standby data file header, are included in the incremental backup.<\/li>\n\n\n\n<li>Transfers the incremental backup over the network to the physical standby database.<\/li>\n\n\n\n<li>Applies the incremental backup to the physical standby database.<\/li>\n<\/ul>\n<\/div>\n\n\n<p>This results in rolling forward the standby data files to the same point-in-time as the primary. However, the standby control file still contains old SCN values which are lower than the SCN values in the standby data files. Therefore, to complete the synchronization of the physical standby database, the standby control file needs to be refreshed to update the SCN#.<\/p>\n\n\n\n<p><b>Now I will demonstrate the steps to refresh the physical standby database with changes made to the primary database using the RECOVER\u2026FROM SERVICE command.<\/b><\/p>\n\n\n\n<p><b>Overview:<\/b><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>View current configuration and verify that primary database, far sync for primary and standby database are in sync<\/li>\n\n\n\n<li>Simulate loss of archived logs on the primary database<\/li>\n\n\n\n<li>Refresh the physical standby using the RECOVER\u2026FROM SERVICE command<\/li>\n<\/ul>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-setting-up-the-example\">Setting up the example<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-view-current-configuration\">View Current configuration<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DGMGRL&gt; show configuration;\nConfiguration - drsolution\n\nProtection Mode: MaxPerformance\nDatabases:\n   boston&nbsp;&nbsp; - Primary database\n   bostonFS - Far Sync\n   london&nbsp;&nbsp; - Physical standby database\n   london2&nbsp; - Logical standby database (disabled)\n   londonfs - Far Sync (inactive)\n\nFast-Start Failover: DISABLED\n\nConfiguration Status:\n\nSUCCESS<\/pre>\n\n\n\n<p>It can be verified that primary database (boston), far sync for primary (bostonFS) and physical standby (london) are in sync.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span style=\"color: blue;\">-- Primary (boston) --<\/span>\n\nBOSTON&gt;select max(sequence#) from v$archived_log;\n\nMAX(SEQUENCE#)\n\n--------------\n\n        <b>190<\/b>\n\n<span style=\"color: blue;\">-- Far Sync for primary (bostonFS) --<\/span>\n\nBOSTONFS&gt;select max(sequence#) from v$archived_log;\n\nMAX(SEQUENCE#)\n\n--------------\n\n        <b>190<\/b>\n\n<span style=\"color: blue;\">-- Physical standby (london) --<\/span>\n\nLONDON&gt;select max(sequence#) from v$archived_log;\n\nMAX(SEQUENCE#)\n\n--------------\n\n         <b>190<\/b><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-simulate-loss-of-archived-logs-on-primary-database-boston\">Simulate loss of archived logs on primary database (boston)<\/h3>\n\n\n\n<p>Let\u2019s stop redo transport from primary (boston) and switch logs on primary so that far sync (bostonFS ) and physical standby (london) lag behind primary (boston).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DGMGRL&gt; show database boston\nDatabase - boston\n   Role:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRIMARY\n   Intended State:&nbsp;&nbsp;&nbsp; TRANSPORT-ON\n   Instance(s):\n      boston\nDatabase Status:\nSUCCESS\n\nDGMGRL&gt; edit database boston set state='TRANSPORT-OFF';\n\nSucceeded.\n\nBOSTON&gt;alter system switch logfile;\n         alter system switch logfile;\n         alter system switch logfile;\n\nSystem altered.<\/pre>\n\n\n\n<p>We can verify that logs are not being transported to far sync bostonFS and standby london. Although sequence# of the latest archived log is 194 on primary, archived logs up to sequence# 191 only have reached far sync and physical standby.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BOSTON&gt;select max(sequence#) from v$archived_log;\nMAX(SEQUENCE#)\n--------------\n           194\n\nBOSTONFS&gt;select max(sequence#) from v$archived_log;\nMAX(SEQUENCE#)\n--------------\n           191\n\nLONDON&gt;select max(sequence#) from v$archived_log;\nMAX(SEQUENCE#)\n--------------\n           191<\/pre>\n\n\n\n<p>Next we\u2019ll find out the names of archived logs generated on primary which have not been transported to standby:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BOSTON&gt;select sequence#, name from v$archived_log where sequence# &gt;191;\n\nSEQUENCE# NAME\n\n---------- ----------------------------------------------------------------\n\n192 \/u01\/app\/oracle\/fast_recovery_area\/BOSTON\/archivelog\/2015_02_09\/o1_mf_1_192_bfjgx50j_.arc\n193 \/u01\/app\/oracle\/fast_recovery_area\/BOSTON\/archivelog\/2015_02_09\/o1_mf_1_193_bfjgx6tb_.arc\n194 \/u01\/app\/oracle\/fast_recovery_area\/BOSTON\/archivelog\/2015_02_09\/o1_mf_1_194_bfjgx6yh_.arc<\/pre>\n\n\n\n<p>In a real-time environment, archived logs on primary could be lost due to:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>their deletion if archivelog deletion policy has not configured \u00a0properly<\/li>\n\n\n\n<li>their corruption<\/li>\n<\/ul>\n<\/div>\n\n\n<p>In our experimental setup, I\u2019ll &nbsp;simulate loss of archived logs on primary by renaming them:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BOSTON&gt;ho mv \/u01\/app\/oracle\/fast_recovery_area\/BOSTON\/archivelog\/2015_02_09\/o1_mf_1_192_bfjgx50j_.arc\n\/home\/oracle\/arch_192.log\nBOSTON&gt;ho mv \/u01\/app\/oracle\/fast_recovery_area\/BOSTON\/archivelog\/2015_02_09\/o1_mf_1_193_bfjgx6tb_.arc\n\/home\/oracle\/arch_193.log\nBOSTON&gt;ho mv \/u01\/app\/oracle\/fast_recovery_area\/BOSTON\/archivelog\/2015_02_09\/o1_mf_1_194_bfjgx6yh_.arc\n\/home\/oracle\/arch_194.log<\/pre>\n\n\n\n<p>Now even if we restart redo transport from primary, gap in redo logs on far_sync \/ standby cannot be resolved as some logs are missing on primary.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DGMGRL&gt;&nbsp; edit database boston set state=<b>'Transport-on'<\/b>;\nDGMGRL&gt; show configuration;\nConfiguration - drsolution\n   Protection Mode: MaxPerformance\n   Databases:\n   boston&nbsp;&nbsp; - Primary database\n      Error: ORA-16724: cannot resolve gap for one or more standby databases\n      bostonfs - Far Sync\n        london&nbsp;&nbsp; - Physical standby database\n        london2&nbsp; - Logical standby database (disabled)\n      londonfs - Far Sync (inactive\nFast-Start Failover: DISABLED\nConfiguration Status:\n<span style=\"color: red; font-weight: bold;\">ERROR<\/span>\n\nDGMGRL&gt; show far_sync bostonFS\nFar Sync - bostonfs\n   Transport Lag:&nbsp;&nbsp;&nbsp;&nbsp; 3 minutes 43 seconds (computed 1 second ago)\n   Instance(s):\n      bostonFS\nFar Sync Status:\nSUCCESS\n\nDGMGRL&gt; show database london\nDatabase - london\n   Role:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PHYSICAL STANDBY\n   Intended State:&nbsp;&nbsp;&nbsp; APPLY-ON\n   Transport Lag:&nbsp;&nbsp;&nbsp;&nbsp; 3 minutes 53 seconds (computed 0 seconds ago)\n   Apply Lag:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 minutes 53 seconds (computed 0 seconds ago)\n   Apply Rate:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 759.00 KByte\/s\n   Real Time Query:&nbsp;&nbsp; OFF\n   Instance(s):\n      london\nDatabase Status:\nSUCCESS<\/pre>\n\n\n\n<p>It can be verified that SCN# (3717618) of standby (london) is lagging behind that (3718999) of the primary (boston)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BOSTON&gt;select current_scn from v$database;\nCURRENT_SCN\n          -----------\n            3718999\n\nLONDON&gt;select current_scn from v$database;\nCURRENT_SCN\n          ----------\n           3717618<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-refresh-the-physical-standby-using-the-recover-from-service-command\">Refresh the physical standby using the RECOVER\u2026FROM SERVICE command<\/h3>\n\n\n\n<p>First of all let us identify the datafiles on standby database which are out of sync with respect to primary.<\/p>\n\n\n\n<p>On &nbsp;checking &nbsp;checkpoint_change# in datafile headers on primary (boston) and standby (london), we note that whereas checkpoint_change# of datafiles 5,7,8,9,10,11 match on primary and standby, for rest of the &nbsp;datafiles (1,3,4,6) standby is lagging behind &nbsp;primary.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BOSTON&gt;select file#, checkpoint_change# from v$datafile;\n\n     FILE# CHECKPOINT_CHANGE#\n---------- ------------------\n         1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717658\n         3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717658\n         4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717658\n         <span style=\"color: blue;\">5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1910129<\/span>\n         6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717658\n         <span style=\"color: blue;\">7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1910129<\/span>\n         <span style=\"color: blue;\">8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n         <span style=\"color: blue;\">9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n         <span style=\"color: blue;\">10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n         <span style=\"color: blue;\">11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n\n10 rows selected.\n\nLONDON&gt;select file#, checkpoint_change# from v$datafile;\n\n     FILE# CHECKPOINT_CHANGE#\n---------- ------------------\n         1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717619\n         3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717619\n         4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717619\n         <span style=\"color: blue;\">5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1910129<\/span>\n         6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3717619\n         <span style=\"color: blue;\">7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1910129<\/span>\n         <span style=\"color: blue;\">8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n        <span style=\"color: blue;\"> 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n       <span style=\"color: blue;\"> 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n       <span style=\"color: blue;\"> 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3690127<\/span>\n\n10 rows selected.<\/pre>\n\n\n\n<p>In order to synchronize the standby we will stop the managed recovery processes on the physical standby database and place the physical standby database in MOUNT mode.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">LONDON&gt;recover managed standby database cancel;\n\n            shutdown immediate;\n\n            startup mount;<\/pre>\n\n\n\n<p>Start RMAN and connect as target to the physical standby database. Refresh the data files on the physical standby database by using an incremental backup of the data files on the primary database.<\/p>\n\n\n\n<p>The following command creates a compressed&nbsp;multi-section incremental backup on the primary database that is then used to refresh the standby data files.&nbsp;<b>boston<\/b>&nbsp;is the net service name of the primary database that is used to refresh the standby database. The&nbsp;<b>NOREDO<\/b>&nbsp;clause specifies that the archived redo log files must not be applied during recovery.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[oracle@host03 ~]$ . oraenv\n\nORACLE_SID = [london] ?\n\n[oracle@host03 ~]$ rman target \/\n\nRMAN&gt; recover database from service boston noredo using compressed backupset section size 100m;\n\nStarting recover at 09-FEB-15\n\n<span style=\"color: blue; font-weight: bold;\">Starting implicit crosscheck backup<\/span> at 09-FEB-15\n\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=41 device type=DISK\nCrosschecked 9 objects\nFinished implicit crosscheck backup at 09-FEB-15\n\n<span style=\"color: blue; font-weight: bold;\">Starting implicit crosscheck copy<\/span> at 09-FEB-15\nusing channel ORA_DISK_1\nCrosschecked 2 objects\nFinished implicit crosscheck copy at 09-FEB-15<\/pre>\n\n\n\n<p><span style=\"color: blue;\">\u2014 Catalogues all the existing backups and archivelogs available on standby \u2014<\/span><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">searching for all files in the recovery area\n\ncataloging files...\n\ncataloging done\n\nList of Cataloged Files\n\n=======================<\/pre>\n\n\n\n<p><span style=\"color: blue;\">\u2014 Backups \u2014<\/span><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">File Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/autobackup\/2015_01_23\/o1_mf_s_869760430_bd492tm3_.bkp\nFile Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/autobackup\/2015_01_23\/o1_mf_s_869760892_bd4b06ws_.bkp\n...\nFile Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/autobackup\/2015_01_22\/o1_mf_s_869676552_bd1qongl_.bkp<\/pre>\n\n\n\n<p><span style=\"color: blue;\">\u2014 Archived logs \u2014<\/span><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">File Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/archivelog\/2015_02_06\/o1_mf_1_175_bf919zvx_.arc\nFile Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/archivelog\/2015_02_06\/o1_mf_1_172_bf8pvrhn_.arc\n...\n...\nFile Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/archivelog\/2015_01_21\/o1_mf_1_54_bcyn59o8_.arc\nFile Name: \/u01\/app\/oracle\/fast_recovery_area\/LONDON\/archivelog\/2015_01_21\/o1_mf_1_60_bczt9p7o_.arc<\/pre>\n\n\n\n<p><span style=\"color: blue;\">\u2014 Skips all the datafiles (5, 7, 8, 9, 10, 11) whose checkpoint_change# on standby match that of primary are skipped for restore operation \u2014<\/span><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">using channel ORA_DISK_1\nskipping <b>datafile 5<\/b>; already restored to SCN 1910129\nskipping <b>datafile 7<\/b>; already restored to SCN 1910129\nskipping <b>datafile 8<\/b>; already restored to SCN 3690127\nskipping <b>datafile 9<\/b>; already restored to SCN 3690127\nskipping <b>datafile 10<\/b>; already restored to SCN 3690127\nskipping <b>datafile 11<\/b>; already restored to SCN 3690127<\/pre>\n\n\n\n<p><span style=\"color: blue;\">\u2014 Restores multi-section compressed backupsets&nbsp;&nbsp;&nbsp; with section size of 100m of all the data files (1, 3, 4, 6) whose checkpoint_change# on standby is behind&nbsp; primary&nbsp; over network. \u2014<\/span><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">channel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\ndestination for <b>restore of datafile 00001<\/b>: \/u01\/app\/oracle\/oradata\/london\/system01.dbf\nchannel ORA_DISK_1: <span style=\"color: blue; font-weight: bold;\">restoring section 1<\/span> of 9\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:03\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\ndestination for restore of datafile 00001: \/u01\/app\/oracle\/oradata\/london\/system01.dbf\nchannel ORA_DISK_1: <span style=\"color: blue; font-weight: bold;\">restoring section 2<\/span> of 9\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:01\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\ndestination for restore of datafile 00001: \/u01\/app\/oracle\/oradata\/london\/system01.dbf\n...\n...\nchannel ORA_DISK_1: <span style=\"color: blue; font-weight: bold;\">restoring section 9<\/span> of 9\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:01\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\n\ndestination for <span style=\"color: blue; font-weight: bold;\">restore of datafile 00003<\/span>: \/u01\/app\/oracle\/oradata\/london\/sysaux01.dbf\nchannel ORA_DISK_1: <b>restoring section 1<\/b> of 10\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:03\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\ndestination for restore of datafile 00003: \/u01\/app\/oracle\/oradata\/london\/sysaux01.dbf\n...\n...\nchannel ORA_DISK_1: <b>restoring section 10<\/b> of 10\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:01\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\n\ndestination for <span style=\"color: blue; font-weight: bold;\">restore of datafile 00004<\/span>: \/u01\/app\/oracle\/oradata\/london\/undotbs01.dbf\nchannel ORA_DISK_1: <b>restoring section 1<\/b> of 3\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:01\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\n\ndestination for restore of datafile 00004: \/u01\/app\/oracle\/oradata\/london\/undotbs01.dbf\n...\n...\nchannel ORA_DISK_1: <b>restoring section 3<\/b> of 3\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:01\nchannel ORA_DISK_1: starting incremental datafile backup set restore\nchannel ORA_DISK_1: using compressed network backup set from service boston\n\ndestination for <span style=\"color: blue; font-weight: bold;\">restore of datafile 00006<\/span>: \/u01\/app\/oracle\/oradata\/london\/users01.dbf\nchannel ORA_DISK_1: <b>restoring section 1<\/b> of 1\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:01\n\nFinished recover at 09-FEB-15<\/pre>\n\n\n\n<p>As soon as standby is recovered, redo transport to far sync (bostonFS) and standby (london) is resumed.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BOSTON&gt;select max(sequence#) from v$archived_log;\nMAX(SEQUENCE#)\n--------------\n          <b>197<\/b>\n\nBOSTONFS&gt;select max(sequence#) from v$archived_log;\nMAX(SEQUENCE#)\n--------------\n          <b>197<\/b>\n\nLONDON&gt;select max(sequence#) from v$archived_log;\nMAX(SEQUENCE#)\n--------------\n          <b>197<\/b><\/pre>\n\n\n\n<p>The RECOVER \u2026 FROM SERVICE command refreshes the standby data files and rolls them forward to the same point-in-time as the primary. However, the standby control file still contains old SCN values which are lower than the SCN values in the standby data files. Therefore, to complete the synchronization of the physical standby database, we must refresh the standby control file to update the SCN#.<\/p>\n\n\n\n<p>Hence place the physical standby database in NOMOUNT mode and restore controlfile to standby by using the control file on the primary database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">LONDON&gt;SHUTDOWN IMMEDIATE;\nSTARTUP NOMOUNT;\n\nRMAN&gt; RESTORE STANDBY CONTROLFILE FROM SERVICE boston;\n\nStarting restore at 09-FEB-15\nusing target database control file instead of recovery catalog\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=22 device type=DISK\n\nchannel ORA_DISK_1: starting datafile backup set restore\nchannel ORA_DISK_1: using network backup set from service boston\nchannel ORA_DISK_1: restoring control file\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:07\noutput file name=\/u01\/app\/oracle\/oradata\/london\/control01.ctl\noutput file name=\/u01\/app\/oracle\/fast_recovery_area\/london\/control02.ctl\nFinished restore at 09-FEB-15<\/pre>\n\n\n\n<p>Mount the standby database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">LONDON&gt;ALTER DATABASE MOUNT;<\/pre>\n\n\n\n<p>Now the standby database has been rolled forward successfully as can be verified using DGMGRL.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DGMGRL&gt; show configuration;\nConfiguration - drsolution\n\n   Protection Mode: MaxPerformance\n   Databases:\n   boston&nbsp;&nbsp; - Primary database\n     bostonfs - Far Sync\n       london&nbsp;&nbsp; - Physical standby database\n       london2&nbsp; - Logical standby database (disabled)\n     londonfs - Far Sync (inactive)\n\nFast-Start Failover: DISABLED\n\nConfiguration Status:\nSUCCESS<\/pre>\n\n\n\n<p><b>Note<\/b>: If network resources are a constraint, then you can still use the Pre-12c BACKUP INCREMENTAL command to create incremental backups on the primary database, and then use the incremental backups to roll forward the physical standby database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion:<\/h2>\n\n\n\n<p>In case standby database lags behind the primary, it can be rolled forward using incremental backups from primary database. It is a faster alternative to copying archived logs from primary and applying them on standby database. When an archive log gap is unrecoverable &nbsp;this procedure is a much faster alternative to &nbsp;rebuilding the standby database. This &nbsp;used to be a long manual process till 11g. In 12c, datafiles from primary database can be restored over the network as backupset and they can be optionally compressed and encrypted as well.<\/p>\n\n\n\n<p><b>References:<\/b><\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/docs.oracle.com\/database\/121\/BRADV\/rcmadvre.htm#BRADV685\n<\/div><\/figure>\n\n\n\n<section id=\"faq\" class=\"faq-block my-5xl\">\n    <h2>FAQs:12c Dataguard : Recover from Service<\/h2>\n\n                        <h3 class=\"mt-4xl\">1. What is RECOVER FROM SERVICE in Oracle DataGuard?<\/h3>\n            <div class=\"faq-answer\">\n                <p>RECOVER&#8230;FROM SERVICE is an Oracle DataGuard command that rolls a physical standby database forward by fetching the missing archived redo logs directly from the primary database (or a registered service name) over the network, rather than requiring the logs to be shipped manually. It is an alternative to a full rebuild when the standby has only fallen partially behind. The command calculates the difference in SCN (System Change Number) between the primary and standby and fetches only the changes needed to bring the standby up to date.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">2. When should I use RECOVER FROM SERVICE instead of rebuilding the standby?<\/h3>\n            <div class=\"faq-answer\">\n                <p>Use RECOVER FROM SERVICE when the standby has fallen behind but the divergence is manageable &#8211; the primary&#8217;s archived logs are still available and the SCN gap is not too large to fetch over the network. Use a full rebuild (duplication from backup) when the standby is severely out of date, the required archived logs are no longer available on the primary, or the standby database has physical corruption that makes it unsuitable as a base for recovery. RECOVER FROM SERVICE is faster for moderate gaps; a full rebuild is more reliable for large or complex divergences.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">3. How do I identify which datafiles on the standby are out of sync with the primary?<\/h3>\n            <div class=\"faq-answer\">\n                <p>Query the V$DATAFILE view on both the primary and standby, comparing CHECKPOINT_CHANGE# values. Datafiles on the standby where CHECKPOINT_CHANGE# is lower than on the primary are out of sync. Query: SELECT file#, name, checkpoint_change# FROM v$datafile ORDER BY file#; Run this on both primary and standby and compare. The RECOVER FROM SERVICE command will identify and recover all out-of-sync datafiles automatically.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">4. What is the difference between a physical standby and a logical standby in Oracle DataGuard?<\/h3>\n            <div class=\"faq-answer\">\n                <p>A physical standby is a byte-for-byte copy of the primary database, maintained by applying redo log records. It is typically kept in MANAGED RECOVERY MODE (not open for user access, or open READ ONLY with Active DataGuard). A logical standby maintains the same data but potentially in a different physical form &#8211; it applies LogMiner-processed SQL to the standby, allowing it to have different indexes, additional objects, and to be fully open for queries. Physical standbys are simpler to manage and are the standard choice for high availability. Logical standbys are used for reporting scenarios requiring full read-write access.<\/p>\n            <\/div>\n            <\/section>\n","protected":false},"excerpt":{"rendered":"<p>Roll forward an Oracle 12c DataGuard physical standby database that has fallen behind the primary using the RECOVER&#8230;FROM SERVICE command. Covers simulating archived log loss, identifying out-of-sync datafiles, and the recovery procedure.&hellip;<\/p>\n","protected":false},"author":316217,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":true,"footnotes":""},"categories":[143533],"tags":[48459,48472,48486,4598,48514],"coauthors":[48555],"class_list":["post-73175","post","type-post","status-publish","format-standard","hentry","category-oracle-databases","tag-oracle-data-guard","tag-physical-standby","tag-recover-command","tag-recovery","tag-standby"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/73175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/316217"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=73175"}],"version-history":[{"count":4,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/73175\/revisions"}],"predecessor-version":[{"id":109819,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/73175\/revisions\/109819"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=73175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=73175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=73175"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=73175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}