超时: 分布式事务处理等待锁

用户反馈登录系统时,一直在转圈,无法登录到系统,查看日志报错信息如下:

Caused by: org.hibernate.exception.SQLGrammarException: could not execute update query
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:87)
	at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:398)
	at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
	at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1142)
	at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
	at org.springframework.orm.hibernate3.HibernateTemplate$39.doInHibernate(HibernateTemplate.java:1155)
	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
	... 144 more
Caused by: java.sql.SQLSyntaxErrorException: ORA-02049: 超时: 分布式事务处理等待锁

	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:281)
	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
	at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)
	at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1008)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1307)
	at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
	at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3530)
	at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1350)
	at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:1162)
	at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:813)
	at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:78)
	... 150 more

查看锁的表

SELECT A.OBJECT_ID,
       B.OBJECT_NAME,
       A.SESSION_ID,
       A.ORACLE_USERNAME,
       A.OS_USER_NAME,
       A.PROCESS,
       A.LOCKED_MODE
  FROM V$LOCKED_OBJECT A, DBA_OBJECTS B
 WHERE A.OBJECT_ID = B.OBJECT_ID;

2、

SELECT T2.USERNAME, T2.SID, T2.SERIAL#, T2.LOGON_TIME
  FROM V$LOCKED_OBJECT T1, V$SESSION T2
 WHERE T1.SESSION_ID = T2.SID
 ORDER BY T2.LOGON_TIME;

3、
如有记录則表示有lock,记录下SID和serial# ,将记录的ID替换下面的738,1429,即可解除LOCK

alter system kill session '738,1429';

你可能感兴趣的:(oracle)