Вопрос

All. We have an Oracle RAC cluster installation and we are using TAF to test the RAC failover on SELECT. We use OCI driver instant client version 11.2, and RAC with 2 replica nodes.

We tried a simple OCI based application written in C to connect to our DB and retrieve all the records from a table. Everything works fine if we do not include a CLOB column in the SELECT.

If we perform a SELECT on a CLOB column and we iterate over the result-set to print its content, the OCI driver seems not to be able to properly recover the query when a node goes down.

The following error code is consistently raised:

ORA-25408: can not safely replay call

during either OCILobLocatorIsInit / OCILobGetLength / OCILobRead.

After this error, the iteration on OCIStmtFetch resumes but the record that got the failover exception is not resumed.

Is this the expected behavior of the OCI driver failover implementation? Or do we need to modify/enhance the way we are retrieving the buffer data from the CLOB?

This is an snipped of the OCI calls we are using:

checkerr(errhp, 
   OCIStmtExecute(svchp, stmthp, errhp, (ub4)1, (ub4)0, 
                  (OCISnapshot*)NULL, (OCISnapshot*)NULL, (ub4)OCI_DEFAULT), 
   __LINE__);

do { 
   checkerr(errhp, 
      OCILobLocatorIsInit((dvoid*)envhp, errhp, lobl, &flag), 
      __LINE__); 

   checkerr(errhp, 
      OCILobGetLength(svchp, errhp, lobl, &loblen), 
      __LINE__); 

   amtp = loblen;

   checkerr(errhp, 
      OCILobRead(svchp, errhp, lobl, &amtp, 1, (dvoid*)buf, 
                (loblen < MAX_SIZE ? loblen : MAX_SIZE), 0, 0, 0, SQLCS_IMPLICIT),
      __LINE__); 

   buf[amtp]='\0';   
   printf("value=%d, text=%s\n", custno, buf); 
} while (
    (status = OCIStmtFetch(stmthp, errhp, (ub4)1, (ub4)OCI_FETCH_NEXT, (ub4)OCI_DEFAULT)) == OCI_SUCCESS || 
    status == OCI_SUCCESS_WITH_INFO);

The typical program output is similar to:

value = 306, text=ID_#306
value = 307, text=ID_#307
Error - ORA-25408: can not safely replay call
value = 308, text=
value = 309, text=ID_#309

Many thanks,

Luca.

Это было полезно?

Решение

This is expected behaviour. Failover does not work if a LOB column is part of the select list.

You may need to re-run the query manually in this case (see documentation)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top