• 时间:
  • 浏览:0
  • 来源:大发5分6合APP下载_大发5分6合APP官方

      本文转自glying 51CTO博客,原文链接:,如需转载请自行联系原作者


select /*+ rule */ lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username user_name, o.owner,o.object_name,s.sid,s.serial#

where event not like '%SQL%' and event not like '%rdbms%' and event not like '%mon%'

alter index &index_name monitoring usage;

o.partition_name, w.seconds_in_wait seconds, w.state

and c.sql_address=d.address and c.sql_hashvalue=d.hash_value order by,c.sid,d.piece;

col p3text format a12

user_cons_columns cp,user_cons_columns pc

select table_name,partition_name,HIGH_VALUE from user_tab_partitions where table_name='&table_name'

) x where x.p1= l.latch#);

rpad(pc.column_name,15,' ') referred_column,rpad(child.constraint_name,25,' ') constraint_name



where p.addr = s.paddr and p.addr = b.paddr



and o.owner <> 'sys' and w.sid = s.sid and w.p1 = o.file_id and w.p2 >= o.block_id and w.p2 < o.block_id + o.blocks

select table_name,constraint_name

from v$session s,v$session_event se

where child.constraint_type = 'R' and child.r_constraint_name = parent.constraint_name and


select value

from v$filestat fs,v$dbfile df

from user_indexes ui,user_ind_columns uic

select name,sum(gets),sum(misses),sum(sleeps),sum(wait_time)

--使用dbms_xplan生成一一一2个 执行计划

column pid new_value Smon


where a.statistic#=4 and b.statistic#=5;

col lock_level format a8

from v$session s,v$session_wait sw

where ui.table_name=uic.table_name and ui.index_name=uic.index_name

select ksppinm, ksppstvl

child.constraint_name = cp.constraint_name and parent.constraint_name = pc.constraint_name and

