<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Oracle Instructor</title>
	<atom:link href="http://uhesse.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://uhesse.wordpress.com</link>
	<description>Focus on Oracle Core Technology</description>
	<lastBuildDate>Sun, 29 Jan 2012 06:32:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='uhesse.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/b84180298f7f793d1504fa3912ccc5dd?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>The Oracle Instructor</title>
		<link>http://uhesse.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://uhesse.wordpress.com/osd.xml" title="The Oracle Instructor" />
	<atom:link rel='hub' href='http://uhesse.wordpress.com/?pushpress=hub'/>
		<item>
		<title>After Test-Failover, make NEW Primary Standby again</title>
		<link>http://uhesse.wordpress.com/2012/01/16/after-test-failover-make-new-primary-standby-again/</link>
		<comments>http://uhesse.wordpress.com/2012/01/16/after-test-failover-make-new-primary-standby-again/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 10:06:39 +0000</pubDate>
		<dc:creator>Uwe Hesse</dc:creator>
				<category><![CDATA[TOI]]></category>
		<category><![CDATA[Data Guard]]></category>
		<category><![CDATA[High Availability]]></category>
		<category><![CDATA[Snapshot Standby]]></category>

		<guid isPermaLink="false">http://uhesse.wordpress.com/?p=958</guid>
		<description><![CDATA[Maybe we want to test Failover, although the Primary is working fine. After the failover succeeded, we have an OLD Primary then and a NEW Primary. There is a well documented way to convert the OLD Primary into a Standby. This procedure is called Reinstate. This posting shows how to make the NEW Primary a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uhesse.wordpress.com&amp;blog=6195767&amp;post=958&amp;subd=uhesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Maybe we want to test Failover, although the Primary is working fine. After the failover succeeded, we have an OLD Primary then and a NEW Primary. There is a well documented <a href="http://docs.oracle.com/cd/E11882_01/server.112/e17023/sofo.htm#CHDEHEEF" target="_blank">way to convert the OLD Primary into a Standby</a>. This procedure is called <em>Reinstate</em>. This posting shows how to make the NEW Primary a Standby again. The OLD Primary will keep on running as Primary &#8211; with all productive users connected there still. A special case why we may want to do that is because we tested <a href="http://uhesse.wordpress.com/2012/01/14/failover-to-snapshot-standby/" target="_blank">Failover to a Snapshot Standby</a> that has no network connection to the Primary.</p>
<p>The initial configuration:</p>
<pre>DGMGRL&gt; <strong>show configuration</strong>

Configuration - myconf

  Protection Mode: MaxPerformance
  Databases:
    prima - Primary database
    physt - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS</pre>
<p style="text-align:justify;">The version is still 11.2.0.1 like in the previous posting. I will now failover to physt while prima keeps running. Attention: If there is a productive service started on the NEW Primary, make sure to stop it. Else new productive connections will access the NEW Primary! We will deliberately cause a <em>Split Brain</em> situation here with two Primary Databases. <strong>This may cause problems in a productive environment and is not recommended.</strong></p>
<pre>DGMGRL&gt; <strong>failover to physt;</strong>
Performing failover NOW, please wait...
<span style="color:#ff0000;">Error: ORA-16600: not connected to target standby database for failover</span>

Failed.
Unable to failover
DGMGRL&gt; exit
[oracle@uhesse ~]$ <strong>dgmgrl sys/oracle@physt</strong>
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL&gt; <strong>failover to physt;</strong>
Performing failover NOW, please wait...
<span style="color:#339966;">Failover succeeded, new primary is "physt"</span></pre>
<p>The <span style="color:#ff0000;">error above</span> shows that we cannot failover, connected to the (still working) Primary but must connect to the Standby first. Now there are two Primary Databases:</p>
<pre>[oracle@uhesse ~]$ <strong>sqlplus sys/oracle@physt as sysdba</strong>

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 16 10:25:51 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; <strong>select database_role from v$database;</strong>

DATABASE_ROLE
----------------
PRIMARY

SQL&gt; <strong>connect sys/oracle@prima as sysdba</strong>
Connected.
SQL&gt; <strong>select database_role from v$database;</strong>

DATABASE_ROLE
----------------
PRIMARY</pre>
<p>I want to make the NEW Primary a Standby again. Similar to a Reinstate, that needs Flashback Logs. My two Databases generate Flashback Logs, so that requirement is met.</p>
<pre>SQL&gt; <strong>connect sys/oracle@physt as sysdba</strong>
Connected.
SQL&gt; <strong>shutdown immediate</strong>
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL&gt; startup mount
ORACLE instance started.

Total System Global Area  313159680 bytes
Fixed Size            2212936 bytes
Variable Size          264244152 bytes
Database Buffers       41943040 bytes
Redo Buffers            4759552 bytes
Database mounted.
SQL&gt; <strong>flashback database to before resetlogs;</strong>

Flashback complete.

SQL&gt; <span style="color:#ff0000;"><strong>alter database convert to physical standby;</strong></span>

Database altered.</pre>
<p><span style="color:#ff0000;">This</span> modified the controlfile and puts the Instance in NOMOUNT. We need to restart into MOUNT:</p>
<pre>SQL&gt; <strong>shutdown immediate</strong>
ORA-01507: database not mounted

ORACLE instance shut down.
SQL&gt; <strong>startup mount</strong>
ORACLE instance started.

Total System Global Area  313159680 bytes
Fixed Size            2212936 bytes
Variable Size          264244152 bytes
Database Buffers       41943040 bytes
Redo Buffers            4759552 bytes
Database mounted.
SQL&gt; <strong>recover managed standby database using current logfile disconnect;</strong>
Media recovery complete.
SQL&gt; <strong>select status,sequence# from v$managed_standby where process='MRP0';</strong>

STATUS          SEQUENCE#
------------ ----------
<span style="color:#ff0000;">WAIT_FOR_LOG</span>         12</pre>
<p>We want to see here APPLYING LOG &#8211; the redo is not yet transmitted from the OLD Primary.</p>
<pre>SQL&gt; <strong>connect sys/oracle@prima as sysdba</strong>
Connected.
SQL&gt; <strong>select sequence# from v$log where status='CURRENT';</strong>

 SEQUENCE#
----------
    13

SQL&gt; <strong>alter system set log_archive_dest_2='service=physt db_unique_name=physt';</strong>

System altered.

SQL&gt; <strong>alter system set log_archive_dest_state_2=enable;</strong>

System altered.

SQL&gt; <strong>alter system switch logfile;</strong>

System altered.

SQL&gt; <strong>connect sys/oracle@physt as sysdba</strong>
Connected.
SQL&gt; <strong>select status,sequence# from v$managed_standby where process='MRP0';</strong>

STATUS          SEQUENCE#
------------ ----------
<span style="color:#ff0000;">APPLYING_LOG</span>         15</pre>
<p style="text-align:justify;">Everything is fine now on the Database Layer: OLD Primary is still Primary, NEW Primary is again Standby, applying Redo from the OLD Primary. Only the Data Guard Broker is confused now &#8211; we need to create a new configuration:</p>
<pre>[oracle@uhesse ~]$ <strong>dgmgrl sys/oracle@prima</strong>
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL&gt; <strong>show configuration;</strong>
ORA-16795: the standby database needs to be re-created

<span style="color:#ff0000;">Configuration details cannot be determined by DGMGRL</span>
[oracle@uhesse ~]$ <strong>sqlplus sys/oracle@physt as sysdba</strong>

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 16 10:46:13 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; <strong>alter system set dg_broker_start=false;</strong>

System altered.

SQL&gt; <strong>connect sys/oracle@prima as sysdba</strong>
Connected.
SQL&gt; <strong>alter system set dg_broker_start=false;</strong>

System altered.

SQL&gt; <strong>exit</strong>
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@uhesse ~]$ <strong>rm $ORACLE_HOME/dbs/dr*</strong></pre>
<p>The above deleted the Broker Config Files. Now we create a new Broker Configuration:</p>
<pre>[oracle@uhesse ~]$ <strong>sqlplus sys/oracle@physt as sysdba</strong>

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 16 10:48:22 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; <strong>alter system set dg_broker_start=true;</strong>

System altered.

SQL&gt; <strong>connect sys/oracle@prima as sysdba</strong>
Connected.
SQL&gt; <strong>alter system set dg_broker_start=true;</strong>

System altered.

[oracle@uhesse ~]$ <strong>dgmgrl sys/oracle@prima</strong>
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL&gt; <strong>create configuration mycon as primary database is prima connect identifier is prima;</strong>
Configuration "mycon" created with primary database "prima"
DGMGRL&gt; <strong>add database physt as connect identifier is physt maintained as physical;</strong>
Database "physt" added
DGMGRL&gt; <strong>enable configuration;</strong>
Enabled.
DGMGRL&gt; <strong>show configuration;</strong>

Configuration - mycon

  Protection Mode: MaxPerformance
  Databases:
    prima - Primary database
    physt - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS</pre>
<p>That was it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uhesse.wordpress.com/958/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uhesse.wordpress.com/958/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uhesse.wordpress.com/958/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uhesse.wordpress.com/958/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uhesse.wordpress.com/958/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uhesse.wordpress.com/958/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uhesse.wordpress.com/958/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uhesse.wordpress.com/958/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uhesse.wordpress.com&amp;blog=6195767&amp;post=958&amp;subd=uhesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uhesse.wordpress.com/2012/01/16/after-test-failover-make-new-primary-standby-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>48.139127 11.580186</georss:point>
		<geo:lat>48.139127</geo:lat>
		<geo:long>11.580186</geo:long>
		<media:content url="http://1.gravatar.com/avatar/73cdb20b4d2a2fa1f3c7b63f8d32b6b0?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Uwe Hesse</media:title>
		</media:content>
	</item>
	</channel>
</rss>
