没法通过128(在表空间TEMP中)扩展 temp 段

无法通过128(在表空间TEMP中)扩展 temp 段有两个查询语句,查询功能一样,但是一个正常,一个报错:无法通过12

无法通过128(在表空间TEMP中)扩展 temp 段
有两个查询语句,查询功能一样,但是一个正常,一个报错:无法通过128(在表空间TEMP中)扩展 temp 段
正常的是:

select u.unitname, m.* from unit_info_tab u, (select count(*) as total, b.unitid as unitid, 
                            sum(case when b.stateid ='3' then 1 else 0 end) as weiwancheng,
                            sum(case when b.stateid in ('1','6') then 1 else 0 end) as wancheng,
                            sum(case when a.eventnum Like '0101%'  then 1 else 0 end) as shironghuanjing,
                            sum(case when a.eventnum Like '0102%' then 1 else 0 end) as xuanchuanguanggao,
                            sum(case when a.eventnum Like '0103%' then 1 else 0 end) as shigongguanli,
                            sum(case when a.eventnum Like '0105%' then 1 else 0 end) as jiemianzhixu,
                            sum(case when a.eventnum Like '0104%' then 1 else 0 end) as tufashijian,
                            sum(case when a.eventnum in ('0201%','0202%','0203%','0204%','0205%','0206%') then 1 else 0 end) as bujian,
                            sum(case when a.eventnum Like '05%' then 1 else 0 end) as other, 
                            sum(case when a.eventnum Like '03%' then 1 else 0 end) as zhianfangkong, 
                            sum(case when b.stateid in ('6') then 1 else 0 end) as daxunhuan, 
                            (count(*) - sum(case when b.stateid in ('6') then 1 else 0 end)) as xiaoxunhuan 
                            From  event_tab b,event_type_tab a 


where b.Type= a.typeid  and (b.unitid like '_______' Or b.userid='zhzx') 
                             and b.DATETIME  - to_date('2012-01-01','yyyy-mm-dd')>=0
                             and to_date(b.DATETIME) - to_date('2012-12-01','yyyy-mm-dd')<=0
                            group by (b.unitid)) m where m.unitid = u.unitid


报错的语句:
select u.unitname, count(*) as total, 
                            sum(case when b.stateid ='3' then 1 else 0 end) as weiwancheng,
                            sum(case when b.stateid in ('1','6') then 1 else 0 end) as wancheng,
                            sum(case when a.eventnum Like '0101%'  then 1 else 0 end) as shironghuanjing,
                            sum(case when a.eventnum Like '0102%' then 1 else 0 end) as xuanchuanguanggao,
                            sum(case when a.eventnum Like '0103%' then 1 else 0 end) as shigongguanli,
                            sum(case when a.eventnum Like '0105%' then 1 else 0 end) as jiemianzhixu,
                            sum(case when a.eventnum Like '0104%' then 1 else 0 end) as tufashijian,
                            sum(case when a.eventnum in ('0201%','0202%','0203%','0204%','0205%','0206%') then 1 else 0 end) as bujian,
                            sum(case when a.eventnum Like '05%' then 1 else 0 end) as other, 
                            sum(case when a.eventnum Like '03%' then 1 else 0 end) as zhianfangkong, 
                            sum(case when b.stateid in ('6') then 1 else 0 end) as daxunhuan, 


                            (count(*) - sum(case when b.stateid in ('6') then 1 else 0 end)) as xiaoxunhuan 
                            From unit_info_tab u, event_tab b,event_type_tab a 
where b.Type= a.typeid  and (b.unitid like '_______' Or b.userid='zhzx') 
                             and b.DATETIME  - to_date('2012-01-01','yyyy-mm-dd')>=0
                             and to_date(b.DATETIME) - to_date('2012-12-01','yyyy-mm-dd')<=0
 and u.unitid = b.unitid
                            group by (u.unitname)


各位大神,帮帮忙吧,多谢啦!
[解决办法]
引用:
这个现象很正常,不同的sql语句,即使返回结果皆相同,但不同的执行计划导致sql语句所需的开销完全不同。这也是sql语句可以通过改写来达到优化的原因。对于你这个问题,检查临时表空间是否限制了自动扩展,起次可以增加tempfile的大小。

临时表空间不是一般都不能设置为自动扩展吗?
[解决办法]
直接再加文件进去
另外,查temp的使用量是用下面这个视图:
SELECT (bytes_cached+bytes_used)/1024/1024 M 
  FROM v$temp_extent_pool;

建议建成TTG..