
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)*60,2) minutes
from v$log_history a,v$log_history b where a.recid=b.recid+1 and
b.first_time > sysdate - 1
order by a.first_time desc) test) y where y.rn < 30
--求回滚段正在处理的事务
select a.name,b.xacts,c.sid,c.serial#,d.sql_text
from v$rollname a,v$rollstat b,v$session c,v$sqltext
d,v$transaction e
where a.usn=b.usn and b.usn=e.xidusn and c.taddr=e.addr
and c.sql_address=d.address and c.sql_hash_value=d.hash_value order
by a.name,c.sid,d.piece;
--求出无效的对象
select 'alter procedure '||object_name||' compile;'
from dba_objects
where status='INVALID' and wner='&' and object_type in
('PACKAGE','PACKAGE BODY');
/
select owner,object_name,object_type,status from dba_objects where
status='INVALID';
--求 process/session 的状态
select p.pid,p.spid,s.program,s.sid,s.serial#
from v$process p,v$session s where s.paddr=p.addr;
--求当前 session 的状态
select sn.name,ms.value
from v$mystat ms,v$statname sn
where ms.statistic#=sn.statistic# and ms.value > 0;
--求表的索引信息
select ui.table_name,ui.index_name
from user_indexes ui,user_ind_columns uic
where ui.table_name=uic.table_name and
ui.index_name=uic.index_name
and ui.table_name like '&table_name%' and
uic.column_name='&column_name';
评论