current position:Home>How to locate lock waiting in Dameng database

How to locate lock waiting in Dameng database

2022-06-24 09:33:17Fried beef steak with black pepper

Positioning lock waiting problem

View suspended transactions (TRX_ID)

SELECT VTW.ID AS TRX_ID, VS.SESS_ID ,VS.SQL_TEXT,VS.APPNAME ,VS.CLNT_IP FROM V T R X W A I T V T W L E F T J O I N V TRXWAIT VTW LEFT JOIN V TRXWAITVTWLEFTJOINVTRX VT ON
(VTW.ID=VT.ID) LEFT JOIN V$SESSIONS VS ON (VT.SESS_ID=VS.SESS_ID);

By suspending transactions ID(TRX_ID) Find the transaction it is waiting for (WAIT_FOR_ID).

SELECT WAIT_FOR_ID,WAIT_TIME FROM V$TRXWAIT WHERE ID=321646;

By waiting for transactions ID(WAIT_FOR_ID) Locate the connection and the executed statement

SELECT VT.ID AS TRX_ID,VS.SESS_ID,VS.SQL_TEXT ,VS.APPNAME,VS.CLNT_IP FROM
V T R X V T L E F T J O I N V TRX VT LEFT JOIN V TRXVTLEFTJOINVSESSIONS VS ON (VT.SESS_ID=VS.SESS_ID) WHERE
VT.ID = 321643;

SP_CLOSE_SESSION Close waiting transactions (SESS_ID)

SP_CLOSE_SESSION(142344256);

Another way to find lock waiting

select * from v t r x w a i t ; s e l e c t ∗ f r o m v trxwait; select * from v trxwait;selectfromvlock t where t.blocked =1;
select a.sess_id, a.sql_text, a.state, b.* from v s e s s i o n s a , v sessions a, v sessionsa,vtrxwait b
where a.trx_id = b.id;
select a.trx_id,a.* from v$sessions a;
commit;
select * from sys.sysobjects t where id= 1069;
sp_close_session(131853344); -- End a session

copyright notice
author[Fried beef steak with black pepper],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206240814374102.html

Random recommended