--step 1:查看被阻塞会话等待事件 select sid, event, username, lockwait, sql.sql_text  from v$session s, v$sql sql where s.sql_id = sql.sql_id   and sql.sql_text like '%&sql%'; -------------------------------------------------------------------------    22    enq…
查看oracle的sql语句历史记录和锁表的情况 (2012-01-04 20:59:59) 转载▼ 标签: 杂谈 分类: database 查询sql的历史记录 select * from v$sqlarea t where t.PARSING_SCHEMA_NAME in ('用户名') order by t.LAST_ACTIVE_TIME descselect * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc 查看一段时间内的执行情况…
转载地址:https://blog.csdn.net/cicon/article/details/68068462##一.postgresql解决锁表--查询是否锁表了select oid from pg_class where relname='可能锁表了的表'select pid from pg_locks where relation='上面查出的oid'--如果查询到了结果,表示该表被锁 则需要释放锁定select pg_cancel_backend(上面查到的pid) 12345 二.…
1.问题发现 检查客户数据库的时候发现存在大量死锁的情况 Thread advanced to log sequence (LGWR switch) Current log# mem# : /oradata/oracle/online_log/redo16_01.log Current log# mem# : /oradata/oracle/online_log/redo16_02.log Tue Jul :: Archived Log entry added sequence ID : Tue…
--查询是否锁表了select oid from pg_class where relname='可能锁表了的表'select pid from pg_locks where relation='上面查出的oid'--如果查询到了结果,表示该表被锁 则需要释放锁定select pg_cancel_backend(上面查到的pid)…
  --首先查看有哪些锁 select /*+ rule */ s.username,       decode(l.type,'TM','TABLE LOCK','TX','ROW LOCK',null) lock_level,       o.owner,       o.object_name,       o.object_type,       s.sid,s.serial#,       s.terminal,       s.machine,       s.program,   …
1.查看历史运行纪录 select * from dba_jobs_running: 2查看锁住的sid和pid select s.sid,s.serial# fromv$session s where s.sid in (select sid from dba_jobs_running); 3. SELECT s.username, decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', NULL) LOCK_LEVEL, o.owner, o…
/* *locked *query locked object and analyse reason,kill it * */ select 'alter system kill session ''' || SID || ',' || SERIAL# || ''';' from (select distinct a.sid, a.Serial#, status, machine, LOCKWAIT, logon_time from v$session a, v$locked_object b…
最近系统每天经常锁表,进程杀死后,很快再次锁住这个表. (一)先贴出现场处理死锁的步骤. 另外:有时候通过PL/SQL执行kill session可能仍然无法解锁,此时需要登陆到Oracle服务器将进程kill掉才行. 1.生成Kill Session语句 select 'alter system kill session ''' || SID ||',' || SERIAL# || ''';' from ( select distinct a.sid, a.Serial#, status, m…
查询oracle用户名,机器名,锁表对象 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.ses…