Oracle.DataAccess.dll Failover Event

J

James Still

I'm working on a DAC wrapper around ODP.NET 9.2.0.4 and ran into a
problem with Oracle's "Transparent Application Failover" (TAF)
implementation. The data provider never seems to raise the Failover
event.

I've written a console app that loops until you tell it to stop. It
calls a connection helper like this:

OracleConnection conn = new OracleConnection(connectionString);
conn.Open();
// register failover handler
conn.Failover += new OracleFailoverEventHandler(OnFailover);

// create the command
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select sysdate, userenv('SESSIONID') as sid from
dual";
cmd.CommandType = CommandType.Text;

// execute reader and write to console
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) {
string sysdate = ((DateTime)oDr["SYSDATE"]).ToLongTimeString();
string sid = dr["sid"].ToString();
Console.WriteLine(sysdate + " on session " sid);
}
dr.Close();
conn.Close();

The event is caught in:

public FailoverReturnCode OnFailover(object sender,
OracleFailoverEventArgs e) {
// do something
}

The test writes out the date just fine on each loop. So then with my
admin tool I execute "ALTER SYSTEM KILL SESSION {args}" where "args"
is SID and Serial# of the app's connection. Then on the next loop I
expect ODP.NET to raise the Failover event for the killed connection.
But instead it raises OracleException 28 (session has been killed).
(It then increases the pool size accordingly; 5 by default unless you
overload the connection string.)

I've spent several hours simulating various connection errors (like
3113 by disconnecting from the LAN) and never does ODP.NET raise the
Failover event. Does anyone know more about this or conducted similar
tests?
 
L

Lyndon Hills

I'm working on a DAC wrapper around ODP.NET 9.2.0.4 and ran into a
problem with Oracle's "Transparent Application Failover" (TAF)
implementation. The data provider never seems to raise the Failover
event.

I've written a console app that loops until you tell it to stop. It
calls a connection helper like this:

OracleConnection conn = new OracleConnection(connectionString);
conn.Open();
// register failover handler
conn.Failover += new OracleFailoverEventHandler(OnFailover);

// create the command
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select sysdate, userenv('SESSIONID') as sid from
dual";
cmd.CommandType = CommandType.Text;

// execute reader and write to console
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) {
string sysdate = ((DateTime)oDr["SYSDATE"]).ToLongTimeString();
string sid = dr["sid"].ToString();
Console.WriteLine(sysdate + " on session " sid);
}
dr.Close();
conn.Close();

The event is caught in:

public FailoverReturnCode OnFailover(object sender,
OracleFailoverEventArgs e) {
// do something
}

The test writes out the date just fine on each loop. So then with my
admin tool I execute "ALTER SYSTEM KILL SESSION {args}" where "args"
is SID and Serial# of the app's connection. Then on the next loop I
expect ODP.NET to raise the Failover event for the killed connection.
But instead it raises OracleException 28 (session has been killed).
(It then increases the pool size accordingly; 5 by default unless you
overload the connection string.)

I've spent several hours simulating various connection errors (like
3113 by disconnecting from the LAN) and never does ODP.NET raise the
Failover event. Does anyone know more about this or conducted similar
tests?
I can't help with this, but may I suggest that you post this in the
ODP.NET forum, on Oracle's technet at www.otn.oracle.com. There are
some very helpful Oracle folk that actively participate in the forum.
By this I mean that they will take sample code that demonstrates a
problem, and then they will post back their results.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top