RE: Detecting Controlfile Type

From: Jeremiah Wilton <jeremiah_at_ora-600.net>
Date: Mon, 9 Feb 2009 22:23:11 -0800
Message-ID: <03a201c98b48$0c80e5d0$2582b170$_at_net>



Ahbaid,

I strongly suspect you would be able to work out how to tell a standby controlfile from a normal controlfile using tools like dd and od. With some study of controlf traces and od output, I think you could figure it out. The problem with this approach is that you are assuming Oracle will not change the location, format or value of this flag in future versions and in different platforms.

The easiest solution to your problem is to simply use 'startup' on any database you are trying to start up. A primary will (hopefully) make it all the way open. A standby will fail to open with " ORA-16004: backup database requires recovery" and remain in mount mode, ready for recovery.

If this lacks the elegance you seek, how about you startup mount any database, then:

select controlfile_type from v$database;

If it is CURRENT, then 'alter database open;' If it is STANDBY, then start recovery.

Regards,

Jeremiah Wilton
Blue Gecko, Inc.
http://www.bluegecko.net

Ahbaid Gaffoor wrote:

> thanks for the feedback, what I'm trying to do is write a controlling
> script for all of my dbs, and I was wondering how would I get the
> standbys started?
>
> On a primary I usually do a "STARTUP" but on a standby I do:
>
> STARTUP NOMOUNT;
> ALTER DATABASE MOUNT STANDBY DATABASE;
>
> ... then start the managed recovery processes, etc.
>
> the problem here is that I'd like to know the controlfile type to
> figure
> out which set of mount commands to use....

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Feb 10 2009 - 00:23:11 CST

Original text of this message