<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DBAPundits.com &#187; Standby/Data Guard</title>
	<atom:link href="http://www.dbapundits.com/blog/category/standby-data-guard/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dbapundits.com/blog</link>
	<description>Articles and resources for the DBAs.</description>
	<lastBuildDate>Wed, 23 Nov 2011 03:22:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Standby roll forward using RMAN incremental backup</title>
		<link>http://www.dbapundits.com/blog/step-by-step/standby-roll-forward-using-rman-incremental-backup/</link>
		<comments>http://www.dbapundits.com/blog/step-by-step/standby-roll-forward-using-rman-incremental-backup/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 00:34:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Standby/Data Guard]]></category>
		<category><![CDATA[Step-by-step]]></category>

		<guid isPermaLink="false">http://www.dbapundits.com/blog/?p=361</guid>
		<description><![CDATA[<script type="text/javascript"><!--
google_ad_client = "pub-9448554670318827";
google_alternate_color = "FFFFFF";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "image";
google_ad_channel ="Pundits";
google_color_border = "FFFFFF";
google_color_link = "0022C9";
google_color_bg = "FFFFFF";
google_color_text = "000000";
google_color_url = "128A00";
google_ui_features = "rc:0";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><p>Last week I came across a scenario where a standby database went out of synch with the primary and there was a big gap of archive logs to be applied. Instead of rebuilding the standby database from scratch or restoring and applying a zillion archives, we can make use of a feature available from the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I came across a scenario where a standby database went out of synch with the primary and there was a big gap of archive logs to be applied. Instead of rebuilding the standby database from scratch or restoring and applying a zillion archives, we can make use of a feature available from the version 10.2 onwards called the standby roll forward that uses RMAN incremental backup to apply the changes on the standby.</p>
<p>For databases on non-ASM, it should work with the first 4 steps as indicated below. For databases on ASM, we need to perform some more steps. </p>
<p>To keep it simple, I have outlined the steps below and have attached the logs for reference. </p>
<p>1) Identify the last SCN on the Standby, take the minimum value returned by the below queries for further steps.</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
col current_scn for 99999999999999999999999
col int_scn for 99999999999999999999999

select current_scn FROM V$DATABASE;
select min(fhscn) int_scn from x$kcvfh;  

CURRENT_SCN
-----------------
47987632
</pre>
<p>2) Take an incremental backup on the primary database from this SCN to the current point.<br />
The incremental backup files will be generated on the filesystem under the directory “/ora001/backup/” in the example.<br />
Need to make sure that there is sufficient space in the filesystem to hold the backup. In this case, the backup files sized nearly 1.2G.</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt; CONFIGURE CHANNEL c1 DEVICE TYPE DISK FORMAT   '/ora001/backup/std_%U';
RMAN&gt; BACKUP INCREMENTAL FROM SCN 47987632 DATABASE;
</pre>
<p>3) SCP the backup files to the server where the standby database is running and catalog the backup.</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt; CATALOG START WITH '/ora001/backup/std_%U';
</pre>
<p>This makes the controlfile aware of the incremental backup.</p>
<p>4) Recover the standby database.</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt;
RECOVER DATABASE NOREDO;
</pre>
<p>5) Check the archive gap and the SCN to see if the DB has applied the changes. </p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
col CURRENT_SCN for 99999999999999999999999
select * from v$archive_gap;
select current_scn from v$database;
</pre>
<p>The standby is in good shape if the SCN returned is a bigger value and there are no gaps.</p>
<p>&#8212;- Steps above should be sufficient for non-ASM databases; continue the steps below for databases on ASM. &#8212;-<br />
(It was found that the SCN was not as expected and the steps below were done)</p>
<p>5) Cancel the database recovery at the standby site.</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
</pre>
<p>6) Take the controlfile backup again on primary database and SCP it over to the standby server.</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt;
BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/ora001/ctrl_bkp.bak';
</pre>
<p>7) Take pfile, controlfile backups and note the current controlfile location on the standby and shutdown the standby database.</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
select name  from v$controlfile;
shut immediate;
startup nomount;
</pre>
<p>8) Restore the standby controlfile created in step 6 on the standby site.</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt;
RESTORE STANDBY CONTROLFILE FROM '/ora001/ctrl_bkp.bak';
sql 'alter database mount';
</pre>
<p>9) At this point, the controlfiles on the standby database will have the datafiles pointed to the locations on primary. This needs to be updated so that they point to the right datafiles.</p>
<p>(For eg: On primary, it would be something like ‘+DATA01_R5/prod’ and on standby, the structure will be something like  ‘+DATA01_R5/stby’)</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt;
CATALOG START WITH '+DATA01_R5/stby';
</pre>
<p>(May need to repeat this if there are files in multiple diskgroups)</p>
<p>10) Imp: If there are datafiles created on the primary database after the last SCN on standby (the one on step 1), we’ll need to backup the datafile(s), catalog the backup, do the restore of those file(s) too. The files can be identified with the below SQL:</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
SELECT FILE#, NAME FROM V$DATAFILE WHERE CREATION_CHANGE# &gt; 47987632;
</pre>
<p>11) Perform the switch so that the controlfile points to the datafiles under the standby directory.</p>
<pre class="brush: sql; title: ; notranslate">
RMAN&gt;
SWITCH DATABASE TO COPY;
</pre>
<p>12) Clear redo log groups on the standby.</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; ALTER DATABASE CLEAR LOGFILE GROUP 1;
SQL&gt; ALTER DATABASE CLEAR LOGFILE GROUP 2;
SQL&gt; ALTER DATABASE CLEAR LOGFILE GROUP 3;
</pre>
<p>13) Check the SCN on the standby and start the managed recovery. The SCN should be number much higher than that was on step 1 and there shouldn’t be no archive gaps.</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt;
select current_scn from v$database;
select * from v$archive_gap;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
</pre>
<p>14) Do a couple of log switches on the primary and verify from the alert log that the standby is catching up with the primary.</p>
<p>15) Verify the standby redologs and other settings as required depending on the configuration and make sure the standby is in good shape.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dbapundits.com%2Fblog%2Fstep-by-step%2Fstandby-roll-forward-using-rman-incremental-backup%2F&amp;title=Standby%20roll%20forward%20using%20RMAN%20incremental%20backup" id="wpa2a_2"><img src="http://www.dbapundits.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.dbapundits.com/blog/step-by-step/standby-roll-forward-using-rman-incremental-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data guard setup and configuration &#8211; quick reference</title>
		<link>http://www.dbapundits.com/blog/standby-data-guard/oracle-11g-dataguard-setup-and-configuration-quick-reference/</link>
		<comments>http://www.dbapundits.com/blog/standby-data-guard/oracle-11g-dataguard-setup-and-configuration-quick-reference/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 03:42:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Standby/Data Guard]]></category>
		<category><![CDATA[data protection]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dataguard]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[standby]]></category>

		<guid isPermaLink="false">http://www.dbapundits.com/blog/?p=150</guid>
		<description><![CDATA[<p>Quick reference to dataguard configuration for the DBAs. The table gives an easy reference on the main attributes of log_archive_dest_n parameter and gives quick concept on the setting. Also, the scenarios where standby redo logs are used to minimize data loss and also to enable real-time apply is discussed.</p> Configuration Performance Availability Protection Meaning and [...]]]></description>
			<content:encoded><![CDATA[<p>Quick reference to dataguard configuration for the DBAs. The table gives an easy reference on the main attributes of log_archive_dest_n parameter and gives quick concept on the setting. Also, the scenarios where standby redo logs are used to minimize data loss and also to enable real-time apply is discussed.</p>
<table style="font-size: 10pt; font-family: tahoma" border="1" cellspacing="0" cellpadding="0" width="614">
<tbody>
<tr>
<td width="92" valign="top"><strong>Configuration</strong></td>
<td width="101" valign="top"><strong>Performance</strong></td>
<td width="81" valign="top"><strong>Availability</strong></td>
<td width="89" valign="top"><strong>Protection</strong></td>
<td width="249" valign="top"><strong>Meaning and Remarks</strong></td>
</tr>
<tr>
<td width="92" valign="top">Standby redo logs</td>
<td width="101" valign="top">Not required, but recommended</td>
<td width="81" valign="top">Required</td>
<td width="89" valign="top">Required</td>
<td width="249" valign="top">Redo data from primary will be written to standby redo logs by LGWR process and real time apply can be enabled, LGWR/ARCH parameter can be set.</td>
</tr>
<tr>
<td width="92" valign="top">LGWR<br />
(Redo archival process)</td>
<td width="101" valign="top">Not required</td>
<td width="81" valign="top">Required</td>
<td width="89" valign="top">Required</td>
<td width="249" valign="top">Specifies the redo transport service uses LGWR to collect and transit redo data to standby.</td>
</tr>
<tr>
<td width="92" valign="top">ARCH<br />
(Redo archival process)</td>
<td width="101" valign="top">Possible</td>
<td width="81" valign="top">Not possible</td>
<td width="89" valign="top">Not possible</td>
<td width="249" valign="top">Specifies that redo transport services uses ARCn process to collect and transmit redo data to standby.</td>
</tr>
<tr>
<td width="92" valign="top">SYNC (Network transmission)</td>
<td width="101" valign="top">Not required</td>
<td width="81" valign="top">Required</td>
<td width="89" valign="top">Required</td>
<td width="249" valign="top">SYNC specifies <span class="font5">Network I/O</span><span class="font0"> to standby is synchronous, that means the LGWR process on primary will wait for </span><span class="font5">Network I/O</span><span class="font0"> to complete on the standby so that successful transfer of redo records to standby database is ensured.</span></td>
</tr>
<tr>
<td width="92" valign="top">ASYNC (Network transmission)</td>
<td width="101" valign="top">Can be set</td>
<td width="81" valign="top">Cannot be set</td>
<td width="89" valign="top">Cannot be set</td>
<td width="249" valign="top">ASYNC specifies the the LGWR will not wait for <span class="font5">Network I/O</span><span class="font0">  to complete and proceeds asynchronously. Not valid if ARCH parameter is used</span></td>
</tr>
<tr>
<td width="92" valign="top">AFFIRM<br />
(Disk Writes)</td>
<td width="101" valign="top">Not required</td>
<td width="81" valign="top">Required</td>
<td width="89" valign="top">Required</td>
<td width="249" valign="top">Specifies that <span class="font5">disk I/O</span><span class="font0"> to archived redo logs and standby redo logs on the standby are done </span><span class="font5">synchronously</span><span class="font0"> and the LGWR process on primary will wait to continue its processing.</span></td>
</tr>
<tr>
<td width="92" valign="top">NOAFFIRM (Disk Writes)</td>
<td width="101" valign="top">Can be set</td>
<td width="81" valign="top">Cannot be set</td>
<td width="89" valign="top">Cannot be set</td>
<td width="249" valign="top">Specifies that disk I/O to archived redo logs and standby redo logs on the standby is done <span class="font5">asynchronously</span><span class="font0"> and the LGWR process on primary will not wait to continue its processing.</span></td>
</tr>
</tbody>
</table>
<p> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dbapundits.com%2Fblog%2Fstandby-data-guard%2Foracle-11g-dataguard-setup-and-configuration-quick-reference%2F&amp;title=Data%20guard%20setup%20and%20configuration%20%26%238211%3B%20quick%20reference" id="wpa2a_4"><img src="http://www.dbapundits.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.dbapundits.com/blog/standby-data-guard/oracle-11g-dataguard-setup-and-configuration-quick-reference/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oracle 11g Standby database creation on Unix using RMAN Active database duplication.</title>
		<link>http://www.dbapundits.com/blog/standby-data-guard/oracle-11g-standby-creation-on-unix/</link>
		<comments>http://www.dbapundits.com/blog/standby-data-guard/oracle-11g-standby-creation-on-unix/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 13:33:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Standby/Data Guard]]></category>

		<guid isPermaLink="false">http://www.dbapundits.com/blog/?p=115</guid>
		<description><![CDATA[Step by Step <p> <p>1) Activate Force logging on the primary database</p> <p>In case of unlogged writes to primary database (NOLOGGING&#160; and DIRECT LOAD operations using SQL*Loader),&#160; redo data is not generated.&#160; As the redo required to synch the changes to the standby is not generated, the standby database will not be consistent with the [...]]]></description>
			<content:encoded><![CDATA[<h3>Step by Step</h3>
<p> 
<p><strong>1) Activate Force logging on the primary database</strong></p>
<p>In case of unlogged writes to primary database (NOLOGGING&nbsp; and DIRECT LOAD operations using SQL*Loader),&nbsp; redo data is not generated.&nbsp; As the redo required to synch the changes to the standby is not generated, the standby database will not be consistent with the primary.&nbsp; To prevent such issues, the primary database is forced to log operations. It may also be noted that it is recommended to take a backup of the database after UNRECOVERABLE/NOLOGGING operations as those operations are not recoverable as the redo data is not generated.Use the below command on the primary database to force logging on the database.</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter database force logging;
</pre>
<p> 
<p>This must be done before building the standby database.</p>
<p><strong>2) Prepare Initialization files for the primary and standby databases</strong></p>
<pre class="brush: plain; title: ; notranslate">

# Initialization file for primary database – initorcl.ora

*.audit_file_dest='/oracle/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.1.0.0.0'
*.control_files='/oradata/orcl/control01.ctl','/oradata/orcl/control02.ctl'
,'/oradata/orcl/control03.ctl'
*.db_block_size=8192
*.db_name='orcl'
*.diagnostic_dest='/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.log_archive_dest_1='LOCATION=/oradata/arch/orcl/'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=104857600
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=316669952
*.undo_tablespace='UNDOTBS1'

##### Standby related parameters ######## 

*.db_unique_name='orcl'
*.fal_client='ORCL'
*.fal_server='STBY'
*.DB_FILE_NAME_CONVERT=('/oradata/stby/','/oradata/orcl/')
*.LOG_FILE_NAME_CONVERT=('/oradata/stby/','/oradata/orcl/') *.log_archive_config='dg_config=(orcl,stby)'
*.log_archive_dest_2='SERVICE=STBY valid_for=online_logfiles,primary_role)'
*.log_archive_dest_state_2=enable
*.standby_file_management=auto

##### End Standby related parameters #######
</pre>
<pre class="brush: plain; title: ; notranslate">

# Initialization file for standby database - initstby.ora 

*.audit_file_dest='/oracle/app/oracle/admin/stby/adump'
*.audit_trail='db'
*.compatible='11.1.0.0.0'
*.control_files='/oradata/stby/control01.ctl','/oradata/stby/control02.ctl',
'/oradata/stby/control03.ctl'
*.db_block_size=8192
*.db_name='orcl'
*.diagnostic_dest='/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'
*.log_archive_dest_1='LOCATION=/oradata/arch/stby/'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=104857600
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=316669952
*.undo_tablespace='UNDOTBS1'

##### Standby related parameters#######

*.db_unique_name='stby'
*.log_archive_dest_2='SERVICE=ORCL valid_for=(online_logfile,primary_role)
*.DB_FILE_NAME_CONVERT=('/oradata/orcl/','/oradata/stby/')
*.LOG_FILE_NAME_CONVERT=('/oradata/orcl/','/oradata/stby/')
*.fal_server='ORCL'
*.fal_client='STBY'
*.log_archive_config='dg_config=(orcl,stby)'
*.standby_file_management=auto

##### End Standby related parameters #######
</pre>
<p> 
<p><strong>3) Configure Listener for Static service registration</strong></p>
<p>Static service registrations is requierd for the RMAN active database duplication to work.</p>
<pre class="brush: plain; title: ; notranslate">

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbapundits)(PORT = 1521))))  SID_LIST_LISTENER =
(
SID_LIST =
(SID_DESC = (ORACLE_HOME = /oracle/app/oracle/product/11.1.0) (SID_NAME = orcl))
(SID_DESC = (ORACLE_HOME = /oracle/app/oracle/product/11.1.0) (SID_NAME = stby))
)
</pre>
<p> <strong>4) Create service names in tnsnames.ora</strong><br />
Add tnsnames.ora entries for primary and standby databases.</p>
<pre class="brush: plain; title: ; notranslate">

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbapundits)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)))
STBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbapundits)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stby)))
</pre>
<p> 
<p><strong>5) Create password file for the standby database</strong></p>
<p>The easiest way to do this is to copy the password file from the primary database and to rename it in proper format on the standby server.</p>
<pre class="brush: bash; title: ; notranslate">
$ pwd
/oracle/app/oracle/product/11.1.0/dbs
$ cp orapworcl orapwstby 
</pre>
<p><strong>6) Perform Oracle 11g standby creation using RMAN DUPLICATE command</strong></p>
<pre class="brush: plain; title: ; notranslate">
run
{
duplicate target database for standby dorecover from active database;
}
</pre>
<p> 
<p>The primary database is duplicated as a standby database on the target server (or on same server in this case) using the datafiles from the active database. There is no need of a backup and the datafiles are copied over the network to the target server and is recovered to the point when the duplication was fired.</p>
<p><strong>7) Logs</strong></p>
<p><a href="http://www.dbapundits.com/blog/wp-content/uploads/2009/01/11g-standby-database-creation-with-rman-duplicate-command.txt">11g-standby-database-creation-with-rman-duplicate-command &#8211; log</a></p>
<p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dbapundits.com%2Fblog%2Fstandby-data-guard%2Foracle-11g-standby-creation-on-unix%2F&amp;title=Oracle%2011g%20Standby%20database%20creation%20on%20Unix%20using%20RMAN%20Active%20database%20duplication." id="wpa2a_6"><img src="http://www.dbapundits.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.dbapundits.com/blog/standby-data-guard/oracle-11g-standby-creation-on-unix/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

