Peter Ondruška <[email protected]> writes:
> Dear all,
>
> I have a database that has locks in SYSCS_DIAG.LOCK_TABLE. How do I
> remove those locks? I restarted the database but the locks are still
> there. SYSCS_DIAG.TRANSACTION_TABLE also has related record with
> status PREPARED. This database was used with XA on application server
> but it was removed for troubleshooting.
Hi Peter,
You probably need to run XA recovery and commit or roll back the
prepared transactions. Something like this:
XADataSource ds = ....;
XAConnection xac = ds.getXAConnection();
XAResource xar = xac.getXAResource();
for (Xid xid : xar.recover(XAResource.TMSTARTRSCAN)) {
xar.rollback(xid);
// or, if you prefer, xar.commit(xid, false);
}
Hope this helps,
--
Knut Anders