Home » Server Options » RAC & Failsafe » TAF simulation
TAF simulation [message #145013] Mon, 31 October 2005 04:43 Go to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
Hi all,

I got a RAC with two nodes. I would like to know how I can simulate TAF.

So far I’ve used srvctl to stop an instance on one node and see if the client application’s connections would fail over to the other node. But client application failed saying “end of communication channel” or “immediate shutdown in progress - no operations are permitted”. ( Client application continuously goes on inserting records while all this happen. )
I’ve also tried disabling the VIP on one node (I’m using Red Hat Linux ES 3). But that also didn’t work.

So how do I simulate TAF what are the ways to make a instance go down so that it will simulate a TAF.
Thank you!

Below is the connection identifier from tnsnames.ora



CLUS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racvip3)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racvip2)(PORT = 1521))
(LOAD_BALANCE = yes)
(FAILOVER = on)
)
(CONNECT_DATA =
(SERVICE_NAME = clus.tbx.net)
(FAILOVER_MODE =
(TYPE = session)
(METHOD = basic)
)
)
)

Re: TAF simulation [message #145035 is a reply to message #145013] Mon, 31 October 2005 08:36 Go to previous messageGo to next message
Frank Naude
Messages: 4570
Registered: April 1998
Senior Member
Your application may not be TAF compliant. Try your tests with sqlplus to see if it's working or not.

Best regards.

Frank
Re: TAF simulation [message #145154 is a reply to message #145013] Tue, 01 November 2005 06:38 Go to previous messageGo to next message
eldar52
Messages: 14
Registered: October 2005
Junior Member
1) OCI applicatios supports TAF
JDBC thin,PROC does not support TAF
2) If you are performing a continuous insert then even application that supports TAF will not fail transparently.You should to perform a rollback if failure occured in the middle of transaction.

