国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

系統(tǒng)的物理上不連續(xù)的碎片數(shù)計算

2024-07-21 02:39:21
字體:
供稿:網(wǎng)友

  可以使用如下方法查碎片:
  select bytes from dba_free_space;
  可以采用如下方法查系統(tǒng)中物理上不連續(xù)的碎片:
  create table wg_dba_free_space
  as select * from dba_free_space where 1=2;
  create table wg_free_space as select file_id,block_id,blocks from dba_free_space;
  
  create or replace PRocedure sp_freespace_wg
  /*目的是找出系統(tǒng)中物理上不連續(xù)的碎片個數(shù);而通過select count(*) from dba_free_space中得到的數(shù)目減去它計算出來的東西,就是可以通過coalesce命令整理的碎片數(shù)了。*/
  is 
  p_file_id  number;
  p_block_id number;
  p_blocks   number;
  pre_block_id number;
  pre_blocks   number;
  pre_file_id   number;
  cursor c1 is
    select file_id,block_id,blocks
     from wg_dba_free_space 
    where tablespace_name='TS_BILL1'
     order by file_id asc,block_id asc;
  begin
   p_file_id:=0;
   p_block_id:=0;
   p_blocks:=0;
   pre_block_id:=0;
   pre_file_id:=0;
  
   for dba_data_files_rec in c1 LOOP
    p_file_id:=dba_data_files_rec.file_id;
    p_block_id:=dba_data_files_rec.block_id;
    p_blocks:=dba_data_files_rec.blocks;
    
    if (p_file_id=pre_file_id) and (p_block_id=pre_block_id+p_blocks) then
     /*update*/
     update wg_free_space set
        blocks=blocks+p_blocks
       where file_id=p_file_id 
        and block_id=p_block_id;
    else
     insert into wg_free_space(file_id,block_id,blocks)
          values(p_file_id,p_block_id,p_blocks);
    end if;
  
    pre_file_id:=p_file_id;
    pre_block_id:=p_block_id; 
    pre_blocks:=p_blocks; 
    commit;
   end loop; 
  end;
  
  
  execute sp_freespace_wg;

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 鄂托克前旗| 日土县| 博野县| 丹东市| 项城市| 定远县| 历史| 霍林郭勒市| 耒阳市| 陕西省| 张家口市| 东阳市| 襄垣县| 蓬安县| 金华市| 渑池县| 绥中县| 马公市| 洪江市| 涞水县| 南汇区| 武宣县| 景宁| 沽源县| 静乐县| 东乌珠穆沁旗| 墨脱县| 舒城县| 九台市| 开远市| 五指山市| 富顺县| 永春县| 张掖市| 酒泉市| 无棣县| 长沙县| 临泽县| 吐鲁番市| 长岭县| 磐石市|