Oracle 查詢資料表空間佔用率逾時

來源:互聯網
上載者:User

環境:Oracle 11g

問題描述:在資料庫中執行查看錶空間利用率語句如下:

       select d.tp_name 資料表空間名,e.contents 類型,e.status 狀態, e.extent_management 區管理,

       b.bytes 大小m,  b.bytes-d.bytes 已使用m,(b.bytes-d.bytes)*100/b.bytes 佔用率

   from (select c.tablespace_name tp_name,sum(c.bytes)/1024/1024 bytes

         from dba_free_space c

         group by c.tablespace_name) d,

  (select a.tablespace_name tp_name,sum(a.bytes)/1024/1024 bytes

from dba_data_files a

group by a.tablespace_name) b,

    (select tablespace_name tp_name,contents,status,extent_management

   from dba_tablespaces )e

   where d.tp_name=b.tp_name and d.tp_name=e.tp_name

order by 7;

執行1個半小時以後以逾時而告終。於是我想看看該語句所用到的視圖情況,執行select count(*) from dba_free_space,發現執行該語句也是很長一段時間沒有反應。

原因:諮詢oracle工程師得出結論:由於視圖DBA_RECYCLE中資料量很大,導致dba_free_space中資料量過億,需要清理DBA_RECYCLE中的垃圾資料:切換到sys使用者下面,執行purge  DBA_RECYCLE;執行了一天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.