By the way you can simulate failure by simple shutdown abort or even kill -9 of pmon.
Re: TAF simulation [message #145158 is a reply to message #145013] Tue, 01 November 2005 06:55 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
this is the test java program i use. not much complex, maybe you will see something i don't

Connection con;
Statement st;
try
{
OracleDataSource ord = new OracleDataSource();
ord.setConnectionCachingEnabled(true);
ord.setURL("jdbc:oracle:oci:@clus");
ord.setPassword("test");
ord.setUser("test");

con = ord.getConnection();

for(;;){

st = con.createStatement();
String sql = "insert into jtab values('aaa',"+i+")";
i++;
st.executeUpdate(sql);
st.close();
Thread.sleep(2000);

}


connection is never closed so it's pretty much gurantee that a connection exist.

SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER, COUNT(*) FROM V$SESSION GROUPBY MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER;

query shows that a conenction does exist and it's failover method and etc.

why is it not failing over.
ord.setURL("jdbc:oracle:oci:@clus"); the conenction descriptiong is given in a previous posting.
thank you for your comments and help
Re: TAF simulation [message #145161 is a reply to message #145158] Tue, 01 November 2005 07:03 Go to previous messageGo to next message
eldar52
Messages: 14
Registered: October 2005
Junior Member
What is the ORA- you get inside java exception?
Re: TAF simulation [message #145240 is a reply to message #145013] Tue, 01 November 2005 21:27 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
ORA-03113: end-of-file on communication channel
Re: TAF simulation [message #145317 is a reply to message #145240] Wed, 02 November 2005 07:50 Go to previous messageGo to next message
eldar52
Messages: 14
Registered: October 2005
Junior Member
Have tested the same scenario using simple sqlplus.

Just connect, check to what instance you are connected, perform a select and shutdown the instance you are connected to.
Try to perform the same select

Eldar
Re: TAF simulation [message #148283 is a reply to message #145013] Wed, 23 November 2005 07:09 Go to previous messageGo to next message
regli_dominik@gmx.ch
Messages: 1
Registered: November 2005
Junior Member
Hi I have a very similar problem.
I've written a java program that performs select statements on a table.
---
for (;;) {
try {
rSet = sqlStmt.executeQuery("select * from TEST");
while (rSet.next()) {
System.out.println("TEXT: " + rSet.getString("TEXT"));
}
} catch (SQLException ex) {ex.printStackTrace();}
//sleep here a little
}
---

After a failover, I get an "ORA-03113: end-of-file on communication channel" SQLException. The second time the query is executed, I get an "Closed Connection" SQLException.

But if I do the same thing in SQL*Plus the behaviour after a failover is different. Executing the query a first time produces an ORA-03113 error, but executing the query a second works fine:
---
SQL> select * from test;

select * from failover_test
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel

SQL> select * from test;
[values]
87 rows selected.
---

Why do I get a "Closed Connection" SQLException in java? I think the connection should be reestablished automaticelly.

Best wishes
Dominik
Re: TAF simulation [message #148383 is a reply to message #148283] Wed, 23 November 2005 21:22 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
hi,

when i ran my code too there were times where a connection wasn't established in a single run. had to run the program couple of times before connection was established.
have no idea why!!

hope the oracle experts can help on this Smile
Re: TAF simulation [message #148590 is a reply to message #148283] Fri, 25 November 2005 04:06 Go to previous messageGo to next message
Frank Naude
Messages: 4570
Registered: April 1998
Senior Member
What JDBC driver are you using?

Remember: TAF is only supported if you connect with the OCI driver.

Best regards.

Frank
Re: TAF simulation [message #148591 is a reply to message #148590] Fri, 25 November 2005 04:10 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
hi
i'm using oci

ord.setURL("jdbc:oracle:oci:@clus");

thanks
Re: TAF simulation [message #148606 is a reply to message #148591] Fri, 25 November 2005 04:57 Go to previous messageGo to next message
Frank Naude
Messages: 4570
Registered: April 1998
Senior Member
Please look at this URL - http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/9i_jdbc/OCIdriverTAFSample/Readme.html

If they do something differently, please let us know.

Best regards.

Frank
Re: TAF simulation [message #148737 is a reply to message #148383] Sun, 27 November 2005 10:28 Go to previous messageGo to next message
eldar52
Messages: 14
Registered: October 2005
Junior Member
What is the version of oracle client you are using - OCI driver uses C libs of oracle and in this case the version of client is important.

Re: TAF simulation [message #148749 is a reply to message #148737] Sun, 27 November 2005 21:17 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
Hi Frank,
Thanks for that link. It has lot of useful info.
Re: TAF simulation [message #148750 is a reply to message #145013] Sun, 27 November 2005 21:18 Go to previous messageGo to next message
asangapradeep
Messages: 128
Registered: October 2005
Location: UK
Senior Member
database is 10gR1 so is the client
Re: TAF simulation [message #180010 is a reply to message #145013] Thu, 29 June 2006 16:01 Go to previous messageGo to next message
poconojohnny
Messages: 4
Registered: June 2006
Location: Dallas / Fort Worth, TX
Junior Member

Can you help me understand the implications of the application side not performing a rollback? (Via callback function?)

I'm concerned about data integrity in the DB for the Standby, from my understanding and readings the rollback is for the application tier, not the database tier. Or is this dependent upon the frequency in which the logs are rolled?

I'm about to add TAF to the current Data Guard environment, Oracle 9.2.0.6, AIX 5.2, and EMC SAN. Oracle 10 client will reside on the application tier.

I believe I understand that the inflight transactions are lost and therefore up to the application to rollback incomplete transactions.

Please help me understand if my assumption is correct:

- implies the application checks the success/failure of the transaction
- the application will (attempt to) reconnect to the Standby database when it becomes Primary
- the application attempts the transaction which failed and was rolled back

John
Re: TAF simulation [message #180191 is a reply to message #180010] Fri, 30 June 2006 09:43 Go to previous messageGo to next message
eldar52
Messages: 14
Registered: October 2005
Junior Member
You are right: rollback should be performed by application.
In case of failure all active transactions will fail and it is an application part to catch the oracle exceptions and to perform rollback or reconnect.

Regarding your case with implementing TAF on DataGuard and not on RAC , there is no Transparent Failover at all, you can use TAF entry if you wish but in case of failure you should perform a reconnect from your application even if you are in the middle of the select.
Re: TAF simulation [message #180196 is a reply to message #180191] Fri, 30 June 2006 11:14 Go to previous messageGo to next message
poconojohnny
Messages: 4
Registered: June 2006
Location: Dallas / Fort Worth, TX
Junior Member

eldar52 wrote on Fri, 30 June 2006 09:43


....
Regarding your case with implementing TAF on DataGuard and not on RAC , there is no Transparent Failover at all, you can use TAF entry if you wish but in case of failure you should perform a reconnect from your application even if you are in the middle of the select.



(With Oracle 9.2.0.6, Data Guard, 2 AIX 5.2 servers, TAF)

The need to reconnect from the application is a little fuzzy now.

(To clarify what I meant by reconnect, I meant via the tnsnames entries and TAF, no changes to the application code to reconnect.)

My understanding was with appropriate entries in tnsnames:

- First,the Primary database or AIX server fails

- The active transactions on the Primary fail, the application
must catch and handle failure after the Standby is placed
in read/write via switchover. Or the number of retries may
cause it to fail until a Primary is available via switchover

- The application doesn't need to reconnect due to the tnsnames
entries for the Standby database, with Data Guard having the
Standby in a read-only state until a switchover is performed

- To place the Standby to read/write a manual switchover
in the Data Guard sense must be performed

- SELECTS would continue to work via TAF & tnsname entries
and not require a reconnect regardless of whether the Standby
has been made Primary yet

Is this not how the process or steps would occur with a Primary failure?

My objective is to keep the site up and accessable in at least a read-only mode so users may browse the data until a Switchover can occur at which time read/write returns.

On a related note, would OEM permit automatic switchover?

Thanks for your help.

John

[Updated on: Fri, 30 June 2006 11:16]

Report message to a moderator

Re: TAF simulation [message #180247 is a reply to message #180196] Sat, 01 July 2006 11:05 Go to previous message
eldar52
Messages: 14
Registered: October 2005
Junior Member
1) Actually i do not think that you can fully avoid application changes in your configuration.
In case of failure of primary standby you should perform a failover procedure.
Failover procedure is not a switchover : you should manually copy not copied redo logs/archive files , apply them, stop apply and start working as a primary .
All this operations are time consuming that means:
a) All active transactions in any case will fail with an error "you transaction must rollback".
You can catch this error , perform rollback or just reconnect
b) Active selects probably you want them to fail before all the data is applied on the standby database and role transition has been completed.
My point is that if you want to browse consistent and updated data wait for role transition.
That is why we have inside TAF - entry for database role "primary"
You do not want in case of some temporary network problem with a primary site all connections are directed to the standby database before a real role transition took place.

2) Regarding automatic role transition as far as i know this option is available in 10g only.(Implemented with flash back database)


Michael
Previous Topic: RAC performance
Next Topic: Moving a database to clustered enviroment.
Goto Forum:
  


Current Time: Wed Dec 08 14:00:02 CST 2021