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?
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?