select start_recid,start_time,end_recid,end_time,minutes from (select test.*, rownum as rn

--求会话等待的图片 的对象


where w.event in (select name from v$event_name where parameter1 = 'file#'

where l.object_id=o.object_id and l.session_id=s.sid order by o.object_id,xidusn desc ;

where fs.file#=df.file# order by;

col ksppstvl format a54

from dba_extents

from dba_objects

col owner format a18

select o.OBJECT_TYPE, substr(o.OBJECT_NAME,1,10) objname , b.objd , b.status, count(b.objd)

select owner,segment_name,segment_type

from v$latch_children

from v$mystat ms,v$statname sn

select /*+ rule */ s.username, decode(l.type,'tm','table lock', 'tx','row lock', null) lock_level, o.owner,o.object_name,s.sid,s.serial#


from v$mystat m,v$statname s

from v$process p,v$session s where s.paddr=p.addr;

from v$process p, v$session s where p.addr = s.paddr and s.username is not null;

where constraint_type ='R' and constraint_name in (select constraint_name from user_cons_columns where column_name='&1');

where a.usn=b.usn and b.usn=e.xidusn and c.taddr=e.addr


select * from table(dbms_xplan.display);

from (select b.recid start_recid,to_char(b.first_time,'yyyy-mm-dd hh24:mi:ss') start_time,

select name,wait_time from v$latch l where exists (select 1 from (select sid,event,p1text, p1, p2text, p2, p3text, p3


select sid,event,p1text, p1, p2text, p2, p3text, p3

col ksppinm format a54


select 'alter procedure '||object_name||' compile;'

where ms.statistic#=sn.statistic# and ms.value > 0;

from v$locked_object l,dba_objects o,v$session s


--求会话等待的图片 的file_id/block_id

col segment_type format a32

--求回滚段正在出理 的事务

select b.value/(a.value + b.value),a.value,b.value from v$sysstat a,v$sysstat b

explain plan set statement_id = '&sql_id' for &sql;

from v$mystat, v$statname

select owner,object_name,object_type,status from dba_objects where status='INVALID';

from x$kcccp cp,x$kccle le

select * from v$object_usage where index_name = &index_name;

set termout on

from v$bh b, dba_objects o


where b.objd = o.data_object_id and o.owner = '&1' group by o.object_type, o.object_name,b.objd, b.status ;

col p2text format a12

cp.position = pc.position and child.table_name ='&table_name'

group by name having sum(gets) > 500 order by 2;

oradebug wakeup &Smon

alter index &index_name nomonitoring usage;

undefine Smon


order by a.first_time desc) test) y where y.rn < 500

--求等待的图片 中的对象

seconds_in_wait, wait_time

where status='INVALID' and wner='&' and object_type in ('PACKAGE','PACKAGE BODY');

select p.spid "OS Thread", "Name-User", s.program

col search_condition format a54

from user_constraints

from v$rollname a,v$rollstat b,v$session c,v$sqltext d,v$transaction e

col owner format a18

from v$session_wait

col program format a54



from v$session_wait w, v$session s, dba_extents o

where l.sid = s.sid and l.id1 = o.object_id(+) and s.username is not null ;

col username format a15

select ui.table_name,ui.index_name

select o.owner,o.object_type,o.object_name,count(b.objd)

from v$session_wait

col user_name format a32

where s.username is not null and se.sid=s.sid and s.status='ACTIVE' and se.event not like '%SQL*Net%' order by s.username;

where event not like '%SQL%' and event not like '%rdbms%' and event not like '%mon%' order by event;

select rpad(child.table_name,25,' ') child_tablename,

col high_value format a81

col table_name format a16

having count(b.objd) > (select to_number(value)*0.05 from v$parameter where name = 'db_block_buffers');




from v$log_history a,v$log_history b where a.recid=b.recid+1 and b.first_time > sysdate - 1

select s.sid,s.username,sw.event,sw.wait_time,sw.state,sw.seconds_in_wait

where s.username is not null and sw.sid=s.sid and sw.event not like '%SQL*Net%' order by s.username;


and ui.table_name like '&table_name%' and uic.column_name='&column_name';

from v$session s,v$lock l,dba_objects o


where file_id = &file_id and &block_id between block_id and block_id + blocks - 1;


select /*+rule */ s.sid, s.username, w.event, o.owner, o.segment_name, o.segment_type,

and parameter2 = 'block#' and name not like 'control%')

select sid, username, event, blocking_session,

where v$mystat.statistic# = v$statname.statistic# and v$ = 'redo size';


select p.spid "OS Thread", s.username "Name-User", s.program

col partition_name format a16


set termout off

from v$bh b,dba_objects o

col object_name format a32

from v$process p, v$session s, v$bgprocess b

rpad(cp.column_name,17,' ') referring_column,rpad(parent.table_name,25,' ') parent_tablename,

from user_constraints child,user_constraints parent,


col event format a24

where m.statistic#=s.statistic# and like '%redo size%';

where le.leseq =cp.cpodr_seq;

select le.leseq current_log_sequence#, 5000*cp.cpodr_bno/le.lesiz percentage_full

--求buffer cache中的块信息

--求等待的图片 的事件及会话信息/求会话的等待的图片 及会话信息

col segment_name format a32

a.recid end_recid,to_char(a.first_time,'yyyy-mm-dd hh24:mi:ss') end_time,round(((a.first_time-b.first_time)*24)*500,2) minutes

group by o.owner,o.object_type,o.object_name

where cv.indx=pi.indx and pi.ksppinm like '\_%' escape '\' and pi.ksppinm like '%meer%';

order by child.owner,child.table_name,child.constraint_name,cp.position;

col p1text format a12

from v$session where state in ('WAITING') and wait_class != 'Idle';


from x$ksppi pi, x$ksppcv cv

select se.sid,s.username,se.event,se.total_waits,se.time_waited,se.average_wait



select from sys.v_$bgprocess b,sys.v_$process p where = 'SMON' and p.addr = b.paddr

where b.objd = o.object_id