监控Oracle系统中锁的常用脚本Oracle认证考试

文章作者 100test 发表时间 2009:10:30 16:59:43
来源 100Test.Com百考试题网


"libai">

  1. 用于检查系统中锁的简单脚本

  0select s.username, s.sid, l.type, l.id1, l.id2, l.lmode, l.request, p.spid PID

  from v$lock l, v$session s, v$process p

  where s.sid = l.sid

  and p.addr = s.paddr

  and s.username is not null

  order by id1, s.sid, request.

  2. 显示数据库锁的信息

  set pagesize 60

  set linesize 132

  0select s.username username, a.sid sid, a.owner || . || a.object object, s.lockwait,

  t.sql_text sql

  from v$sqltext t, v$session s, v$access a

  where t.address = s.sql_address

  and t.hash_value = s.sql_hash_value

  and s.sid = a.sid

  and a.owner != SYS

  and upper(substr(a.object,1,2)) != V$.

  /

  3. 产生在数据库中持有的锁的报表

  0select b.sid, c.username, c.osuser, c.terminal,

  decode(b.id2, 0, a.object_name, Trans- || to_char(b.id1)) object_name,

  b.type,

  decode(b.lmode, 0, -Waiting-,

  1, Null,

  2, Row Share,

  3, Row Excl,

  4, Share,

  5, Sha Row Exc,

  6, Exclusive, Other) "Lock Mode",

  decode(b.request, 0, ,

  1, Null,

  2, Row Share,

  3, Row Excl,

  4, Share,

  5, Sha Row Exc,

  6, Exclusive, Other) "Req Mode"

  from dba_objects a, v$lock b, v$session c

  where a.object_id( ) = b.id1

  and b.sid = c.sid

  and c.username is not null

  order by b.sid, b.id2.

  4. 产生等待锁的用户的报告

  column username format a15

  column sid format 9990 heading sid

  column type format a4

  column lmode format 990 heading HELD

  column request format 990 heading REQ

  column id1 format 9999990

  column id2 format 9999990

  break on id1 skip 1 dup

  spool tfslckwt.lst

  0select sn.username, m.sid, m.type,

  decode(m.lmode, 0, None,

  1, Null,

  2, Row Share,

  3, Row Excl.,

  4, Share,

  5, S/Row Excl.

  6, Exclusive,

  lmode, ltrim(to_char(lmode, 990))) lmode,

  decode(m.request, 0, None,


相关文章


oracle认证辅导:查看oracle执行计划Oracle认证考试
oracleform触发器执行顺序及键定义Oracle认证考试
oracle与sql的区别(常用函数)Oracle认证考试
10G技术文档中对MODLE的描述Oracle认证考试
监控Oracle系统中锁的常用脚本Oracle认证考试
Oracle认证辅导:OracleCache表Oracle认证考试
ORACLE索引聚簇表的数据加载Oracle认证考试
Oracle认证辅导:Oracle数据库体系架构概要Oracle认证考试
ibatis调用oracle的动态sqlOracle认证考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