views:

153

answers:

3

So I'm going in and adding TAF (cluster failover) processing to some database code, and I'm winding up with similar chunks of code that look like this:

        try:
            ... some database code...
        except cx_Oracle.DatabaseError,e:
            # ORA-25401: can not continue fetches
            # ORA-25402: transaction must roll back
            # ORA-25408: can not safely replay call
            if e.message.code in (25401,25402,25408):
                print 'node going down, restarting transaction...'
                conn.rollback()
                continue
            else:
                raise(e)
  1. Are there any places where I can grab some symbolic names for these codes?
  2. Are there any sources of logical return code groupings? i.e. these are the ones related to transaction failure due to a node going down, and if retried will be redirected to another node and executed successfuly.

update: it turns out the answers are No and No.

A: 

To translate Oracle error codes one by one, try http://www.ora-code.com/ or http://www.dba-oracle.com/oracle_news/2004_11_10_easy_lookup_error_codes.htm

Michael Petrotta
+1  A: 

Hi Mark,

did you check http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/errors.htm ? there is a list of predefined exception that you can use. Next to that you can define user exceptions that tie a logical name to an error code.

Grouping of the errors is AFAIK not possible.

I hope this helps, Ronald

ik_zelf
A: 

Sure you can, on Oracle linux/unix installations you can use oerr utility. On windows there are some alternatives (1, 2) -not sure if they are the same- .

References:

FerranB