Re: Detecting Controlfile Type

  • From: Ahbaid Gaffoor <ahbaid@xxxxxxx>
  • To: Jeremiah Wilton <jeremiah@xxxxxxxxxxx>
  • Date: Tue, 10 Feb 2009 01:03:45 -0800

Thanks Jeremiah,

that's a very valid concern, Oracle being able to change the format at will could blow the script away unexpectedly.

I don't know why, but for some reason I always thought a standby needed to go from a NOMOUNT state to MOUNT via "ALTER DATABASE MOUNT STANDBY DATABASE"....

I verified that I could go to MOUNT via. "STARTUP MOUNT" directly and start MRP. Just shows you (read "me") can get stuck in your ways and not realise the obvious, Ha!

going to MOUNT and then querying V$DATABASE does the trick...

now should I go to bed (1am) or muck around with the script..... :)

thanks for the help

Ahbaid



Jeremiah Wilton wrote:
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....




--
//www.freelists.org/webpage/oracle-l


Other related posts: