码迷,mamicode.com
首页 > 数据库 > 详细

oracle问题处理sql

时间:2018-12-27 20:24:26      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:name   .so   odi   解释   不同的   问题处理   machine   and   datapump   

select * from DBA_HIST_SYSMETRIC_SUMMARY;
select sum(inserts) inserts, sum(UPDATES) UPDATES, sum(DELETES) DELETES from dba_tab_modifications where TABLE_OWNER=‘ZXJPT‘;
desc dba_tab_modifications;


SELECT *
FROM (SELECT *
FROM V$SYSTEM_EVENT
WHERE EVENT NOT LIKE ‘SQL%‘
ORDER BY TOTAL_WAITS DESC)
WHERE ROWNUM <= 5;
desc BJ_LOCKSALEORDER;
select name from v$database;

select * from dba_users

select sql_id from v$session a where a.STATUS=‘ACTIVE‘ and a.LAST_CALL_ET>1 and a.username is not null

select * from dba_datapump_sessions

select * from v$sql where sql_id in (select sql_id from v$session a where a.STATUS=‘ACTIVE‘ and a.LAST_CALL_ET>1 and a.username is not null)

 

---tx锁
select last_call_et,v.event,
s.sql_id,
s.SQL_FULLTEXT,
s.SQL_TEXT,
v.USERNAME,
s.CPU_TIME,
s.ELAPSED_TIME,
v.PROGRAM,
‘kill -9 ‘ || p.spid,
v.CLIENT_INFO,
v.SQL_HASH_VALUE,
v.SQL_ADDRESS,
v.MACHINE,
v.TERMINAL,
‘alter system kill session ‘‘‘ || v.sid || ‘,‘ || v.serial# || ‘‘‘ immediate;‘,
s.DISK_READS,s.BUFFER_GETS,s.SORTS,s.SHARABLE_MEM,s.PERSISTENT_MEM,s.RUNTIME_MEM,s.ROWS_PROCESSED
from v$session v, v$process p, v$sql s
where v.last_call_et > 1
and v.status = ‘ACTIVE‘
and v.username != ‘SYS‘
and p.addr = v.paddr
and s.ADDRESS = v.SQL_ADDRESS
and s.HASH_VALUE = v.SQL_HASH_VALUE
order by last_call_et desc;

select segment_name,status from dba_rollback_segs;--???OFFLINE

select s.sid blocker,
s.event hevent,
w.event wevent,
w.sid blocked
from v$session s, v$session w
where w.blocking_session = s.sid
and w.blocking_session_status=‘VALID‘;

-----有问题sql

select t1.nnum,
t1.nmny,
t1.ntaxmny,
t1.ndiscountmny,
t1.ndiscounttaxmny,
t1.csaleorderbid,
v.*
from me_saleorderpro t1
left outer join (select sum(t2.nnum) over(partition by t2.csaleorderbid) sumout,
sum(nvl(t2.naccumwastnum, 0)) over(partition by t2.csaleorderbid) sumwast,
sum(t2.ndiscountmny) over(partition by t2.csaleorderbid) sumdismny,
sum(t2.ndiscounttaxmny) over(partition by t2.csaleorderbid) sumtaxdismny,
t2.csaleorderbid,
t2.ntaxprice,
t2.nprice,
sum(t2.nmny) over(partition by t2.csaleorderbid) summny,
sum(t2.ntaxmny) over(partition by t2.csaleorderbid) sumtaxmny
from me_saleoutpro t2
where t2.csaleorderbid in
(‘1001S21000000005TSAT‘, ‘1001S21000000005TTG3‘)) v on v.csaleorderbid =
t1.csaleorderbid
and v.ntaxprice =
t1.ntaxprice
where t1.csaleorderbid in (‘1001S21000000005TSAT‘, ‘1001S21000000005TTG3‘)


--修改性
select count(*),csaleorderbid from me_saleoutpro group by csaleorderbid
不同的多吗


--解释计划窗口
可以查看sql执行耗时情况

--创建索引
create index Mesalcsaleorder on me_saleoutpro(csaleorderbid);
create index Mesaleordercsaleorderbid on me_saleorderpro(csaleorderbid);

oracle问题处理sql

标签:name   .so   odi   解释   不同的   问题处理   machine   and   datapump   

原文地址:https://www.cnblogs.com/qtong/p/10186757.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!