oracle查看被锁的表和被锁的进程以及杀掉这个进

编程学习 2021-07-05 16:08www.dzhlxh.cn编程入门
本节主要介绍了oracle如何查看被锁的表和被锁的进程以及杀掉这个进程,需要的朋友可以参考下

-- 1. 查看被锁的表

SELECT p.spid, a.serial#, c.object_name, b.session_id, b.oracle_username,b.os_user_name
FROM v$process p, v$session a, v$locked_object b, all_objects c
WHERE p.addr = a.paddr
AND a.process = b.process
AND c.object_id = b.object_id

-- 2. 查看是哪个进程锁的

SELECT sid, serial#, username, status, osuser FROM v$session where serial# = '5002'

SELECT sid, serial#, username, status, osuser FROM v$session where serial# = '3789'

-- 3. 杀掉这个进程

alter system kill session 'sid,serial#';
alter system kill session '269,3789';
alter system kill session '34,4661';
alter system kill session '265,5002';
alter system kill session '289,1688';
alter system kill session '282,5799';

Copyright © 2016-2025 www.dzhlxh.cn 金源码 版权所有 Power by

网站模板下载|网络推广|微博营销|seo优化|视频营销|网络营销|微信营销|网站建设|织梦模板|小程序模板