Oacle 잠 금 조회
3415 단어 Oacle
, , Oracle :
Sql
select t2.username,
t2.sid,
t2.serial#,
t3.object_name,
t2.OSUSER,
t2.MACHINE,
t2.PROGRAM,
t2.LOGON_TIME,
t2.COMMAND,
t2.LOCKWAIT,
t2.SADDR,
t2.PADDR,
t2.TADDR,
t2.SQL_ADDRESS,
t1.LOCKED_MODE
from v$locked_object t1, v$session t2, dba_objects t3
where t1.session_id = t2.sid
and t1.object_id = t3.object_id
order by t2.logon_time;
, SQL Oracle , v$locked_object、v$session、dba_objects:
v$locked_object session 。
v$session session 。
dba_objects oracle , 。
v$locked_object LOCKED_MODE ,oracle :
0:none
1:null
2:Row-S (RS): ,sub share
3:Row-X (RX): ,sub exclusive
4:Share (S): DML ,share
5:S/Row-X (SRX): ,share/sub exclusive
6:exclusive (X): ,exclusive
, 。
1 :Select, v$locked_object 。
2 :Select for update,Lock For Update,Lock Row Share
select for update for update , (Row-X) , , update、delete select for update 。
3 :Insert, Update, Delete, Lock Row Exclusive
commit , 3 3 , 。
4 :Create Index, Lock Share
locked_mode 2,3,4 DML(insert,delete,update,select) , DDL(alter,drop ) ora-00054 。
00054, 00000, "resource busy and acquire with NOWAIT specified"
// *Cause: Resource interested is busy.
// *Action: Retry if necessary.
5 :Lock Share Row Exclusive
update / delete ... ; 4,5 。
6 :Alter table, Drop table, Drop Index, Truncate table, Lock Exclusive
oracle :
-- session sql , .
SELECT /*+ ORDERED */
sql_text
FROM v$sqltext a
WHERE (a.hash_value, a.address) IN
(SELECT DECODE(sql_hash_value, 0, prev_hash_value, sql_hash_value),
DECODE(sql_hash_value, 0, prev_sql_addr, sql_address)
FROM v$session b
WHERE b.sid = '233') /* 233 SID*/
ORDER BY piece ASC;
-- .
select * from v$process ;
--
select * from v$lock;
--
select * from v$locked_object
--
select * from v$transaction
-- session
select v.* from v$session v where machine='xxx' and username='xxx' and status='INACTIVE' order by last_call_et desc
-- dba_objects
select * from dba_objects
where object_id = '14977'
--
select t2.username,t2.sid,t2.serial#,t3.object_name,t2.OSUSER,t2.MACHINE,t2.PROGRAM,t2.COMMAND,t2.LAST_CALL_ET
from v$locked_object t1,v$session t2 ,dba_objects t3
where t1.session_id=t2.sid and t1.object_id = t3.object_id
order by t2.logon_time;
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
자바 작업 은 Clob 또는 NClob 데이터 형식의 저장 프로 세 스 인 스 턴 스 를 포함 합 니 다.텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.