oracle回收高水位

linfeng_oracle發表於2014-05-26

oracle回收高水位


檢視資料庫表的高水位情況(針對具體的某些表):

select a.owner,
       a.table_name,
       round(a.blocks * to_number(p.value) / 1024 / 1024, 2) size_mb,
       round(a.avg_row_len * a.num_rows / 1024 / 1024, 2) used_mb,
       round(a.avg_row_len * a.num_rows / (a.blocks * to_number(p.value)) * 100,
             2) pct,
       to_char(a.last_analyzed, 'yyyy-mm-dd hh24:mi:ss') last_analyzed
  from dba_tables a, v$parameter p
 where p.name = 'db_block_size' and blocks>0 and owner||'.'||table_name in ('MM_DLS.DR$FULL_DEVICEID21131053$I','PORTALMO.V_RECOMMEND',
'SSMS.T_SYN_RESULT','SSMS.T_SYNCTIME_TMP_CY','MM_MOSVR.VS_UA_VERSION',
'SSMS.T_RB_STATISTICS_NEW','MM_DLS.T_ADVANCECONTENT_ALL','MM_DLS.T_ADVANCECONTENT',
'MM_DLS.T_CONTESTCONTENT','PORTALMO.USER_INFO_BAK0720','PORTALMO.TEST_4_2VID','SSMS.T_GAMESTOP',
'SSMS.T_GAME_CONTENT','SSMS.T_MB_SINGER_NEW','PUBUSER.T_R_LOCAL','SSMS.T_R_GCONTENT','SSMS.T_R_BASE',
'PORTALWWW.T_CONTENT_MATCH_DEVICE','PORTALPC.T_CONTENT','PORTALWWW.T_TEMP_JIMIN1','PORTALWWW.T_CONTENT_CARVE',
'PORTALPC.T_CONTENT_MATCH_DEVICE','PORTALWWW.T_CSSP_ORDER_RECORD','PORTALWWW.T_SMS_INFO','PORTALWWW.T_CONTENT_CARVE_BAK',
'PORTALWWW.V_ONDEMAND_ORDER_20101215','MMOPEN.T_SMS_INFO','MMOPEN.T_TEMP_JIMIN1','MMOPEN.T_CONTENT_MATCH_DEVICE',
'SSMS.T_MQ_PROCESSING_PARA','SSMS.T_A_REPORT','SSMS.T_MQ_PROCESSING','SSMS.T_MQ_INFO','RCAT_MMP1.ROUT',
'SSMS.CM_CT_DEVICE_UPGRADE_DEL3BAK','MMPORT.MM_CONTENT_ANDROID','MMPORT.MM_CONTENT_DATA_EXT_930DEL',
'SSMS.T_A_ANDROID_LIST','SSMS.A_TEMP1','SSMS.T_FREE_DL_ORDER','SSMS.T_FREE_DL_REPORT','SSMS.T_VO_VIDEO_MID','SSMS.T_VO_REFERENCE');



針對結果中pct低於60的做高水位回收:

1、開啟表的行移動功能
alter table SSMS.T_FREE_DL_REPORT                         enable row movement;
alter table SSMS.T_VO_VIDEO_MID                           enable row movement;
alter table SSMS.T_VO_REFERENCE                           enable row movement;


2、回收操作

alter table SSMS.T_FREE_DL_REPORT            shrink space;
alter table SSMS.T_VO_VIDEO_MID               shrink space;
alter table SSMS.T_VO_REFERENCE               shrink space;

為了最小限度影響業務,採用了shrink操作,該操作有一些限制,以下情況不能用shrink:
IOT索引組織表
用rowid建立的物化檢視的基表(我也不知道要說什麼了)
帶有函式索引的表
SECUREFILE 大物件
壓縮表




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24996904/viewspace-1169930/,如需轉載,請註明出處,否則將追究法律責任。

相關文章