My Oracle Support Banner

ORA-2056 on program using ONE-PHASE COMMIT optimization after upgrade to 11.2 (Doc ID 1497360.1)

Last updated on AUGUST 04, 2018

Applies to:

Oracle Server - Enterprise Edition - Version to [Release 10.2 to 11.2]
Information in this document applies to any platform.

The following sample program reports an ORA-02056: 2PC: k2lcom: bad two-phase command number rdonly from coord after the database was upgraded form to


#include "xa.h"

extern struct xa_switch_t xaosw;

#define XA_OPEN (xaosw.xa_open_entry)
#define XA_CLOSE (xaosw.xa_close_entry)
#define XA_START (xaosw.xa_start_entry)
#define XA_END (xaosw.xa_end_entry)
#define XA_ROLLBACK (xaosw.xa_rollback_entry)
#define XA_PREPARE (xaosw.xa_prepare_entry)
#define XA_COMMIT (xaosw.xa_commit_entry)
#define XA_RECOVER (xaosw.xa_recover_entry)
#define XA_FORGET (xaosw.xa_forget_entry)
#define XA_COMPLETE (xaosw.xa_complete_entry)

static XID xidx1 = { 1, 8, 4, "Ora11gXA0001"};
static XID *xid1 = &xidx1;
static XID xidx2 = { 1, 8, 4, "Ora11gXA0002" };
static XID *xid2 = &xidx2;

int main(int argc, char *argv[])
int rmid = 1; // resource manager identifier
//char *openStrFmtDef = "Oracle_XA+Acc=P/hr/hr+SesTm=60+SqlNet=STRM112A+LogDir=./";
//char *openStrFmtDef = "Oracle_XA+Acc=P/%s/%s+SesTm=60+SqlNet=%s+LogDir=./";
char *openStrFmtDef = "Oracle_XA+Acc=P/hr/hr+SesTm=60+SqlNet=inst1+LogDir=./";
char openStr[2048];
int number;

sprintf(openStr, openStrFmtDef, argv[1], argv[2], argv[3]);

int err = XA_OPEN(openStr, rmid, TMNOFLAGS);

// scanf("%d", &number);

err = XA_START(xid1, rmid, TMNOFLAGS);
err = XA_END(xid1, rmid, TMSUCCESS);

err = XA_START(xid2, rmid, TMNOFLAGS);
err = XA_COMMIT(xid1, rmid, TMONEPHASE);

if (err != 0)
err = XA_END(xid2, rmid, TMSUCCESS);
err = XA_ROLLBACK(xid2, rmid, TMONEPHASE);

return 0;

The same code ran without any errors in 10.2


ORA-02056: 2PC: k2lcom: bad two-phase command number rdonly from coord


 Database was upgraded form to


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.