db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Locks on crashed database
Date Tue, 25 Nov 2014 11:49:09 GMT
Peter Ondruška <peter.ondruska@kaibo.eu> 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

Mime
View raw message