TAF simulation [message #145013] |
Mon, 31 October 2005 04:43 |
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 #145154 is a reply to message #145013] |
Tue, 01 November 2005 06:38 |
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 |
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 #145317 is a reply to message #145240] |
Wed, 02 November 2005 07:50 |
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 |
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 #148737 is a reply to message #148383] |
Sun, 27 November 2005 10:28 |
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 #180191 is a reply to message #180010] |
Fri, 30 June 2006 09:43 |
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 |
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 |
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
|
|
|