How to view the Oracle database lock and unlock
- -- View database lock details
- SelectA. sid, B. serial #, B. username, B. oSUSEr, B. machine, B. program, c. object_name, d. spid,
- Decode (a. type,
- 'Mr','Media recovery',
- 'Rt','Redo thread',
- 'Non','User name',
- 'Tx','Transaction',
- 'TT','Dml',
- 'Ul','Pl/SQL user lock',
- 'Dx','Stributed xaction',
- 'Cf','Control file',
- 'Is','Instance status',
- 'Fs','File set',
- 'Ir','Instance recovery',
- 'St','Disk space transaction',
- 'Ts','Temp segment',
- 'Iv','Library cache invalida-tion',
- 'LS','Log start or switch',
- 'Rw','Row wait',
- 'Sq','Sequence number',
- 'Te','Extend table',
- 'TT','Temp table',
- 'Unknown') Locktype,
- Decode (a. lmode,
- 0,'None',
- 1,'Null',
- 2,'Row-S',
- 3,'Row-x',
- 4,'Share',
- 5,'S/row-x',
- 6,'Exclusion','Unknown') Lockmode
- FromV $ lock a, v $ session B, all_objects c, v $ process d
- WhereA. sid = B. sid
- AndA. typeIn('TT','Tx')
- AndC. object_id = a. id1
- AndB. paddr = d. addr;
- -- Kill the process
- -- Alter system kill session 'sid, serial #';