ORACLE HINT 的一些BUG
來源:互聯網
上載者:User
AUTHOR : KJ0231320
TEAM : I.S.T.O
以下是對ORACLE HINT FUZZ的時候發現的。
select /*+ NO_PUSH_PRED(* dual --)*/ * from dual
以還有好些HINT都會出現如此語法錯誤或者會使當前Connection會話中斷
研究了好久都沒發現什麼細節原因,跟蹤不下去了。擱著快有半年了扔出來,後來者可以走少些彎路
順便給出FUZZ的代碼
package cn.isto.fuzz.oracle; import java.sql.*; import java.util.List; public class SQLHintFuzzer { private Object[] fuzzData=new Object[38]; private String[] hints = new String[182]; private Connection conn; Statement stmt = null; private String url; private String user; private String pass; private String sql1; private String loopCreateString(String initStr,int count){ StringBuilder tempsb = new StringBuilder(); for(int i=0;i<count;i++){ tempsb.append(initStr); } return tempsb.toString(); } public SQLHintFuzzer(){ fuzzData[0]=-1; fuzzData[1]=-2; fuzzData[2]=0; fuzzData[3]=1; fuzzData[4]=2; fuzzData[5]=2147483647; fuzzData[6]=-2147483647; fuzzData[7]=2147483648l; fuzzData[8]=-2147483648; fuzzData[9]=Long.MAX_VALUE; fuzzData[10]=Long.MIN_VALUE; fuzzData[11]=loopCreateString("'')",1); fuzzData[12]=loopCreateString("/"",1); fuzzData[13]=loopCreateString("--",1); fuzzData[14]=loopCreateString("/*",1); fuzzData[15]=loopCreateString("%s%s%s%s%s%s%s",1); fuzzData[16]=loopCreateString("%x%x%x%x%x%x",1); fuzzData[17]=loopCreateString("%d%d%d%d%d%d",1); fuzzData[18]=loopCreateString("A",30); fuzzData[19]=loopCreateString("A",100); fuzzData[20]=loopCreateString("A",128); fuzzData[21]=loopCreateString("A",256); fuzzData[22]=loopCreateString("A",512); fuzzData[23]=loopCreateString("A",1024); fuzzData[24]=loopCreateString("A",2048); fuzzData[25]=loopCreateString("A",3000); fuzzData[26]=loopCreateString("A",4000); fuzzData[27]=loopCreateString("A",5000); fuzzData[28]=loopCreateString("A",6000); fuzzData[29]=loopCreateString("A",8000); fuzzData[30]=loopCreateString("A",10000); fuzzData[31]=loopCreateString("A",15000); fuzzData[32]=loopCreateString("A",20000); fuzzData[33]=loopCreateString("A",25000); fuzzData[34]=loopCreateString("A",30000); fuzzData[35]=loopCreateString("A",32767); fuzzData[36]=loopCreateString("SYS",1); fuzzData[37]=loopCreateString("ROWID",1); hints[0]="ALL_ROWS"; hints[1]="AND_EQUAL"; hints[2]="ANTIJOIN"; hints[3]="APPEND"; hints[4]="BITMAP"; hints[5]="BUFFER"; hints[6]="BYPASS_RECURSIVE_CHECK"; hints[7]="BYPASS_UJVC"; hints[8]="CACHE"; hints[9]="CACHE_CB"; hints[10]="CACHE_TEMP_TABLE"; hints[11]="CARDINALITY"; hints[12]="CHOOSE"; hints[13]="CIV_GB"; hints[14]="COLLECTIONS_GET_REFS"; hints[15]="CPU_COSTING"; hints[16]="CUBE_GB"; hints[17]="CURSOR_SHARING_EXACT"; hints[18]="DEREF_NO_REWRITE"; hints[19]="DML_UPDATE"; hints[20]="DOMAIN_INDEX_NO_SORT"; hints[21]="DOMAIN_INDEX_SORT"; hints[22]="DRIVING_SITE"; hints[23]="DYNAMIC_SAMPLING"; hints[24]="DYNAMIC_SAMPLING_EST_CDN"; hints[25]="EXPAND_GSET_TO_UNION"; hints[26]="FACT"; hints[27]="FIRST_ROWS"; hints[28]="FORCE_SAMPLE_BLOCK"; hints[29]="FULL"; hints[30]="GBY_CONC_ROLLUP"; hints[31]="GLOBAL_TABLE_HINTS"; hints[32]="HASH"; hints[33]="HASH_AJ"; hints[34]="HASH_SJ"; hints[35]="HWM_BROKERED"; hints[36]="IGNORE_ON_CLAUSE"; hints[37]="IGNORE_WHERE_CLAUSE"; hints[38]="INDEX_ASC"; hints[39]="INDEX_COMBINE"; hints[40]="INDEX_DESC"; hints[41]="INDEX_FFS"; hints[42]="INDEX_JOIN"; hints[43]="INDEX_RRS"; hints[44]="INDEX_SS"; hints[45]="INDEX_SS_ASC"; hints[46]="INDEX_SS_DESC"; hints[47]="INLINE"; hints[48]="LEADING"; hints[49]="LIKE_EXPAND"; hints[50]="LOCAL_INDEXES"; hints[51]="MATERIALIZE"; hints[52]="MERGE"; hints[53]="MERGE_AJ"; hints[54]="MERGE_SJ"; hints[55]="MV_MERGE"; hints[56]="NESTED_TABLE_GET_REFS"; hints[57]="NESTED_TABLE_SET_REFS"; hints[58]="NESTED_TABLE_SET_SETID"; hints[59]="NL_AJ"; hints[60]="NL_SJ"; hints[61]="NO_ACCESS"; hints[62]="NO_BUFFER"; hints[63]="NO_EXPAND"; hints[64]="NO_EXPAND_GSET_TO_UNION"; hints[65]="NO_FACT"; hints[66]="NO_FILTERING"; hints[67]="NO_INDEX"; hints[68]="NO_MERGE"; hints[69]="NO_MONITORING"; hints[70]="NO_ORDER_ROLLUPS"; hints[71]="NO_PRUNE_GSETS"; hints[72]="NO_PUSH_PRED"; hints[73]="NO_PUSH_SUBQ"; hints[74]="NO_QKN_BUFF"; hints[75]="NO_SEMIJOIN"; hints[76]="NO_STATS_GSETS"; hints[77]="NO_UNNEST"; hints[78]="NOAPPEND"; hints[79]="NOCACHE"; hints[80]="NOCPU_COSTING"; hints[81]="NOPARALLEL"; hints[82]="NOPARALLEL_INDEX"; hints[83]="NOREWRITE"; hints[84]="OR_EXPAND"; hints[85]="ORDERED"; hints[86]="ORDERED_PREDICATES"; hints[87]="OVERFLOW_NOMOVE"; hints[88]="PARALLEL"; hints[89]="PARALLEL_INDEX"; hints[90]="PIV_GB"; hints[91]="PIV_SSF"; hints[92]="PQ_DISTRIBUTE"; hints[93]="PQ_MAP"; hints[94]="PQ_NOMAP"; hints[95]="PUSH_PRED"; hints[96]="PUSH_SUBQ"; hints[97]="REMOTE_MAPPED";