Display Locks and Gives the SID and Serial Number of the session to kill
2012-01-12 22:16
513 查看
This script displays locks and gives the SID and Serial Number of the session to kill.
REM ------------------------------------------------------------------------
REM PURPOSE:
REM The report generated by this script gives information on sessions
REM which are holding locks and gives the information needed to kill
REM using the ALTER SYSTEM KILL SESSION command.
REM ------------------------------------------------------------------------
REM Main text of script follows:
set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'Kill String' format a13
column res heading 'Resource Type' format 999
column id1 format 9999990
column id2 format 9999990
column lmode heading 'Lock Held' format a20
column request heading 'Lock Requested' format a20
column serial# format 99999
column username format a10 heading "Username"
column terminal heading Term format a6
column tab format a35 heading "Table Name"
column owner format a9
column Address format a18
select nvl(S.USERNAME,'Internal') username,
nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||'.'||substr(T1.NAME,1,20) tab,
decode(L.LMODE,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request
from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2)
and U1.USER# = T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5
/
For example:
Username Term Kill String Table Name Lock Held Lock Requested
---------- ------ ------------- ----------------------------------- -------------------- --------------------
HONCHO pts/1 159,7 SYS.I_LOBCOMPPART_LOBJPA Exclusive
HONCHO.TEST3 Row Exclusive
HONCHO pts/2 152,27 HONCHO.TEST3 Row Exclusive
SYS.I_LOBCOMPPART_LOBJPA Exclusive
REM ------------------------------------------------------------------------
REM PURPOSE:
REM The report generated by this script gives information on sessions
REM which are holding locks and gives the information needed to kill
REM using the ALTER SYSTEM KILL SESSION command.
REM ------------------------------------------------------------------------
REM Main text of script follows:
set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'Kill String' format a13
column res heading 'Resource Type' format 999
column id1 format 9999990
column id2 format 9999990
column lmode heading 'Lock Held' format a20
column request heading 'Lock Requested' format a20
column serial# format 99999
column username format a10 heading "Username"
column terminal heading Term format a6
column tab format a35 heading "Table Name"
column owner format a9
column Address format a18
select nvl(S.USERNAME,'Internal') username,
nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||'.'||substr(T1.NAME,1,20) tab,
decode(L.LMODE,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request
from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2)
and U1.USER# = T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5
/
For example:
Username Term Kill String Table Name Lock Held Lock Requested
---------- ------ ------------- ----------------------------------- -------------------- --------------------
HONCHO pts/1 159,7 SYS.I_LOBCOMPPART_LOBJPA Exclusive
HONCHO.TEST3 Row Exclusive
HONCHO pts/2 152,27 HONCHO.TEST3 Row Exclusive
SYS.I_LOBCOMPPART_LOBJPA Exclusive
相关文章推荐
- Row index must be greater than or equal to zero and less than the number of rows.
- We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
- [Nuxt] Add Arrays of Data to the Vuex Store and Display Them in Vue.js Templates
- making 11 connections and the number of simultaneous builds has been throttled to 10
- sql: Query to Display Foreign Key Relationships and Name of the Constraint for Each Table in Database
- how to check port number and kill process with the port number
- python int to binary and count the number of 1
- Counting the active session number and tune up concurrent performance of MapGuide/AIMS
- How to Calculate the Number of IOPS and Throughput of a Database (文档 ID 2206831.1)
- [Grid Layout] Use auto-fill and auto-fit if the number of repeated grid tracks is not to be def
- 87.You want to display the date for the first Mon day of the next month and
- The maximum number of cell styles was exceeded. You can define up to 4000 styles
- failed to sync branch You might need to open a shell and debug the state of this repo.
- 【原创】The solutional manual of the Verilog HDL: A Guide to Digital Design and Synthesis (2nd)--ch12
- The minimum number of elements to reach the end of an array
- CXF报错[1 counts of IllegalAnnotationExceptions]and[Two classes have the same XML type name]and[Use @XmlType.name and @XmlType.namespace to assign different names to them]
- No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
- Maximum number of things to show on the main page"
- How to fix the problem of " Session Lost "
- How to choose the SIZE and HASHKEYS of hash cluster table?