zoukankan      html  css  js  c++  java
  • oracle查看表锁及解锁

    --kill session语句
    1
    alter system kill SESSION '2171,60490';
    --以下几个为相关表
    1
    2
    3
    4
    5
    6
    7
    SELECT * FROM v$lock;
    SELECT * FROM v$sqlarea;
    SELECT * FROM v$session;
    SELECT * FROM v$process ;
    SELECT * FROM v$locked_object;
    SELECT * FROM all_objects;
    SELECT * FROM v$session_wait;
    --1.查出锁定object的session的信息以及被锁定的object名
    1
    2
    3
    4
    5
    6
    SELECT l.session_id sid, s.serial#, l.locked_mode,l.oracle_username,
    l.os_user_name,s.machine, s.terminal, o.object_name, s.logon_time
    FROM v$locked_object l, all_objects o, v$session s
    WHERE l.object_id = o.object_id
    AND l.session_id = s.sid
    ORDER BY sid, s.serial# ;
    --2.查出锁定表的session的sid, serial#,os_user_name, machine name, terminal和执行的语句
    --比上面那段多出sql_text和action
    1
    2
    3
    4
    5
    6
    SELECT l.session_id sid, s.serial#, l.locked_mode, l.oracle_username, s.user#,
    l.os_user_name,s.machine, s.terminal,a.sql_text, a.action
    FROM v$sqlarea a,v$session s, v$locked_object l
    WHERE l.session_id = s.sid
    AND s.prev_sql_addr = a.address
    ORDER BY sid, s.serial#;
    --3.查出锁定表的sid, serial#,os_user_name, machine_name, terminal,锁的type,mode
    1
    2
    3
    4
    5
    6
    SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine,
    s.terminal, s.logon_time, l.type
    FROM v$session s, v$lock l
    WHERE s.sid = l.sid
    AND s.username IS NOT NULL
    ORDER BY sid;
    --4.查看链接数
    1
    select count(*) from v$session;




  • 相关阅读:
    SpringData JPA接口总结
    使用allatori混淆代码
    Oracle查看表空间大小
    Mac常用命令
    Web.config或App.config下section
    ansi、unicode、UCS、UTF等概念(转)
    强名称程序集与GAC
    指针和引用的区别(转)
    .NET程序员应该知道些什么(转)
    dispose,null和close的区别
  • 原文地址:https://www.cnblogs.com/juforg/p/3255950.html
Copyright © 2011-2022 走看看