dbms_stats.gather_table_stats 遭遇ORA-01422

SQL> exec dbms_stats.gather_table_stats(‘ZJUCRM2O’,'BI_SUBSCRB_BILL_DM_201111′,cascade =>true);

begin dbms_stats.gather_table_stats(‘ZJUCRM2O’,'BI_SUBSCRB_BILL_DM_201111′,cascade =>true); end;

ORA-01422: exact fetch returns more than requested number of rows  
ORA-06512: at "SYS.DBMS_STATS", line 15027    
ORA-06512: at "SYS.DBMS_STATS", line 15049    
ORA-06512: at line 1

解决:    
手工指定granularity的值即可,例如:    
exec dbms_stats.gather_table_stats(‘ZJUCRM2O’,'BI_SUBSCRB_BILL_DM_201111′,granularity =>’ALL’,cascade =>true);

—–    
对于分区表,需要注意一个参数granularity    
默认为AUTO,根据分区类型自动调整granularity    
granularity一般为ALL、PARITIONS、SUBPARTITION、GLOBAL    


请使用浏览器的分享功能分享到微信等