怎麼監控oracle資料庫表和資料表空間

來源:互聯網
上載者:User

   怎麼監控oracle資料庫表和資料表空間的現狀

  declare

  unf number;

  unfb number;

  fs1 number;

  fs1b number;

  fs2 number;

  fs2b number;

  fs3 number;

  fs3b number;

  fs4 number;

  fs4b number;

  full number;

  fullb number;

  begin

  dbms_space.space_usage('&1',

  '&2',

  'TABLE',

  unf,

  unfb,

  fs1,

  fs1b,

  fs2,

  fs2b,

  fs3,

  fs3b,

  fs4,

  fs4b,

  full,

  fullb);

  dbms_output.put_line('unformatted_blocks:' || unf);

  dbms_output.put_line('full_blocks(0% free):' || full);

  dbms_output.put_line('fs1_blocks(0-25% free):' || fs1);

  dbms_output.put_line('fs2_blocks(25-50% free):' || fs2);

  dbms_output.put_line('fs3_blocks(50-75% free):' || fs3);

  dbms_output.put_line('fs4_blocks(75-100% free):' || fs4);

  end;

  /

  2. 資料表空間的使用記錄(只輸出了每天的第一次統計結果)

  select b.name,

  a.rtime,

  a.tablespace_usedsize,

  a.tablespace_size,

  round(100 * a.tablespace_usedsize / a.tablespace_size) used_percent

  from dba_hist_tbspc_space_usage a,

  (select t2.name,

  min(rtime) rtime,

  min(tablespace_id) tablespace_id

  from dba_hist_tbspc_space_usage t1

  inner join v$tablespace t2 on t1.tablespace_id = t2.TS#

  where t2.NAME = upper('&1')

  group by name, substr(rtime,1,10)

  ) b

  where a.tablespace_id = b.tablespace_id

  and a.rtime = b.rtime

  order by a.rtime;

  3. 表的剩餘空間預測

  select * from table(dbms_space.OBJECT_GROWTH_TREND('ECC_CC', 'YTKC_ORDERRELEVANCE', 'TABLE')

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.