今天在非生产机上执行一个查询时超级慢,半个小时都不出数据;
然后优化数据的内存:
alter system set sga_max_size=1024M scope=spfile ;
alter system set pga_aggregate_target=512M scope=spfile;
更改数据查询规则:
alter session set optimizer_mode = ALL_ROWS
查询SQL占用数据块大小:
Select se.username,se.sid,su.extents,su.blocks*to_number(rtrim(p.value))as Space,serial#,
sql_address,
machine,
program, tablespace,segtype,sql_text
from v$sort_usage su,v$parameter p,v$session se,v$sql s
where p.name='db_block_size' and su.session_addr=se.saddr and s.hash_value=su.sqlhash and s.address=su.sqladdr
order by se.username,se.sid
很大的一个查询SQL,竟然没有占用一点数据块;
最后
analyze table feiyong_jilu_ys compute statistics;
整个用户分析处理方法SQL:
Exec dbms_stats.gather_schema_stats(ownname=>'enesysldc6',estimate_percent=>100,cascade=> TRUE, degree =>12);