ORA-00979: not a GROUP BY expression報錯處理

來源:互聯網
上載者:User

環境:Oracle Database 11gR2(11.2.0.2) on Linux
故障現象: 執行Group By語句報錯ORA-00979。
具體的SQL如下:
SQL> select  a.d1,a.EXIT_type,round(a.cnt1/b.cnt2*100,2) from
  2  (select substr(LOGIN_DATE,1,8) d1,EXIT_type,count(*) cnt1 from xxx_connect_log group by substr(LOGIN_DATE,1,8),EXIT_type) a,
  3  (select substr(LOGIN_DATE,1,8) d2 ,count(*) cnt2 from xxx_connect_log group by substr(LOGIN_DATE,1,8) ) b
  4  where A.d1=B.d2 order by a.d1,a.EXIT_type;
(select substr(LOGIN_DATE,1,8) d2 ,count(*) cnt2 from xxx_connect_log group by substr(LOGIN_DATE,1,8) ) b
                                                                  *
ERROR at line 3:
ORA-00979: not a GROUP BY expression


這條語句在其他大區的DB上執行均OK,在體驗服DB上執行報錯。從文法上看,確實是完全沒問題的。


碰到這種ORA-報錯的情況,我們可以通過設定ErrorStack對錯誤堆棧進行跟蹤,將錯誤的後台資訊比較詳盡的轉儲到追蹤檔案,供分析研究。


ErrorStack的四個層級及說明:
0 Error stack only
1 Error stack and function call stack
2 As level 1 plus the process state
3 As level 2 plus the context area


ErrorStack僅在特定的錯誤出現的時候才被觸發。可以在執行個體或者會話層級進行設定。


下面我們進行979的ErrorStack跟蹤:
SQL> alter system set events='979 trace name errorstack forever,level 3';

System altered.

SQL> select  a.d1,a.EXIT_type,round(a.cnt1/b.cnt2*100,2) from
  2  (select substr(LOGIN_DATE,1,8) d1,EXIT_type,count(*) cnt1 from xxx_connect_log group by substr(LOGIN_DATE,1,8),EXIT_type) a,
  3  (select substr(LOGIN_DATE,1,8) d2 ,count(*) cnt2 from xxx_connect_log group by substr(LOGIN_DATE,1,8) ) b
  4  where A.d1=B.d2 order by a.d1,a.EXIT_type;
(select substr(LOGIN_DATE,1,8) d2 ,count(*) cnt2 from xxx_connect_log group by substr(LOGIN_DATE,1,8) ) b
                                                                  *
ERROR at line 3:
ORA-00979: not a GROUP BY expression


SQL> alter system set events='979 trace name errorstack off';

System altered.

SPFILE 錯誤導致資料庫無法啟動(ORA-01565)

ORA-01172、ORA-01151錯誤處理

ORA-00600 [2662]錯誤解決

ORA-01078 和 LRM-00109 報錯解決方案

ORA-00471 處理方法筆記

  • 1
  • 2
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.