5个回答
2013-08-19
展开全部
在pl/sql Developer工具的的菜单“tools”里面的“sessions”可以查询现在存在的会话,但是我们很难找到那个会话被锁定了,想找到所以被锁的会话就更难了,下面这叫查询语句可以查询出所以被锁的会话。如下:
SELECT sn.username, m.SID,sn.SERIAL#, m.TYPE,
DECODE (m.lmode,
0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
lmode, LTRIM (TO_CHAR (lmode, '990'))
) lmode,
DECODE (m.request,
0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
request, LTRIM (TO_CHAR (m.request, '990'))
) request,
m.id1, m.id2
FROM v$session sn, v$lock m
WHERE (sn.SID = m.SID AND m.request != 0) --存在锁请求,即被阻塞
OR ( sn.SID = m.SID --不存在锁请求,但是锁定的对象被其他会话请求锁定
AND m.request = 0
AND lmode != 4
AND (id1, id2) IN (
SELECT s.id1, s.id2
FROM v$lock s
WHERE request != 0 AND s.id1 = m.id1
AND s.id2 = m.id2)
)
ORDER BY id1, id2, m.request;
通过以上查询知道了sid和 SERIAL#就可以开杀了
alter system kill session 'sid,SERIAL#';
希望对你有所帮助。我也是不太懂,是在网上了解的。努力学习ing~~~
SELECT sn.username, m.SID,sn.SERIAL#, m.TYPE,
DECODE (m.lmode,
0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
lmode, LTRIM (TO_CHAR (lmode, '990'))
) lmode,
DECODE (m.request,
0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
request, LTRIM (TO_CHAR (m.request, '990'))
) request,
m.id1, m.id2
FROM v$session sn, v$lock m
WHERE (sn.SID = m.SID AND m.request != 0) --存在锁请求,即被阻塞
OR ( sn.SID = m.SID --不存在锁请求,但是锁定的对象被其他会话请求锁定
AND m.request = 0
AND lmode != 4
AND (id1, id2) IN (
SELECT s.id1, s.id2
FROM v$lock s
WHERE request != 0 AND s.id1 = m.id1
AND s.id2 = m.id2)
)
ORDER BY id1, id2, m.request;
通过以上查询知道了sid和 SERIAL#就可以开杀了
alter system kill session 'sid,SERIAL#';
希望对你有所帮助。我也是不太懂,是在网上了解的。努力学习ing~~~
2013-08-19
展开全部
最简单的办法就是重新启动数据库。如果不能重新启动,可以通过控制台登陆数据库,然后通过绘画找到加锁的进程,直接将其结束。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-19
展开全部
SET linesize 200
COLUMN sid format 999;
COLUMN b format 9;
COLUMN spid format 999999;
COLUMN object_type format a5
COLUMN object_name format a30;
COLUMN lock_type format a10;
COLUMN ctime format 99999
COLUMN username format a15
COLUMN machine format a20;
COLUMN MODULE format a20;
COLUMN action format a20;
SELECT v$session.SID, v$session.serial#, v$process.spid,
RTRIM (object_type) object_type,
RTRIM (owner) || '.' || object_name object_name,
DECODE (lmode,
0, 'None',
1, 'Null',
2, 'Row-S',
3, 'Row-X',
4, 'Share',
5, 'S/Row-X',
6, 'Exclusive',
'Unknown'
) lockmode,
DECODE (request,
0, 'None',
1, 'Null',
2, 'Row-S',
3, 'Row-X',
4, 'Share',
5, 'S/Row-X',
6, 'Exclusive',
'Unknown'
) requestmode,
ctime, BLOCK b, v$session.username, machine, module, action,
DECODE (a.TYPE,
'MR', 'Media Recovery',
'RT', 'Redo Thread',
'UN', 'User Name',
'TX', 'Transaction',
'TM', 'DML',
'UL', 'PL/SQL User Lock',
'DX', 'Distributed Xaction',
'CF', 'Control File',
'IS', 'Instance State',
'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
FROM (SELECT *
FROM v$lock) a,
all_objects,
v$session,
v$process
WHERE a.SID > 6
AND object_name <> 'OBJ$'
AND a.id1 = all_objects.object_id
AND a.SID = v$session.SID
AND v$process.addr = v$session.paddr;
COLUMN sid format 999;
COLUMN b format 9;
COLUMN spid format 999999;
COLUMN object_type format a5
COLUMN object_name format a30;
COLUMN lock_type format a10;
COLUMN ctime format 99999
COLUMN username format a15
COLUMN machine format a20;
COLUMN MODULE format a20;
COLUMN action format a20;
SELECT v$session.SID, v$session.serial#, v$process.spid,
RTRIM (object_type) object_type,
RTRIM (owner) || '.' || object_name object_name,
DECODE (lmode,
0, 'None',
1, 'Null',
2, 'Row-S',
3, 'Row-X',
4, 'Share',
5, 'S/Row-X',
6, 'Exclusive',
'Unknown'
) lockmode,
DECODE (request,
0, 'None',
1, 'Null',
2, 'Row-S',
3, 'Row-X',
4, 'Share',
5, 'S/Row-X',
6, 'Exclusive',
'Unknown'
) requestmode,
ctime, BLOCK b, v$session.username, machine, module, action,
DECODE (a.TYPE,
'MR', 'Media Recovery',
'RT', 'Redo Thread',
'UN', 'User Name',
'TX', 'Transaction',
'TM', 'DML',
'UL', 'PL/SQL User Lock',
'DX', 'Distributed Xaction',
'CF', 'Control File',
'IS', 'Instance State',
'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
FROM (SELECT *
FROM v$lock) a,
all_objects,
v$session,
v$process
WHERE a.SID > 6
AND object_name <> 'OBJ$'
AND a.id1 = all_objects.object_id
AND a.SID = v$session.SID
AND v$process.addr = v$session.paddr;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-19
展开全部
oracle数据库实例 被锁啊,还是数据库对象被锁,最简单的就是
sysdba登陆 然后shutdown immediate 再启动 startup force ;
过程如下
sqlplus "/ as sysdba"
shutdown immediate ;
startup force ;
sysdba登陆 然后shutdown immediate 再启动 startup force ;
过程如下
sqlplus "/ as sysdba"
shutdown immediate ;
startup force ;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
ORACLE数据库被勒索病毒DEVIL加密修复教程
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询