RE: Detecting Controlfile Type
Date: Mon, 9 Feb 2009 22:23:11 -0800
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.
Blue Gecko, Inc.
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
> out which set of mount commands to use....