如何查看unix下某個oracle OS的進程在做什麼操作

來源:互聯網
上載者:User

        
    今天一個網管問我,為什麼unix下一個oracle OS的進程消耗了那麼多的CPU?
   
    登入上伺服器,果然發現了那個進程,是一個使用者串連oracle的進程.
   
    根據OS進程號(我這裡用的直連方式),應該可以查到它正在執行什麼SQL語句.
   
    -- 查到oracle OS進程的sid編號:
   
    select ses.sid from v$session ses,v$process pro where pro.spid=&spid and ses.paddr=pro.addr;
   
    -- 查到此sid串連使用者正在執行的SQL語句:
   
    select sql_text from v$sqltext_with_newlines where (hash_value,address)
     in (select sql_hash_value,sql_address from v$session where sid=&sid) order by address,piece;
   
    原來是一個條件複雜的分組統計的SQL

相關文章

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.