Oracle语句记录
SELECT b.sid oracleID, b.username 用户名, b.serial#, paddr, sql_text 正在执行的SQL, b.machine 计算机名称 FROM v$process a, v$session b, v$sqlarea c WHERE a.addr = b.paddr AND b.sql_hash_value = c.hash_value
ALTER system KILL SESSION '{ORACLEID},{SERIAL#}';
SELECT spid, osuser, s.program FROM v$session s, v$process p WHERE s.paddr=p.addr AND s.sid={ORACLEID};
-- pid: 获取到的spid $ kill -9 {pid}
select a.sid, a.serial#, a.paddr, a.machine, nvl(a.sql_id, a.prev_sql_id) sql_id, b.sql_text, b.sql_fulltext, b.executions, b.first_load_time, b.last_load_time, b.last_active_time, b.disk_reads, b.direct_writes, b.buffer_gets from v$session a, v$sql b where a.username = sys_context('USERENV', 'CURRENT_USER') and a.status = 'ACTIVE' and nvl(a.sql_id, a.prev_sql_id) = b.sql_id;
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#;
alter system kill session 'sid,serial#'
如果此篇文章有帮助到您, 希望打大佬们能关注、点赞、收藏、评论支持一波,非常感谢大家!
如果有不对的地方请指正!!!
参考1
参考2