通过sid查找sql
程序员文章站
2022-03-15 15:52:55
...
这是当前运行的sql语句 select sid, v$session.username 用户名, last_call_et 持续时间, status 状态, LOCKWAIT 等待锁, machine 用户电脑名, logon_time 开始登入时间, sql_text from v$session, v$process, v$sqlarea where paddr = addr and sql_hash_value = hash_value and status = 'ACTIVE' and v$session.username is not null order by last_call_et desc; ------------------------------------------------------------------------------------ 根据sid查询已经执行过的sql select sql_text from v$sqlarea a,v$session b where a.SQL_ID=b.PREV_SQL_ID and b.SID=&sid; -------------------------------------------------------------------------------------- 根据sid查询当前执行的sql select sql_text from v$sqlarea where (hash_value,address)=(select sql_hash_value,sql_address from v$session where sid=&sid); ----------------------------------------------------------------------------------------- 查询oracle 锁表情况 select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ao.object_name, lo.locked_mode from v$locked_object lo, dba_objects ao, v$session sess where ao.object_id = lo.object_id and lo.session_id = sess.sid --------------------------------------------------------------------------------------------- 杀掉锁表的语句 如有記錄則表示有lock,記錄下SID和serial# ,將記錄的ID替換下面的738,1429,即可解除LOCK alter system kill session '1793,25320';
上一篇: oracle 索引未生效
下一篇: 让页面动起来的WOW.js