oracle 回收資料表空間的資料檔案大小

來源:互聯網
上載者:User

標籤:ble   phar   ica   tables   inf   .com   msi   使用   分享圖片   

查看錶空間的使用方式:

select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB", round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used" from (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name order by ((a.bytes-b.bytes)/a.bytes) desc 

回收資料表空間資料檔案

select   ‘alter database datafile ‘‘‘||a.file_name||‘‘‘ resize ‘    ||round(a.filesize - (a.filesize - c.hwmsize-100) *0.8)||‘M;‘,  
a.filesize,c.hwmsize from ( select file_id,file_name,round(bytes/1024/1024) filesize from dba_data_files ) a,( select file_id,round(max(block_id)*8/1024) HWMsize from dba_extents group by file_id) c where a.file_id = c.file_id and a.filesize - c.hwmsize > 100

 

 

 執行回收reize資料檔案的sql

alter database datafile ‘/home/oracledb/dbf/data_rhipgz.dbf‘ resize 2816M;alter database datafile ‘/home/oracledb/dbf/medical_supplies_demo.dbf‘ resize 126M;alter database datafile ‘/home/oracledb/dbf/ids_test.dbf‘ resize 118M;alter database datafile ‘/home/oracle/oracledb/oracledb/dbf/cis_pharmacy.dbf‘ resize 3646M;alter database datafile ‘/u01/app/oracle/oradata/orcl/data_pivas_nj.dbf‘ resize 2177M;alter database datafile ‘/home/oracledb/dbf/medical_supplies_demo2.dbf‘ resize 172M;alter database datafile ‘/home/oracledb/dbf/DATA_CIS_TEST_04.dbf‘ resize 28703M;alter database datafile ‘/home/oracledb/dbf/DATA_CIS_TEST_07.dbf‘ resize 28754M;alter database datafile ‘/home/oracledb/dbf/rhip.dbf‘ resize 105M;alter database datafile ‘/home/oracledb/dbf/hip_tend.dbf‘ resize 1529M; 

 

oracle 回收資料表空間的資料檔案大小

聯繫我們

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