Hello There !
I have recently Implemented Oracle 11gR2 RAC Two node environment in our organization.
Now I am confused about both this term.I dont understand what would I use for my TAF CALLBACK HIGHLY AVAIBILITY.
I have gone through documentation as well but still not cleared my concept.
here is bit part of my code !!
/**********************************************************************
* This method is FailOver Callback method called when the
* connection to the database is severed. It is called several
* times in the process of re-establishing connection to the
* same or standby database.
**********************************************************************/
public FailoverReturnCode OnFailover(object sender, OracleFailoverEventArgs eventArgs)
{
// check the Failover event that occurred and display appropriate message
switch(eventArgs.FailoverEvent)
{
// when failover begins
case FailoverEvent.Begin:
{
MessageBox.Show("Callback method called :Failover Begin");
lblStatus.Text="Callback method called :Failover Begin. Trying to reconnect, Please wait...";
break;
}
// when failover is aborted
case FailoverEvent.Abort:
{
MessageBox.Show("Callback method called :Failover Aborted");
lblStatus.Text="Callback method called :Failover Aborted";
break;
}
// when failover is complete
case FailoverEvent.End:
{
MessageBox.Show("Callback method called :Failover End");
// call method to set session information on re-established
// connection
alterSessionInfo();
lblStatus.Text="Callback method called :Failover End";
break;
}
//when error occurs while reconnecting
case FailoverEvent.Error:
{
lblStatus.Text="Failover Error -Sleeping and Retrying to connect to database. Please wait... ";
//check to do form Refresh only once
if(doRefresh==0)
this.Refresh();
doRefresh=1;
return FailoverReturnCode.Retry;
}
// when reautentication is required during Failover
case FailoverEvent.Reauth:
{
MessageBox.Show("Callback method called :Failover reauthenticating");
lblStatus.Text="Callback method called :Failover reauthenticating";
break;
}
default:
{
MessageBox.Show("Bad Failover");
lblStatus.Text="Bad Failover";
break;
}
}
return FailoverReturnCode.Success;
}
/*******************************************************************
* The purpose of this method is to get the database connection
* using the parameters given in ConnectionParams.cs.
* The connection parameter enlist is set to false for the TAF to
* work properly.
* Note: Replace the datasource parameter with your datasource value
* in ConnectionParams.cs file.
********************************************************************/
private Boolean getDBConnection()
{
try
{
lblStatus.Text="Connecting to database";
//Connection Information
string connectionString =
//username
"User Id=" + ConnectionParams.Username +
//password
";Password=" + ConnectionParams.Password +
//set enlist parameter to false. Required for TAF
";enlist=false" +
//replace with your datasource value (TNSnames)
";Data Source=" + ConnectionParams.Datasource;
//Connection to datasource, using connection parameters given above
conn = new OracleConnection(connectionString);
//Open database connection
conn.Open();
lblStatus.Text="Connected to the database. Click 'Get Products Data' to fetch products data ";
// alter date format for the session
this.alterSessionInfo();
conn.Failover += new OracleFailoverEventHandler(OnFailover);
return true;
}
// catch exception when error in connecting to database occurs
catch (Exception ex)
{
//Display error message
MessageBox.Show(ex.ToString());
return false;
}
}
Can anybody explain me more or send me link which give me whole idea about Failover vs HA in ODAC.
Many THanks !
Hemesh.