Quick Reference to Patch Numbers for Database PSU, SPU(CPU), Bundle Patches and Patchsets—201504

Patchsets

 l12.1.0.2 (12.1.0.2.0 PATCH SET FOR ORACLE DATABASE SERVER)  17694377
 11.2.0.4 (11.2.0.4.0 PATCH SET FOR ORACLE DATABASE SERVER)  13390677
 11.2.0.3 (11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER)  10404530
 11.2.0.2 (11.2.0.2.0 PATCH SET FOR ORACLE DATABASE SERVER)  10098816
 11.1.0.7 (11.1.0.7.0 PATCH SET FOR ORACLE DATABASE SERVER)  6890831
 10.2.0.5 (10.2.0.5 PATCH SET FOR ORACLE DATABASE SERVER)  8202632
 d10.2.0.4 (10.2.0.4.0 PATCH SET FOR ORACLE DATABASE SERVER)  6810189
 e10.2.0.3 (10.2.0.3 PATCH SET FOR ORACLE DATABASE SERVER)  5337014
 10.2.0.2 (10.2.0.2 PATCH SET FOR ORACLE DATABASE SERVER)  4547817
 10.1.0.5 (10.1.0.5 PATCH SET FOR ORACLE DATABASE SERVER)
 4505133
 10.1.0.4 (10.1.0.4 PATCH SET FOR ORACLE DATABASE SERVER)
 4163362
 10.1.0.3 (10.1.0.3 PATCH SET FOR ORACLE DATABASE SERVER)
 3761843
 9.2.0.8 (9.2.0.8 PATCH SET FOR ORACLE DATABASE SERVER)
 4547809
 9.2.0.7 (9.2.0.7 PATCH SET FOR ORACLE DATABASE SERVER)
 4163445
 9.2.0.6 (9.2.0.6 PATCH SET FOR ORACLE DATABASE SERVER)
 3948480
 9.2.0.5 (ORACLE 9I DATABASE SERVER RELEASE 2 – PATCH SET 4 VERSION 9.2.0.5.0)
 3501955
 9.2.0.4 (9.2.0.4 PATCH SET FOR ORACLE DATABASE SERVER)
 3095277
 9.2.0.3 (9.2.0.3 PATCH SET FOR ORACLE DATABASE SERVER)
 2761332
 9.2.0.2 (9.2.0.2 PATCH SET FOR ORACLE DATABASE SERVER)
 2632931
 9.0.1.5 (9.0.1.5 PATCHSET)
 3301544
 9.0.1.4 (9.0.1.4 PATCH SET FOR ORACLE DATABASE SERVER)
 2517300
 9.0.1.3 (9.0.1.3. PATCH SET FOR ORACLE DATA SERVER)
 2271678
 8.1.7.4 (8.1.7.4 PATCH SET FOR ORACLE DATA SERVER)
 2376472
 8.1.7.3 (8.1.7.3 PATCH SET FOR ORACLE DATA SERVER)
 2189751
 8.1.7.2 (8.1.7.2.1 PATCH SET FOR ORACLE DATA SERVER)
 1909158

 

PSU, SPU(CPU), Bundle Patches

 
12.1.0.2
 Description  PSU    GI PSU  Bundle Patch (Windows 32bit & 64bit)
 APR2015  20299023 (12.1.0.2.3)  20485724 (12.1.0.2.3)  20684004 (12.1.0.2.4)
 JAN2015  19769480 (12.1.0.2.2)  19954978 (12.1.0.2.2)  19720843 (12.1.0.2.1)
 OCT2014  19303936 (12.1.0.2.1)  19392646 (12.1.0.2.1)  N/A

 

12.1.0.1
 Description  PSU  GI PSU   Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
 APR2015  20299016 (12.1.0.1.7)   j20485762 / k19971331(12.1.0.1.7) 20558101 (12.1.0.1.18)
 JAN2015  19769486 (12.1.0.1.6)  j19971324 / k19971331 (12.1.0.1.6) 20160748 (12.1.0.1.16)
 OCT2014  19121550 (12.1.0.1.5)  j19392372 / k19392451 (12.1.0.1.5) 19542943 (12.1.0.1.14)
 JUL2014  18522516 (12.1.0.1.4)  j18705901 / k18705972 (12.1.0.1.4) 19062327 (12.1.0.1.11)
 APR2014  18031528 (12.1.0.1.3)  j18139660 / k18413105  (12.1.0.1.3) 18448604 (12.1.0.1.7)
 JAN2014  17552800 (12.1.0.1.2)  17735306 (12.1.0.1.2) 17977915 (12.1.0.1.3)
 OCT2013  17027533 (12.1.0.1.1)  17272829 (12.1.0.1.1)  17363796 (12.1.0.1.1)  17363795 (12.1.0.1.1)

 

11.2.0.4
 Description  PSU  SPU(CPU)  GI PSU  Bundle Patch (Windows 32bit & 64bit)
 APR2015  20299013 (11.2.0.4.6)  20299015  20485808 (11.2.0.4.6)  20544696 (11.2.0.4.15)
 JAN2015  19769489 (11.2.0.4.5)  19854503  19955028 (11.2.0.4.5)  20127071 (11.2.0.4.12)
 OCT2014  19121551 (11.2.0.4.4)  19271443  19380115 (11.2.0.4.4)  19651773 (11.2.0.4.10)
 JUL2014  18522509 (11.2.0.4.3)  18681862  18706472 (11.2.0.4.3)  18842982 (11.2.0.4.7)
 APR2014  18031668 (11.2.0.4.2)  18139690  18139609 (11.2.0.4.2)  18296644 (11.2.0.4.4)
 JAN2014  17478514 (11.2.0.4.1)  17551709  N/A  17987366 (11.2.0.4.1)

 

11.2.0.3
 Description  PSU  SPU(CPU)  GI PSU  Bundle Patch (Windows64bit)  Bundle Patch(Windows32bit)
 APR2015  20299017 (11.2.0.3.14)  20299010  20485830 (11.2.0.3.14)  20420395  20420394
 JAN2015  19769496 (11.2.0.3.13)  19854461  19971343 (11.2.0.3.13)  20233168  20233167
 OCT2014  19121548 (11.2.0.3.12)  19271438  19440385 (11.2.0.3.12)  19618575  19618574
 JUL2014  18522512 (11.2.0.3.11)  18681866  18706488 (11.2.0.3.11)  18940194  18940193
 APR2014  18031683 (11.2.0.3.10)  18139695  18139678 (11.2.0.3.10)  18372244  18372243
 JAN2014  17540582 (11.2.0.3.9)  17478415  17735354 (11.2.0.3.9)  18075406  17906981
 OCT2013  16902043 (11.2.0.3.8)  17082364  17272731 (11.2.0.3.8)  17363850  17363844
 JUL2013  16619892 (11.2.0.3.7)  16742095  16742216 (11.2.0.3.7)  16803775  16803774
 APR2013  16056266 (11.2.0.3.6)  16294378  16083653 (11.2.0.3.6)  16345834  16345833
 JAN2013  14727310 (11.2.0.3.5)  14841409  14727347 (11.2.0.3.5)  16042648  16042647
 OCT2012  14275605 (11.2.0.3.4)  14390252  14275572 (11.2.0.3.4)  14613223  14613222
 JUL2012  13923374 (11.2.0.3.3)  14038787  13919095 (11.2.0.3.3)  14223718  14223717
 APR2012  13696216 (11.2.0.3.2)  13632717  13696251 (11.2.0.3.2)  13885389  13885388
 JAN2012  13343438 (11.2.0.3.1)  13466801  13348650 (11.2.0.3.1)  13413168  13413167

 

11.2.0.2
 Description  PSU   SPU(CPU)  GI PSU  Bundle Patch (Windows64bit)  Bundle Patch(Windows32bit)
 aOCT2013  17082367 (11.2.0.2.12)  17082375  17272753 (11.2.0.2.12)  17363838  17363837
 JUL2013  16619893 (11.2.0.2.11)  16742100  16742320 (11.2.0.2.11)  16345852  16345851
 APR2013  16056267 (11.2.0.2.10)  16294412  16166868 (11.2.0.2.10)  16345846  16345845
 JAN2013  14727315 (11.2.0.2.9)  14841437  14841385 (11.2.0.2.9)  16100399  16100398
 OCT2012  14275621 (11.2.0.2.8)  14390377  14390437 (11.2.0.2.8)  14672268  14672267
 JUL2012  13923804 (11.2.0.2.7)  14038791  14192201 (11.2.0.2.7)  14134043  14134042
 APR2012  13696224 (11.2.0.2.6)  13632725  13696242 (11.2.0.2.6)  13697074  13697073
 JAN2012  13343424 (11.2.0.2.5)  13343244  13653086 (11.2.0.2.5)  13413155  13413154
 OCT2011  12827726 (11.2.0.2.4)  12828071  12827731 (11.2.0.2.4)  13038788  13038787
 JUL2011  12419331 (11.2.0.2.3)  12419321  12419353 (11.2.0.2.3)  12714463  12714462
 APR2011  11724916 (11.2.0.2.2)  11724984  12311357 (11.2.0.2.2)  11896292  11896290
 JAN2011  10248523 (11.2.0.2.1)  N/A  N/A  10432053  10432052
 
11.2.0.1
 Description  PSU  CPU  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
 aJUL2011  12419378 (11.2.0.1.6)  12419278  12429529  12429528
 APR2011  11724930 (11.2.0.1.5)  11724991  11731176  11883240
 JAN2011  10248516 (11.2.0.1.4)  10249532  10432045  10432044
 OCT2010  9952216 (11.2.0.1.3)  9952260  10100101  10100100
 JUL2010  9654983 (11.2.0.1.2)  9655013  9736865  9736864
 APR2010  9352237 (11.2.0.1.1)  9369797  N/A  N/A
 
11.1.0.7
 Description  PSU  SPU(CPU)  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
bAPR2015  20299012 (11.1.0.7.23)  20299020  20420391  20420390
bJAN2015  19769499 (11.1.0.7.22)  19854433  20126915  20126914
bOCT2014  19152553 (11.1.0.7.21)  19274522  19609034  19609032
bJUL2014  18522513 (11.1.0.7.20)  18681875  18944208  18944207
bAPR2014  18031726 (11.1.0.7.19)  18139703  18372258  18372257
bJAN2014  17465583 (11.1.0.7.18)  17551415  17906936  17906935
bOCT2013  17082366 (11.1.0.7.17)  17082374  17363760  17363759
bJUL2013  16619896 (11.1.0.7.16)  16742110  16803788  16803787
bAPR2013  16056268 (11.1.0.7.15)  16308394  16345862  16345861
bJAN2013  14739378 (11.1.0.7.14)  14841452  15848067  15848066
 bOCT2012  14275623 (11.1.0.7.13)  14390384  14672313  14672312
 JUL2012  13923474 (11.1.0.7.12)  14038803  14109868  14109867
 APR2012  13621679 (11.1.0.7.11)  13632731  13715810  13715809
 JAN2012  13343461 (11.1.0.7.10)  13343453  13460956  13460955
 OCT2011  12827740 (11.1.0.7.9)  12828097  12914916  12914915
 JUL2011  12419384 (11.1.0.7.8)  12419265  12695278  12695277
 APR2011  11724936 (11.1.0.7.7)  11724999  11741170  11741169
 JAN2011  10248531 (11.1.0.7.6)  10249534  10350788  10350787
 OCT2010  9952228  (11.1.0.7.5)  9952269  9773825  9773817
 JUL2010  9654987 (11.1.0.7.4)  9655014  9869912  9869911
 APR2010  9352179 (11.1.0.7.3)  9369783  9392335  9392331
 JAN2010  9209238 (11.1.0.7.2)  9114072  9166861  9166858
 OCT2009  8833297 (11.1.0.7.1)  8836375  8928977  8928976
 JUL2009  N/A  8534338  8553515  8553512
 APR2009  N/A  8290478  8343070  8343061
 
11.1.0.6
 Description  CPU  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)
 aJUL2009  8534378  8563155  8563154
 APR2009  8290402  8333657  8333655
 JAN2009  7592335  7631981  7631980
 OCT2008  7375639  7378393  7378392
 JUL2008  7150417  7210197  7210195
 APR2008  6864063  6867180  6867178
 
10.2.0.5
 Description  PSU  SPU(CPU)  Bundle Patch (Windows64bit)  Bundle Patch (Windows32bit)  Bundle Patch(WindowsItanium)
abJUL2013  16619894 (10.2.0.5.12)  16742123  16803782  16803780  16803781
 bAPR2013  16056270 (10.2.0.5.11)  16270946  16345857  16345855  16345856
 bJAN2013  14727319 (10.2.0.5.10)  14841459  15848062  15848060  15848061
 bOCT2012  14275629 (10.2.0.5.9)  14390396  14553358  14553356  14553357
 bJUL2012  13923855 (10.2.0.5.8)  14038805  14134053  14134051  14134052
 bAPR2012  13632743 (10.2.0.5.7)  13632738  13654815  13654814  13870404
 JAN2012  13343471 (10.2.0.5.6)  13343467  b13460968 b13460967  N/A
 bOCT2011  12827745 (10.2.0.5.5)  12828105  c12914913  12914911  N/A
 JUL2011  12419392 (10.2.0.5.4)  12419258  12429524  12429523  N/A
 APR2011  11724962 (10.2.0.5.3)  11725006  12328269  12328268  N/A
 JAN2011  10248542 (10.2.0.5.2)  10249537  10352673  10352672  N/A
 OCT2010  9952230 (10.2.0.5.1)  9952270  10099855  10058290  N/A
 
10.2.0.4
 Description  PSU  SPU(CPU)  Bundle Patch (Windows32bit)  Bundle Patch (Windows64bit)  Bundle Patch(WindowsItanium)
 bgJUL2013  16619897 (10.2.0.4.17)  16742253  N/A  N/A  N/A
 bgAPR2013  16056269 (10.2.0.4.16)  16270931  N/A  N/A  N/A
 bgJAN2013  14736542 (10.2.0.4.15)  14841471  N/A  N/A  N/A
bgOCT2012  14275630 (10.2.0.4.14)  14390410  N/A  N/A  N/A
bgJUL2012  13923851 (10.2.0.4.13)  14038814  N/A  N/A  N/A
 abAPR2012  12879933 (10.2.0.4.12)  12879926  13928775  13928776  N/A
 JAN2012  12879929 (10.2.0.4.11)  12879912  b13654060  N/A  N/A
 bOCT2011  12827778 (10.2.0.4.10)  12828112  12914908  12914910  12914909
 JUL2011  12419397 (10.2.0.4.9)  12419249  12429519  12429521  12429520
 APR2011  11724977 (10.2.0.4.8)  11725015  12328501  12328503  12328502
 JAN2011  10248636 (10.2.0.4.7)  10249540  10349197  10349200  10349198
 OCT2010  9952234 (10.2.0.4.6)  9952272  10084980  10084982  10084981
 JUL2010  9654991 (10.2.0.4.5)  9655017  9777076  9777078  9777077
 APR2010  9352164 (10.2.0.4.4)  9352191  9393548  9393550  9393549
 JAN2010  9119284 (10.2.0.4.3)  9119226  9169457  9169460  9169458
 OCT2009  8833280 (10.2.0.4.2)  8836308  8880857  8880861  8880858
 JUL2009  8576156 (10.2.0.4.1)  8534387  8559466  8559467  8541782
 APR2009  N/A  8290506  8307237  8307238  8333678
 JAN2009  N/A  7592346  7584866  7584867  N/A
 OCT2008  N/A  7375644  7386320  7386321  N/A
 JUL2008  N/A  7150470  7218676  7218677  N/A
 
10.2.0.3
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)  Bundle Patch (Windows64bit)
 aJAN2009  7592354  7631956  7631958  7631957
 OCT2008  7369190  7353782  7353784  7353785
 JUL2008  7150622  7252496  7252497  7252498
 APR2008  6864068  6867054  6867055  6867056
 JAN2008  6646853  6637237  6637238  6637239
 OCT2007  6394981  6430171  6430173  6430174
 JUL2007  6079591  6116131  6038242  6116139
 APR2007  5901891  5948242  5916262  5948243
 JAN2007  5881721  5846376  5846377  5846378
 
10.2.0.2
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)   Bundle Patch (Windows64bit)  Bundle Patch (WindowsItanium)
 iJAN2009  7592355  N/A  N/A  N/A
 hOCT2008  7375660  N/A  N/A  N/A
 hJUL2008  7154083  N/A  N/A  N/A
 hAPR2008  6864071  N/A  N/A  N/A
 aJAN2008  6646850  N/A  N/A  N/A
 fOCT2007  6394997  6397028  6397030  6397029
 JUL2007  6079588  6013105  6013121  6013118
 APR2007  5901881  5912173  5912179  5912176
 JAN2007  5689957  5716143  5699839  5699824
 OCT2006  5490848  5502226  5500921  5500894
 JUL2006  5225799  5251025  5251028  5251026
 APR2006  5079037  5140461  5140567  5140508
 
10.2.0.1
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (Windows64bit)  Bundle Patch (WindowsItanium)
 APR2007  5901880  N/A  N/A  N/A
 JAN2007  5689937  5695784  5695786  5695785
 OCT2006  5490846  5500927  5500954  5500951
 JUL2006  5225798  5239698  5239701  5239699
 APR2006  5049080  5059238  5059261  5059251
 JAN2006  4751931  4751539  4770480  4751549
 
10.1.0.5
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)   Bundle Patch (WindowsItanium)
 JAN2012  13343482  13413002  13413003
 OCT2011  12828135  12914905  12914906
 JUL2011  12419228  12429517  12429518
 APR2011  11725035  11731119  11731120
 JAN2011  N/A  N/A  N/A
 OCT2010  9952279  10089559  10089560
 JUL2010  9655023  9683651  9683652
 APR2010  9352208  9390288  9390289
 JAN2010  9119261  9187104  9187105
 OCT2009  8836540  8785211  8785212
 JUL2009  8534394  8656224  8656226
 APR2009  8290534  8300356  8300360
 JAN2009  7592360  7486619  7586049
 OCT2008  7375686  7367493  7367494
 JUL2008  7154097  7047034  7047037
 APR2008  6864078  6867107  6867108
 JAN2008  6647005  6637274  6637275
 OCT2007  6395024  6408393  6408394
 JUL2007  6079585  6115804  6115818
 APR2007  5901877  5907304  5907305
 JAN2007  5689908  5716295  5634747
 OCT2006  5490845  5500883  5500885
 JUL2006  5225797  5251148  5251140
 APR2006  5049074  5057606  5057609
 JAN2006  4751932  4882231  4882236
 
10.1.0.4
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 APR2007  5901876  5909871  5909879
 JAN2007  5689894  5695771  5695772
 OCT2006  5490844  5500878  5500880
 JUL2006  5225796  5239736  5239737
 APR2006  5049067  5059200  5059227
 JAN2006  4751928  4751259  4745040
 OCT2005  4567866  4579182  4579188
 JUL2005  4392423  4440706  4404600
 APR2005  4210374  4287619  4287611
 
10.1.0.3
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JAN2007  5923277  N/A  N/A
 OCT2006  5566825  N/A  N/A
 JUL2006  5435164  N/A  N/A
 APR2006  5158022  N/A  N/A
 JAN2006  4751926  4741077  4741084
 OCT2005  4567863  4567518  4567523
 JUL2005  4392409  4389012  4389014
 APR2005  4193286  4269715  4158888
 JAN2005  4003062  4074232  3990812
 
10.1.0.2
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 APR2005  4193293  4181849  4213305
 JUL2005  4400766  4388944  4388948
 JAN2005  4003051  4104364  4083038
 
9.2.0.8
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JUL2010  9655027  9683644  9683645
 APR2010  9352224  9390286  N/A
 JAN2010  9119275  9187106  N/A
 OCT2009  8836758  8785185  8785186
 JUL2009  8534403  8427417  8427418
 APR2009  8290549  8300340  8300346
 JAN2009  7592365  7703210  7703212
 OCT2008  7375695  7394394  7394402
 JUL2008  7154111  7047026  7047029
 APR2008  6864082  6867138  6867139
 JAN2008  6646842  6637265  6637266
 OCT2007  6395038  6417013  6417014
 JUL2007  6079582  6130293  6130295
 APR2007  5901875  5916268  5916275
 JAN2007  N/A  N/A  N/A
 OCT2006  5490859  5652380  5639519
 
9.2.0.7
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JUL2007  6079579  6146759  6146748
 APR2007  5901872  5907274  5907275
 JAN2007  5689875  5654905  5654909
 OCT2006  5490841  5500873  5500874
 JUL2006  5225794  5250980  5250981
 APR2006  5049060  5064365  5064364
 JAN2006  4751923  4751528  4741074
 OCT2005  4567854  4579590  4579599
 JUL2005  4547566  N/A  N/A
 
9.2.0.6
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 OCT2006  5490840  5500865  5500871
 JUL2006  5225793  5239794  5239793
 APR2006  5049051  5059614  5059615
 JAN2006  4751921  4751261  4751262
 OCT2005  4567846  4579093  4579097
 JUL2005  4392392  4445852  4401917
 APR2005  4193295  4269928  4213298
 
9.2.0.5
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 OCT2006  5689708  N/A  N/A
 JUL2006  5435138  N/A  N/A
 APR2006  5219762  N/A  N/A
 OCT2005  4560421  N/A  N/A
 JUL2005  4392256  4387563  4391819
 APR2005  4193299  4195791  4214192
 JAN2005  4003006  4104374  3990809
 
9.2.0.4
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)  Bundle Patch (WindowsItanium)
 JAN2005  4002994  4104369  4083202
 
8.1.7.4
 Description  CPU (Unix/Linux)  Bundle Patch (Windows32bit)
 JAN2007  5689799  5686514
 OCT2006  5490835  5496067
 JUL2006  5225788  5236412
 APR2006  5045247  5057601
 JAN2006  4751906  4751570
 OCT2005  4560405  4554818
 JUL2005  4392446  4437058
 APR2005  4193312  4180163
 JAN2005  4002909  3921893

OJVM PSU Patches

 
12.1.0.2
 Description  OJVM PSU (Linux/Unix)  OJVM BP (Windows)  Combo OJVM + DB PSU  Combo OJVM + GI PSU  Combo OJVM +  DB BP
 APR2015  20415564 (12.1.0.2.3)  20391199 (12.1.0.2.2)  20834354  20834538  20834553
 JAN2015  19877336 (12.1.0.2.2)  20225938 (12.1.0.2.1)  20132434  20132450  20132462
 OCT2014 (12.1.0.2.1)  19282028  19791366  19791375  19791399

 
12.1.0.1
 Description  OJVM PSU (Linux/Unix)  OJVM BP (Windows)  Combo OJVM + DB PSU  Combo OJVM + GI PSU  Combo OJVM +  DB BP  Generic JDBC
 APR2015 (12.1.0.1.3)  20406245  20225909  20834568  20834579  N/A  N/A
 JAN2015 (12.1.0.1.2)  19877342  20225916  20132482  20132489  N/A  N/A
 OCT2014 (12.1.0.1.1)  19282024  19801531  19791363  19791360  N/A  19852357

 
11.2.0.4
 Description  OJVM PSU (Linux/Unix)  OJVM BP (Windows)   Combo OJVM + DB PSU  Combo OJVM + DB SPU  Combo OJVM + GI PSU  Combo OJVM +  DB BP  Generic JDBC
 APR2015 (11.2.0.4.3)  20406239  20225988  20834611  20834597  20834621  N/A N/A
 JAN2015 (11.2.0.4.2)  19877440  20225982  20132580  20132517  20132615  N/A N/A
 OCT2014 (11.2.0.4.1)  19282021 19799291  19791364  19791358  19791420  N/A 19852360

 
11.2.0.3
 Description  OJVM PSU (Linux/Unix)  OJVM BP (Windows) Combo OJVM + DB PSU  Combo OJVM + DB SPU Combo OJVM + GI PSU  Combo OJVM +  DB BP  Generic JDBC
 APR2015 (11.2.0.3.3) 20406220  20391185 20834670 20834653  20834686  N/A
 JAN2015 (11.2.0.3.2) 19877443  20227195 20132646 20132635  20132651  N/A  N/A
 OCT2014 (11.2.0.3.1) 19282015  19806120 19791427 19791426 19791428  N/A 19852361

 

 
11.1.0.7
Description OJVM PSU (Linux/Unix)  OJVM BP (Windows) Combo OJVM + DB PSU Combo OJVM + DB SPU  Combo OJVM + GI PSU Combo OJVM +  DB BP Generic JDBC
 APR2015 (11.1.0.7.3)  20406213  20391156  20834724  20834712   N/A  N/A  N/A
 JAN2015 (11.1.0.7.2)  19877446  20227146  20132677  20132669   N/A  N/A  N/A
 OCT2014 (11.1.0.7.1)  19282002  19806118  19791436  19791434   N/A  N/A  19852363

 

11g 使用 alter user identified by values password 恢复历史密码

在11.1之前的版本,很多人可能都知道,可以通过alter user identified by values password 来还原oracle 数据库历史密码,但是在11g中出现几个问题:
1. dba_users中无password记录(值为空),这个问题可以通过直接查询user$.password依然有记录

SQL> select password from dba_users where username='SYS';
PASSWORD
------------------------------
SQL> select password from user$ WHERE name='SYS';
PASSWORD
------------------------------
8A8F025737A9097A

2.在11.1开始user$中的SPARE4有值,从而使得数据库密码区分大小写,参考blog:关于ORACLE 11G密码大小写敏感猜想(USER$.SPARE4)

SQL>  select SPARE4  from user$ WHERE name='SYS';
SPARE4
--------------------------------------------------------------------------------
S:C7C81BBE7760B5BBB3973F0971AA36C737BF6DCC4A34FE925CE70B0739BD

现在就存在疑问,在11G版本中,如何来还原Oracle数据库用户历史密码呢?,这里通过试验的方式证明,alter user identified by values后面值可以是user$.password 也可以是user$.SPARE4,只是两者在密码大小写上有区别,具体试验如下:

创建测试用户xifenfei

[oracle@localhost ~]$ ss
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 10 16:00:03 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> select sysdate "www.xifenfei.com" from dual;
www.xifen
---------
10-APR-15
SQL> create user xifenfei identified by oracle;
User created.
SQL> grant create session to xifenfei;
Grant succeeded.
SQL> conn xifenfei/oracle
Connected.
SQL> conn xifenfei/ORACLE
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
SQL> conn / as sysdba
Connected.
SQL> show parameter sec_case_sensitive_logon ;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sec_case_sensitive_logon             boolean     TRUE

这里由于sec_case_sensitive_logon参数默认为true,因此密码区分大小写

修改数据库密码

SQL> select spare4,password from user$ where name='XIFENFEI';
SPARE4
--------------------------------------------------------------------------------
PASSWORD
------------------------------
S:6E34E993900317BBFD6289E4AE619D634AA6AD804C765A3DEE1CCABCC50D
1BA871FA3B1C3F45
SQL> alter user xifenfei identified by xifenfei;
User altered.
SQL> select spare4,password from user$ where name='XIFENFEI';
SPARE4
--------------------------------------------------------------------------------
PASSWORD
------------------------------
S:A75A184EA2767488E698C443E97CB2473B46A9C80C2C61833BA867CB8B17
1682CAA2339F770F
SQL> conn xifenfei/xifenfei
Connected.
SQL> conn xifenfei/XIFENFEI
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
SQL> conn xifenfei/oracle
ERROR:
ORA-01017: invalid username/password; logon denied

这里把xifenfei用户的密码从oracle修改为xifenfei

尝试values user$.password恢复以前密码

SQL> conn / as sysdba
Connected.
SQL> alter user xifenfei identified by values '1BA871FA3B1C3F45';
User altered.
SQL> select spare4,password from user$ where name='XIFENFEI';
SPARE4
--------------------------------------------------------------------------------
PASSWORD
------------------------------
1BA871FA3B1C3F45
SQL> conn xifenfei/oracle
Connected.
SQL> conn xifenfei/ORACLE
Connected.
SQL> conn xifenfei/xifenfei
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.

通过该方式还原上次密码后,发现user$.SPARE4为空,也就使得Oracle不再区分密码大小写.

尝试values user$.spare4恢复以前密码

SQL> conn / as sysdba
Connected.
SQL> alter user xifenfei identified by xifenfei;
User altered.
SQL> select spare4,password from user$ where name='XIFENFEI';
SPARE4
--------------------------------------------------------------------------------
PASSWORD
------------------------------
S:48A11864AD633E904126C20E8C374A4AA45D87BB005D35AD2B10766E8E11
1682CAA2339F770F
SQL> conn xifenfei/xifenfei
Connected.
SQL> conn xifenfei/oracle
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
SQL> conn xifenfei/XIFENFEI
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> alter user xifenfei identified by values '6E34E993900317BBFD6289E4AE619D634AA6AD804C765A3DEE1CCABCC50D';
SP2-0640: Not connected
SQL> conn / as sysdba
Connected.
SQL> alter user xifenfei identified by values '6E34E993900317BBFD6289E4AE619D634AA6AD804C765A3DEE1CCABCC50D';
alter user xifenfei identified by values '6E34E993900317BBFD6289E4AE619D634AA6AD804C765A3DEE1CCABCC50D'
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [kzsviver:2], [], [], [], [], [],
[], [], [], [], [], []
--少写了S:,直接报ORA-600错误,怀疑S:是spare4列的某种标识
SQL>
SQL>
SQL>
SQL> alter user xifenfei identified by values 'S:6E34E993900317BBFD6289E4AE619D634AA6AD804C765A3DEE1CCABCC50D';
User altered.
SQL> select spare4,password from user$ where name='XIFENFEI';
SPARE4
--------------------------------------------------------------------------------
PASSWORD
------------------------------
S:6E34E993900317BBFD6289E4AE619D634AA6AD804C765A3DEE1CCABCC50D
SQL> conn xifenfei/oracle
Connected.
SQL> conn xifenfei/ORACLE
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
SQL> conn xifenfei/xifenfei
ERROR:
ORA-01017: invalid username/password; logon denied

这里发现通过values user$.spare4恢复以前密码后,user$.password列为空,但是密码依旧区分大小写。这里可以看出来,user$.password项以后可能取消掉,为了兼容性,因此Oracle在后续版本中依旧保留.

关于oracle 11G中恢复以前密码操作总结
1. 通过values user$.password恢复以前密码后,不区分大小写
2. 通过values user$.spare4恢复以前密码后,区分大小写
3. 目前两种方式都可以实现11g恢复以前密码,但是推荐使用user$.spare4值修改

正常关闭数据库sequence cache不为0 sequence不跳跃

在Oracle中sequence使用很频繁,而大部分使用都配合了cache一起使用,那在sequence+cache一起使用的过程中,如果数据库正常关闭sequence.nextval如果变化,如果数据库异常关闭sequence.nextval又如何变化?这里通过试验进行了证明,结论为:在有cache的sequence中,正常关闭数据库sequence不会出现跳跃,异常关闭数据库很可能导致sequence出现跳跃
创建sequence测试

[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 5 15:44:23 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select sysdate "www.xifenfei.com" from dual;
www.xifen
---------
05-APR-15
SQL> create sequence seq_xifenfei
  2   minvalue 1
  3   maxvalue 100000
  4   start with 1
  5   increment by 1
  6   cache 100;
Sequence created.
SQL> select SEQ_XIFENFEI.nextval from dual;
   NEXTVAL
----------
         1
SQL> /
   NEXTVAL
----------
         2
SQL> /
   NEXTVAL
----------
         3
SQL> select object_id from dba_objects where object_name='SEQ_XIFENFEI';
 OBJECT_ID
----------
     87549
SQL>  SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1        101          1          0          0        100

这里创建了一个名为SEQ_XIFENFEI的sequence,并且nextval已经查询到3,而且cache值设置为100,object_id为87549.

正常关闭数据库测试sequence.nextval变化

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             469765360 bytes
Database Buffers         1090519040 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL> SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1          4          1          0          0        100
SQL> select SEQ_XIFENFEI.nextval from dual;
   NEXTVAL
----------
         4
SQL> SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1        104          1          0          0        100

正常关闭数据库启动后,sequence.nextval依然在上次基础之上增加,并为出现跳跃现象.

异常关闭数据库测试sequence.nextval变化

SQL> shutdown  abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             469765360 bytes
Database Buffers         1090519040 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL> SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1        104          1          0          0        100
SQL> select SEQ_XIFENFEI.nextval from dual;
   NEXTVAL
----------
       104
SQL> SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1        204          1          0          0        100

异常关闭数据库启动后,sequence.nextvla发生跳跃从本该5直接跳跃到了104.

跟踪数据库正常关闭过程

SQL> alter session set events '10046 trace name context forever, level 4';
Session altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             469765360 bytes
Database Buffers         1090519040 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL>  SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1        105          1          0          0        100
SQL> select SEQ_XIFENFEI.nextval from dual;
   NEXTVAL
----------
       105
SQL> SELECT MINVALUE,HIGHWATER,INCREMENT$, CYCLE#,ORDER$,CACHE from seq$ where obj#=87549;
  MINVALUE  HIGHWATER INCREMENT$     CYCLE#     ORDER$      CACHE
---------- ---------- ---------- ---------- ---------- ----------
         1        205          1          0          0        100

再次证明了正常关闭数据库后,sequence.nextval未发生跳跃.

分析trace文件

PARSING IN CURSOR #139819144537744 len=129 dep=1 uid=0 oct=6 lid=0 tim=1428220381105111
hv=2635489469 ad='bc6e6c30' sqlid='4m7m0t6fjcs5x'
update seq$ set increment$=:2,minvalue=:3,maxvalue=:4,cycle#=:5,order$=:6,cache=:7,
highwater=:8,audit$=:9,flags=:10 where obj#=:1
END OF STMT
BINDS #139819144537744:
 Bind#0
  oacdty=02 mxl=22(02) mxlc=00 mal=00 scl=00 pre=00
  oacflg=10 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=bc41e288  bln=22  avl=02  flg=09
  value=1
 Bind#1
  oacdty=02 mxl=22(02) mxlc=00 mal=00 scl=00 pre=00
  oacflg=10 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=bc41e29a  bln=22  avl=02  flg=09
  value=1
 Bind#2
  oacdty=02 mxl=22(02) mxlc=00 mal=00 scl=00 pre=00
  oacflg=10 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=bc41e2ac  bln=22  avl=02  flg=09
  value=100000
 Bind#3
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=00 fl2=0001 frm=00 csi=00 siz=48 off=0
  kxsbbbfp=7f2a2edc2da8  bln=22  avl=01  flg=05
  value=0
 Bind#4
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=00 fl2=0001 frm=00 csi=00 siz=0 off=24
  kxsbbbfp=7f2a2edc2dc0  bln=22  avl=01  flg=01
  value=0
 Bind#5
  oacdty=02 mxl=22(02) mxlc=00 mal=00 scl=00 pre=00
  oacflg=10 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=bc41e2be  bln=22  avl=02  flg=09
  value=100
 Bind#6
  oacdty=02 mxl=22(03) mxlc=00 mal=00 scl=00 pre=00
  oacflg=10 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=bc41e2d0  bln=22  avl=03  flg=09
  value=105     <     ----SEQ_XIFENFEI.nextval值
 Bind#7
  oacdty=01 mxl=32(32) mxlc=00 mal=00 scl=00 pre=00
  oacflg=10 fl2=0001 frm=01 csi=852 siz=32 off=0
  kxsbbbfp=bc41e2e2  bln=32  avl=32  flg=09
  value="--------------------------------"
 Bind#8
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=00 fl2=0001 frm=00 csi=00 siz=48 off=0
  kxsbbbfp=7f2a2edc2d60  bln=22  avl=01  flg=05
  value=0
 Bind#9
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=00 fl2=0001 frm=00 csi=00 siz=0 off=24
  kxsbbbfp=7f2a2edc2d78  bln=22  avl=04  flg=01
  value=87549                             <---这个就是我们的sequence(SEQ_XIFENFEI)
EXEC #139819144537744:c=0,e=650,p=0,cr=1,cu=2,mis=0,r=1,dep=1,og=4,plh=1935744642,tim=1428220381108066
CLOSE #139819144537744:c=0,e=2,dep=1,type=3,tim=1428220381108119

这里我们找出来了为什么数据库正常关闭sequence.nextval在有cache的情况下,未发生跳跃:因为在数据库正常关闭的情况下,会触发一个update seq$的操作,把当前的sequence.nextval的值更新到seq$.highwater中,从而使得sequence在有cache的情况下,数据库正常关闭未出现nextval跳跃(currval也同样不跳跃);而在数据库异常关闭之时,数据库不能及时将sequence.nextval更新到eq$.highwater从而引起sequence cache中的值丢失,从而可能出现了sequence使用cache导致跳跃的情况
关于另外一篇关于sequence cache减小update seq$频率的测试,请见:关于oracle sequence一些小测试

9.2.0.8 exp导出dmp导入报Segmentation fault/段错误故障解决

在9.2.0.8 rac环境中,使用exp导出来dmp文件任何报错(按单个表,按用户导出,使用tns方式远程exp导出),包括重启数据库后导出,无法导入到其他数据库中(本库,tns方式远程导入,ftp传输到远程导入,9i/10g/11g版本)报错类似有setillegal instruction(coredump),段错误,Segmentation fault等,以下列出来几个报错信息

--导入11.2.0.2版本
Import: Release 11.2.0.2.0 - Production on Fri Mar 27 20:09:51 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V09.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character setillegal instruction(coredump)
--导入11.2.0.4版本
Import: Release 11.2.0.4.0 - Production on Thu Apr 2 21:12:18 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V09.02.00 via conventional path
Warning: the objects were exported by UNIONDB, not by you
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set段错误
--导入10.2.0.5版本
Import: Release 10.2.0.5.0 - Production on Thu Apr 2 21:44:47 2015
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V09.02.00 via conventional path
Warning: the objects were exported by UNIONDB, not by you
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)段错误

增加trace=y跟踪分析

Trace file /u01/app/oracle/diag/rdbms/qsng/qsng/trace/qsng_ora_16772.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1
System name: Linux
Node name: localhost.localdomain
Release: 2.6.32-300.10.1.el5uek
Version: #1 SMP Wed Feb 22 17:37:40 EST 2012
Machine: x86_64
Instance name: qsng
Redo thread mounted by this instance: 1
Oracle process number: 50
Unix process pid: 16772, image: oracle@localhost.localdomain (TNS V1-V3)
*** 2015-04-02 21:23:11.764
*** SESSION ID:(72.16901) 2015-04-02 21:23:11.764
*** CLIENT ID:() 2015-04-02 21:23:11.764
*** SERVICE NAME:(SYS$USERS) 2015-04-02 21:23:11.764
*** MODULE NAME:(imp@localhost.localdomain (TNS V1-V3)) 2015-04-02 21:23:11.764
*** ACTION NAME:() 2015-04-02 21:23:11.764
=====================
PARSING IN CURSOR #139814426861864 len=34 dep=1 uid=0 oct=42 lid=0 tim=1427980991763775 hv=3913151867 ad='7f29153b02c8' sqlid='14ys3d7nmvxbv'
ALTER SESSION SET SQL_TRACE = TRUE
END OF STMT
EXEC #139814426861864:c=0,e=65,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=1,plh=0,tim=1427980991756277
CLOSE #139814426861864:c=0,e=4,dep=1,type=0,tim=1427980991764938
=====================
PARSING IN CURSOR #139814426870416 len=67 dep=0 uid=0 oct=47 lid=0 tim=1427980991765036 hv=4244958165 ad='54d651fb0' sqlid='78wmnnryh9uyp'
BEGIN EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE'; END;
END OF STMT
EXEC #139814426870416:c=2999,e=10041,p=0,cr=0,cu=0,mis=1,r=1,dep=0,og=1,plh=0,tim=1427980991765033
CLOSE #139814426870416:c=0,e=24,dep=0,type=0,tim=1427980991765547
=====================
PARSING IN CURSOR #139814426870416 len=50 dep=0 uid=0 oct=47 lid=0 tim=1427980991767424 hv=2924529365 ad='5450bc4b0' sqlid='8ppuwaur51jqp'
BEGIN SYS.DBMS_EXPORT_EXTENSION.SET_STATSON; END;
END OF STMT
PARSE #139814426870416:c=1999,e=1828,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=1427980991767422
=====================
PARSING IN CURSOR #139814426240744 len=41 dep=1 uid=0 oct=42 lid=0 tim=1427980991768326 hv=2301085140 ad='0' sqlid='g63fjfq4kgjfn'
alter session set TIMED_STATISTICS = TRUE
END OF STMT
PARSE #139814426240744:c=0,e=206,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991768325
EXEC #139814426240744:c=1000,e=5348,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991773803
CLOSE #139814426240744:c=0,e=4,dep=1,type=0,tim=1427980991773879
EXEC #139814426870416:c=2000,e=6363,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=0,tim=1427980991773926
=====================
PARSING IN CURSOR #139814426340472 len=37 dep=1 uid=0 oct=3 lid=0 tim=1427980991776092 hv=1398610540 ad='553f2f718' sqlid='grwydz59pu6mc'
select text from view$ where rowid=:1
END OF STMT
PARSE #139814426340472:c=1000,e=824,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1427980991776091
=====================
PARSING IN CURSOR #139814426336856 len=210 dep=2 uid=0 oct=3 lid=0 tim=1427980991791474 hv=864012087 ad='547f6c0c0' sqlid='96g93hntrzjtr'
select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum,
 distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
END OF STMT
PARSE #139814426336856:c=1000,e=1332,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=3,plh=0,tim=1427980991791472
EXEC #139814426336856:c=2000,e=21773,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=3,plh=2239883476,tim=1427980991813432
FETCH #139814426336856:c=0,e=78,p=0,cr=2,cu=0,mis=0,r=0,dep=2,og=3,plh=2239883476,tim=1427980991813580
STAT #139814426336856 id=1 cnt=0 pid=0 pos=1 obj=448 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=2 pr=0 pw=0 time=108 us)'
STAT #139814426336856 id=2 cnt=0 pid=1 pos=1 obj=450 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=2 pr=0 pw=0 time=98 us)'
CLOSE #139814426336856:c=0,e=5,dep=2,type=3,tim=1427980991824838
EXEC #139814426336856:c=0,e=32,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=3,plh=2239883476,tim=1427980991825112
FETCH #139814426336856:c=0,e=15,p=0,cr=2,cu=0,mis=0,r=0,dep=2,og=3,plh=2239883476,tim=1427980991825174
CLOSE #139814426336856:c=0,e=4,dep=2,type=3,tim=1427980991825230
EXEC #139814426340472:c=5000,e=49516,p=0,cr=4,cu=0,mis=1,r=0,dep=1,og=4,plh=3684871272,tim=1427980991825784
FETCH #139814426340472:c=0,e=74,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1427980991825935
STAT #139814426340472 id=1 cnt=1 pid=0 pos=1 obj=69 op='TABLE ACCESS BY USER ROWID VIEW$ (cr=1 pr=0 pw=0 time=59 us cost=1 size=15 card=1)'
CLOSE #139814426340472:c=1000,e=79,dep=1,type=0,tim=1427980991826064
=====================
PARSING IN CURSOR #139814426240888 len=50 dep=0 uid=0 oct=3 lid=0 tim=1427980991827030 hv=2950256760 ad='548d195c8' sqlid='gnhvzburxkq3s'
SELECT value from sys.exu8opt where parameter = :1
END OF STMT
PARSE #139814426240888:c=7999,e=52316,p=0,cr=6,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=1427980991827029
=====================
PARSING IN CURSOR #139814426339424 len=37 dep=1 uid=0 oct=3 lid=0 tim=1427980991827683 hv=1398610540 ad='553f2f718' sqlid='grwydz59pu6mc'
select text from view$ where rowid=:1
END OF STMT
PARSE #139814426339424:c=0,e=38,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991827681
EXEC #139814426339424:c=0,e=23,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991827862
FETCH #139814426339424:c=0,e=19,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1427980991827938
STAT #139814426339424 id=1 cnt=1 pid=0 pos=1 obj=69 op='TABLE ACCESS BY USER ROWID VIEW$ (cr=1 pr=0 pw=0 time=10 us cost=1 size=15 card=1)'
CLOSE #139814426339424:c=1000,e=79,dep=1,type=0,tim=1427980991828062
EXEC #139814426240888:c=2000,e=2039,p=0,cr=2,cu=0,mis=1,r=0,dep=0,og=1,plh=2941868576,tim=1427980991829442
FETCH #139814426240888:c=0,e=46,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=2941868576,tim=1427980991829653
STAT #139814426240888 id=1 cnt=1 pid=0 pos=1 obj=0 op='FIXED TABLE FULL X$OPTION (cr=0 pr=0 pw=0 time=42 us cost=0 size=81 card=1)'
CLOSE #139814426240888:c=0,e=77,dep=0,type=0,tim=1427980991829862
CLOSE #139814426870416:c=0,e=15,dep=0,type=0,tim=1427980991830042
=====================
PARSING IN CURSOR #139814426870416 len=54 dep=0 uid=0 oct=47 lid=0 tim=1427980991830154 hv=1322764242 ad='54aea3138' sqlid='4jv63yp7dgjyk'
BEGIN SYS.DBMS_EXPORT_EXTENSION.SET_NO_OUTLINES; END;
END OF STMT
PARSE #139814426870416:c=0,e=67,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=0,tim=1427980991830153
=====================
PARSING IN CURSOR #139814426340328 len=48 dep=1 uid=0 oct=42 lid=0 tim=1427980991830368 hv=663246278 ad='0' sqlid='7kgh52cmshpf6'
alter session set CREATE_STORED_OUTLINES = FALSE
END OF STMT
PARSE #139814426340328:c=0,e=27,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991830367
EXEC #139814426340328:c=0,e=29,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991830510
CLOSE #139814426340328:c=0,e=3,dep=1,type=0,tim=1427980991830557
EXEC #139814426870416:c=0,e=338,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=0,tim=1427980991830605
CLOSE #139814426870416:c=0,e=19,dep=0,type=1,tim=1427980991830823
=====================
PARSING IN CURSOR #139814426867336 len=59 dep=0 uid=0 oct=47 lid=0 tim=1427980991830946 hv=1151361180 ad='551bd30c0' sqlid='akubp592a0s4w'
BEGIN SYS.DBMS_EXPORT_EXTENSION.SET_NLS_NUMERIC_CHAR; END;
END OF STMT
PARSE #139814426867336:c=0,e=71,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=0,tim=1427980991830945
=====================
PARSING IN CURSOR #139814426339136 len=45 dep=1 uid=0 oct=42 lid=0 tim=1427980991831195 hv=1639245916 ad='0' sqlid='45sy639hv9u2w'
alter session set NLS_NUMERIC_CHARACTERS='.,'
END OF STMT
PARSE #139814426339136:c=0,e=23,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991831194
EXEC #139814426339136:c=0,e=38,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991831347
CLOSE #139814426339136:c=0,e=3,dep=1,type=0,tim=1427980991831396
EXEC #139814426867336:c=0,e=347,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=0,tim=1427980991831438
=====================
PARSING IN CURSOR #139814426328016 len=37 dep=1 uid=0 oct=3 lid=0 tim=1427980991832676 hv=1398610540 ad='553f2f718' sqlid='grwydz59pu6mc'
select text from view$ where rowid=:1
END OF STMT
PARSE #139814426328016:c=0,e=39,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991832675
EXEC #139814426328016:c=0,e=35,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991832903
FETCH #139814426328016:c=1000,e=45,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1427980991833000
STAT #139814426328016 id=1 cnt=1 pid=0 pos=1 obj=69 op='TABLE ACCESS BY USER ROWID VIEW$ (cr=1 pr=0 pw=0 time=22 us cost=1 size=15 card=1)'
CLOSE #139814426328016:c=0,e=63,dep=1,type=1,tim=1427980991833122
=====================
PARSING IN CURSOR #139814426339280 len=35 dep=0 uid=0 oct=3 lid=0 tim=1427980991834448 hv=994821361 ad='5466a8e58' sqlid='3mwu4pcxnrj7j'
SELECT USERID,NAME FROM SYS.IMP9USR
END OF STMT
PARSE #139814426339280:c=2000,e=2133,p=0,cr=2,cu=0,mis=1,r=0,dep=0,og=1,plh=2709293936,tim=1427980991834446
EXEC #139814426339280:c=0,e=35,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=2709293936,tim=1427980991834763
FETCH #139814426339280:c=0,e=68,p=0,cr=2,cu=0,mis=0,r=1,dep=0,og=1,plh=2709293936,tim=1427980991835015
PARSE #139814426328016:c=0,e=23,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991836151
EXEC #139814426328016:c=0,e=43,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991836279
FETCH #139814426328016:c=0,e=20,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1427980991836349
CLOSE #139814426328016:c=0,e=16,dep=1,type=3,tim=1427980991836409
=====================
PARSING IN CURSOR #139814426320856 len=34 dep=0 uid=0 oct=3 lid=0 tim=1427980991837576 hv=3320476556 ad='551865ae8' sqlid='33pm4s32ynwwc'
SELECT NAME,VALUE FROM SYS.EXU9NLS
END OF STMT
PARSE #139814426320856:c=1000,e=1857,p=0,cr=2,cu=0,mis=1,r=0,dep=0,og=1,plh=415205717,tim=1427980991837575
EXEC #139814426320856:c=0,e=23,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=415205717,tim=1427980991837843
FETCH #139814426320856:c=0,e=83,p=0,cr=2,cu=0,mis=0,r=1,dep=0,og=1,plh=415205717,tim=1427980991838058
FETCH #139814426320856:c=0,e=20,p=0,cr=1,cu=0,mis=0,r=1,dep=0,og=1,plh=415205717,tim=1427980991838214
FETCH #139814426320856:c=0,e=16,p=0,cr=1,cu=0,mis=0,r=1,dep=0,og=1,plh=415205717,tim=1427980991838355
FETCH #139814426320856:c=0,e=16,p=0,cr=1,cu=0,mis=0,r=0,dep=0,og=1,plh=415205717,tim=1427980991838483
STAT #139814426320856 id=1 cnt=3 pid=0 pos=1 obj=98 op='TABLE ACCESS FULL PROPS$ (cr=5 pr=0 pw=0 time=72 us cost=2 size=84 card=3)'
CLOSE #139814426320856:c=0,e=8,dep=0,type=0,tim=1427980991838734
PARSE #139814426328016:c=0,e=20,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991839322
EXEC #139814426328016:c=0,e=23,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=3684871272,tim=1427980991839430
FETCH #139814426328016:c=0,e=17,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,plh=3684871272,tim=1427980991839495
CLOSE #139814426328016:c=0,e=15,dep=1,type=3,tim=1427980991839554
=====================
PARSING IN CURSOR #139814426320856 len=37 dep=0 uid=0 oct=3 lid=0 tim=1427980991842425 hv=2737225759 ad='54cd0a630' sqlid='as799jkjkdh0z'
SELECT COMPATIBLE FROM SYS.IMP9COMPAT
END OF STMT
PARSE #139814426320856:c=3000,e=3443,p=0,cr=2,cu=0,mis=1,r=0,dep=0,og=1,plh=1128103955,tim=1427980991842424
EXEC #139814426320856:c=0,e=39,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1128103955,tim=1427980991842721
FETCH #139814426320856:c=4999,e=4966,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=1128103955,tim=1427980991847851
CLOSE #139814426867336:c=0,e=18,dep=0,type=1,tim=1427980991848283
=====================
PARSING IN CURSOR #139814426863200 len=65 dep=0 uid=0 oct=47 lid=0 tim=1427980991848389 hv=1092642237 ad='5573014c0' sqlid='6mk0b8p0k0tdx'
BEGIN SYS.DBMS_EXPORT_EXTENSION.SET_IMP_TIMEZONE('+08:00'); END;
END OF STMT
PARSE #139814426863200:c=0,e=66,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=0,tim=1427980991848387
=====================
PARSING IN CURSOR #139814424939968 len=36 dep=1 uid=0 oct=42 lid=0 tim=1427980991849135 hv=938329428 ad='0' sqlid='gcqwsz0vyvjan'
alter session set TIME_ZONE='+08:00'
END OF STMT
PARSE #139814424939968:c=0,e=29,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991849133
EXEC #139814424939968:c=0,e=8,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=0,plh=0,tim=1427980991849270
CLOSE #139814424939968:c=0,e=3,dep=1,type=0,tim=1427980991849317
EXEC #139814426863200:c=0,e=882,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=0,tim=1427980991849392
=====================
PARSING IN CURSOR #139814426317816 len=28 dep=0 uid=0 oct=3 lid=0 tim=1427980991850463 hv=1877579296 ad='550faead8' sqlid='7wf7949rym5j0'
SELECT DBTIMEZONE FROM DUAL
END OF STMT
PARSE #139814426317816:c=0,e=827,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=1388734953,tim=1427980991850462
EXEC #139814426317816:c=0,e=38,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1388734953,tim=1427980991850766
FETCH #139814426317816:c=0,e=10,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=1388734953,tim=1427980991850897
STAT #139814426317816 id=1 cnt=1 pid=0 pos=1 obj=0 op='FAST DUAL (cr=0 pr=0 pw=0 time=2 us cost=2 size=0 card=1)'
CLOSE #139814426317816:c=0,e=6,dep=0,type=0,tim=1427980991851087
STAT #139814426320856 id=1 cnt=1 pid=0 pos=1 obj=0 op='HASH JOIN (cr=0 pr=0 pw=0 time=4973 us cost=0 size=2115 card=1)'
STAT #139814426320856 id=2 cnt=1 pid=1 pos=1 obj=0 op='FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=3099 us cost=0 size=81 card=1)'
STAT #139814426320856 id=3 cnt=982 pid=1 pos=2 obj=0 op='FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=1112 us cost=0 size=203400 card=100)'
CLOSE #139814426320856:c=0,e=191,dep=0,type=0,tim=1427980991891702
STAT #139814426339280 id=1 cnt=1 pid=0 pos=1 obj=22 op='TABLE ACCESS CLUSTER USER$ (cr=2 pr=0 pw=0 time=68 us cost=1 size=18 card=1)'
STAT #139814426339280 id=2 cnt=1 pid=1 pos=1 obj=11 op='INDEX UNIQUE SCAN I_USER# (cr=1 pr=0 pw=0 time=34 us cost=0 size=0 card=1)'
CLOSE #139814426339280:c=0,e=123,dep=0,type=0,tim=1427980991891866
CLOSE #139814426863200:c=0,e=17,dep=0,type=0,tim=1427980991891919

这里分析,未发现任何错误,导出程序直接报Segmentation fault终止

原因分析
通过各种方式导入都报类似错误,初步确定是dmp文件异常,而dmp异常有几种可能性:
1.exp程序异常导致dmp文件异常,这里使用tns方式导出,排除该种可能
2.数据库内存出现异常导致dmp文件异常,重启数据库依旧,排除该种可能
3.因为测试过多种平台,版本,本地,远程导入,排除兼容性,远程传输损坏等
4.因为以前正常,突然异常,坏可以exp程序调用包异常,这种故障不能排除

解决方案
鉴于此,通过expcat.sql重新安装相关包,发现执行这个之后,exp导出程序,再imp导入一切正常
执行catexp.sql不影响生产库,只影响exp/imp程序

conn / as sysdba
@?/rdbms/admin/catexp.sql

这里再次提醒我们看到exp导出成功,不能证明imp一定ok,最好通过imp进行导入测试

InMemory评估利器—Oracle Database InMemory Advisor

我想大家都可能有一个疑问,数据库从以前版本升级到12C,计划使用in-memory特性,那我怎么评估哪些表放进去合适,放进去后,整体性能又会提升多少,需要in-memory内存为多大?这些问题如果人工去判断不一定准确,而且可能有很多遗落,Oracle也考虑到了这一点,因此发布了Oracle Database InMemory Advisor,从而来比较简单的实现数据库使用In-Memory简单配置.Oracle Database InMemory Advisor主要通过DBMS_INMEMORY_ADVISOR包分析 Active Session History (ASH), Automatic Workload Repository (AWR) and SQL Tuning Sets (STS)信息进行分析,给出建议.

Oracle Database InMemory Advisor使用前提
1.数据库版本为11.2.0.3及其以上版本(compatibility>=11.2.0.3)
2.需要有Database Tuning pack liscense支持(仅仅是liscense,不是功能)

安装Oracle Database InMemory Advisor

[oracle@localhost xff]$ unzip imadvisor.zip
Archive:  imadvisor.zip
  inflating: instimadv.sql
  inflating: dbmsimadv.sql
  inflating: prvtimadv.plb
  inflating: dbmsimadvint.plb
  inflating: prvtimadvint.plb
  inflating: schmimadv.sql
  inflating: imadvisor_version.sql
  inflating: imadvisor_load_report_templates.sql
  inflating: imadvisor_clone_view.sql
  inflating: imadvisor_analyze_and_report.sql
  inflating: imadvisor_spool_debug.sql
  inflating: imadvisor_export.sql
  inflating: imadvisor_DataPump.sql
  inflating: imadvisor_awr_augment_export.sql
  inflating: imadvisor_awr_augment_import.sql
  inflating: imadvisor_awr_augment_tables.sql
  inflating: imadvisor_fetch_recommendations.sql
[oracle@localhost xff]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 18 16:21:08 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @instimadv
Welcome to the Oracle Database In-Memory Advisor (DBMS_INMEMORY_ADVISOR)
installation.
The Oracle Database In-Memory Advisor is licensed as part of the Oracle Tuning Pack.
Do you currently have a valid Oracle Tuning Pack license with this database (Y/N)? Y
DBMS_INMEMORY_ADVISOR uses Active Session History (ASH), Automatic Workload
Repository (AWR) and optionally SQL Tuning Sets (STS) to determine which
tables, partitions and subpartitions to place In Memory for optimized analytics
processing performance.  DBMS_INMEMORY_ADVISOR produces a recommendation report
and a SQLPlus script to implement its recommendations.
This installation script will create user IMADVISOR and add object
definitions to the schema including the DBMS_INMEMORY_ADVISOR package.  This
installation script creates user IMADVISOR using the
IDENTIFIED BY password method. If you prefer to use either the
IDENTIFIED EXTERNALLY or IDENTIFIED GLOBALLY method, abort this installation
by pressing ^C. Then create user IMADVISOR using your preferred
method.  Add no objects to the IMADVISOR schema.  Then run this
installation script again.
These actions will be taken on the database to which you are currently
connected.
Please enter the connection ID for the current database?
qsng
This installation script creates a new Oracle database user and schema
named IMADVISOR for the operation of DBMS_INMEMORY_ADVISOR...
Please enter the password for user IMADVISOR?
For confirmation, please re-enter the password for user IMADVISOR?
Available tablespaces:
TABLESPACE_NAME
------------------------------
FSDATA
MYDATA
SYSAUX
SYSTEM
TEMP
UNDOTBS1
USERS
Please enter the default tablespace name for user IMADVISOR?
users
The In-Memory Advisor uses the Oracle directory object IMADVISOR_DIRECTORY
by default.
If you wish to create the IMADVISOR_DIRECTORY object, please enter an OS host
directory path for the IMADVISOR_DIRECTORY object.
If not, please press ENTER to continue.
? /tmp/xff
Connecting to IMADVISOR @ qsng..
Enter password:
Connected.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
DBMS_INMEMORY_ADVISOR installation successful.
Users who will use the DBMS_INMEMORY_ADVISOR package must be GRANTed
EXECUTE on the DBMS_INMEMORY_ADVISOR package.
Please enter a comma separated list of Oracle Database users to whom
you wish EXECUTE on the DBMS_INMEMORY_ADVISOR package to be GRANTed?
SYS
GRANT EXECUTE ON dbms_inmemory_advisor TO SYS
While logged in as IMADVISOR or with sufficient privileges, you can
GRANT EXECUTE ON DBMS_INMEMORY_ADVISOR to additional users as needed.
DBMS_INMEMORY_ADVISOR installation and setup complete.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Oracle Database InMemory Advisor生成报告

[oracle@localhost xff]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 18 16:30:57 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @imadvisor_analyze_and_report
Specify the IM task name
The IM Advisor generates a report as  imadvisor_<taskname>.html file
in the current working directory
The sql file is generated as imadvisor_sql_<taskname>.sql
Enter value for im_task_name: xifenfei
IM Task name Specified: xifenfei
Enter begin time for report:
--    Valid input formats:
--      To specify absolute begin time:
--        [MM/DD[/YY]] HH24:MI[:SS]
--        Examples: 02/23/03 14:30:15
--                  02/23 14:30:15
--                  14:30:15
--                  14:30
--      To specify relative begin time: (start with '-' sign)
--        -[HH24:]MI
--        Examples: -1:15  (SYSDATE - 1 Hr 15 Mins)
--                  -25    (SYSDATE - 25 Mins)
Enter value for begin_time: -3
Report begin time specified: -3
old 102:   lbtime_in  := nvl('&&begin_time', '-60');
new 102:   lbtime_in  := nvl('-3', '-60');
old 104:   :btime := to_char( begin_time, '&&imadvisor_time_format' );
new 104:   :btime := to_char( begin_time, 'YYYY-MON-DD HH24:MI:SS.FF' );
Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Enter value for duration:
Report duration specified:
old   8:   begin_time := to_timestamp(:btime, '&&imadvisor_time_format');
new   8:   begin_time := to_timestamp(:btime, 'YYYY-MON-DD HH24:MI:SS.FF');
old  18:   duration   := nvl('&&duration', since_begin_time);
new  18:   duration   := nvl('', since_begin_time);
old  29:   :etime := to_char( end_time, '&&imadvisor_time_format' );
new  29:   :etime := to_char( end_time, 'YYYY-MON-DD HH24:MI:SS.FF' );
Using 2015-MAR-18 16:28:22.000000000 as report begin time
Using 2015-MAR-18 16:31:22.000000000 as report end time
IM Advisor: Adding Statistics..
IMADVISOR: Finished Adding Statistics
IMADVISOR: Finished Executing the task
IM Advisor: Generating Recommendations..
imadvisor_xifenfei.html
imadvisor_sql_xifenfei.html
imadvisor_object_xifenfei.html
imadvisor_xifenfei.sql
'Fetching recommendation files for task xifenfei'
IM Advisor generated report in imadvisor_xifenfei.html
IM Advisor genreated DDL script in imadvisor_xifenfei.sql
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost xff]$ ls -ltr *xifenfei*
-rw-r--r-- 1 oracle oinstall   887 Mar 18 16:33 imadvisor_xifenfei.sql
-rw-r--r-- 1 oracle oinstall 30175 Mar 18 16:33 imadvisor_xifenfei.html
-rw-r--r-- 1 oracle oinstall 13576 Mar 18 16:33 imadvisor_sql_xifenfei.html
-rw-r--r-- 1 oracle oinstall  8931 Mar 18 16:33 imadvisor_object_xifenfei.html
-rw-r--r-- 1 oracle oinstall  3405 Mar 18 16:33 imadvisor_auxiliary_xifenfei.html

这里输入的Task name为:xifenfei,Oracle Database InMemory Advisor结果
imadvisor_xifenfei.html是InMemory Advisor的一个整体描述
imadvisor_xifenfei.sql是InMemory Advisor生成的表级别的INMEMORY语句,可以直接通过@方式执行,或者修改后执行
imadvisor_sql_xifenfei.html主要是InMemory Advisor中关于sql的分析报告
imadvisor_object_xifenfei.html是InMemory Advisor中建议InMemory处理的对象分析报告
imadvisor_auxiliary_xifenfei.html 是一个辅助的总结

卸载Oracle Database InMemory Advisor

[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 18 21:55:49 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> drop user imadvisor cascade;
User dropped.

补充内容
1.在某些情况下,可能无法直接创建用户imadvisor,或者创建目录imadvisor_directory,可以通过类似命令创建,并修改instimadv.sql脚本屏蔽掉交互式安装

create user IMADVISOR identified by Oracle_123 DEFAULT TABLESPACE system;
CREATE OR REPLACE DIRECTORY imadvisor_directory AS '/tmp/xff/txt';
GRANT READ, WRITE ON DIRECTORY imadvisor_directory TO IMADVISOR;

2.在执行@imadvisor_analyze_and_report生成报告,可能会遇到ORA-24817: Unable to allocate the given chunk for current lob operation,解决方案为:

1. Copy the original script to a new location to serve as a backup.
2. Edit the script imadvisor_fetch_recommendations.sql and change the line in the script:
SET LONGCHUNKSIZE 2000000000
to
SET LONGCHUNKSIZE 32767
3. Save and run the script.

参考文档
Oracle Database InMemory Advisor (Doc ID 1965343.1)
Using Inmemory Advisor Errors When Running Imadvisor_analyze_and_report (Doc ID 1987462.1)

分享I_OBJ4 ORA-8102故障恢复案例

在测试环境中对于OBJ$中i_obj4中出现ORA-8102进行了重新并恢复测试,认为自己已经比较清楚的掌握了I_OBJ4的ORA-8102问题处理,可是实际的一个案例,还是比较比实验中复杂,这里贴出来主要操作供大家参考,再次证明数据库恢复的场景不可大意,客户的故障只有你想不到的,没有遇不到的
通过bbed修改obj$中dataobj$重现I_OBJ4索引报ORA-08102错误
使用bbed 修复I_OBJ4 index 报ORA-8102
数据库创建表提示ORA-8102错误

SQL> startup
ORACLE instance started.
Total System Global Area 2.6991E+10 bytes
Fixed Size		    2213976 bytes
Variable Size		 1.9327E+10 bytes
Database Buffers	 7516192768 bytes
Redo Buffers		  145174528 bytes
Database mounted.
Database opened.
SQL> create table t1 as select * from dual;
create table t1 as select * from dual
                                 *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 39, file 1, block 93842 (2)

分析ORA-08102错误

SQL> select object_name,object_type from dba_objects where object_id=39;
OBJECT_NAME                    OBJECT_TYPE
------------------------------ -------------------
I_OBJ4                         INDEX
SQL> create table t1 as select * from dual;
create table t1 as select * from dual
                                 *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 39, file 1, block 93842 (2)
SQL> select /*+ index(t i_obj4) */ DATAOBJ#,type#,owner# from obj$  t
minus
select /*+ full(t1) */ DATAOBJ#,type#,owner# from obj$  t1;
  2    3
  DATAOBJ#	TYPE#	  OWNER#
---------- ---------- ----------
     97109	    0	       0
SQL>  select /*+ full(t1) */ DATAOBJ#,type#,owner# from obj$  t1
  minus
  select /*+ index(t i_obj4) */ DATAOBJ#,type#,owner# from obj$  t
  ;
  2    3    4
  DATAOBJ#	TYPE#	  OWNER#
---------- ---------- ----------
     97094	    0	       0
SQL> SET LINES 122
COL INDEX_OWNER FOR A20
COL INDEX_NAME FOR A30
COL TABLE_OWNER FOR A20
COL COLUMN_NAME FOR A25
SELECT TABLE_OWNER,INDEX_NAME,COLUMN_NAME,COLUMN_POSITION
  FROM Dba_Ind_Columns
 WHERE table_name = upper('&TABLE_NAME') order by TABLE_OWNER,INDEX_OWNER,INDEX_NAME,COLUMN_POSITION
and index_name='I_OBJ4';
SQL> SQL> SQL> SQL> SQL>   2    3
Enter value for table_name: OBJ$
old   3:  WHERE table_name = upper('&TABLE_NAME') order by TABLE_OWNER,INDEX_OWNER,INDEX_NAME,COLUMN_POSITION
new   3:  WHERE table_name = upper('OBJ$') order by TABLE_OWNER,INDEX_OWNER,INDEX_NAME,COLUMN_POSITION
TABLE_OWNER	     INDEX_NAME 		    COLUMN_NAME 	      COLUMN_POSITION
-------------------- ------------------------------ ------------------------- ---------------
SYS		     I_OBJ4			    DATAOBJ#				    1
SYS		     I_OBJ4			    TYPE#				    2
SYS		     I_OBJ4			    OWNER#				    3
SQL> SELECT DATAOBJ# FROM OBJ$ WHERE OBJ#=97109;
no rows selected
SQL> SELECT DATAOBJ# FROM OBJ$ WHERE OBJ#=97094;
  DATAOBJ#
----------
     97094
SQL> select /*+ index(t i_obj4) */ rowid,DATAOBJ#,type#,owner# from obj$  t
minus
select /*+ full(t1) */ rowid,DATAOBJ#,type#,owner# from obj$  t1;
  2    3
ROWID		     DATAOBJ#	   TYPE#     OWNER#
------------------ ---------- ---------- ----------
AAAAASAABAAAADxAAb	97109	       0	  0
SQL>  select /*+ full(t1) */ rowid,DATAOBJ#,type#,owner# from obj$  t1
  minus
  select /*+ index(t i_obj4) */ rowid,DATAOBJ#,type#,owner# from obj$  t
  ;
  2    3    4
ROWID		     DATAOBJ#	   TYPE#     OWNER#
------------------ ---------- ---------- ----------
AAAAASAABAAAADxAAb	97094	       0	  0
SQL> select name,obj#,dataobj# from obj$ where rowid='AAAAASAABAAAADxAAb';
NAME				     OBJ#   DATAOBJ#
------------------------------ ---------- ----------
_NEXT_OBJECT				1      97094

到此也比较清楚,rowid为AAAAASAABAAAADxAAb的dataobj#记录在obj$表中为97094而在I_OBJ4中记录为97109,因此两者不一致,从而出现ORA-8102错误

尝试bbed解决ORA-8102问题
尝试修改obj$和i_obj4中的dataobj#记录一致,这里修改obj$中的对应记录

SQL> select dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,
dbms_rowid.rowid_row_number(rowid) row#
from obj$ where rowid='AAAAASAABAAAADxAAb'  2    3
  4  /
     FILE#     BLOCK#	    ROW#
---------- ---------- ----------
	 1	  241	      27
SQL> select dump(97109,16) from dual;
DUMP(97109,16)
----------------------
Typ=2 Len=4: c3,a,48,a
SQL> select dump(97094,16) from dual;
DUMP(97094,16)
-----------------------
Typ=2 Len=4: c3,a,47,5f
-bash-4.1$ bbed blocksize=8192 mode=edit filename=/u01/app/oracle/oradata/oa/system01.dbf
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Sat Mar 14 19:30:18 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> show all
	FILE#          	0
	BLOCK#         	1
	OFFSET         	0
	DBA            	0x00000000 (0 0,1)
	FILENAME       	/u01/app/oracle/oradata/oa/system01.dbf
	BIFILE         	bifile.bbd
	LISTFILE
	BLOCKSIZE      	8192
	MODE           	Edit
	EDIT           	Unrecoverable
	IBASE          	Dec
	OBASE          	Dec
	WIDTH          	80
	COUNT          	512
	LOGFILE        	log.bbd
	SPOOL          	No
BBED> set block 241
	BLOCK#         	241
BBED> map
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 241                                   Dba:0x00000000
------------------------------------------------------------
 KTB Data Block (Table/Cluster)
 struct kcbh, 20 bytes                      @0
 struct ktbbh, 48 bytes                     @20
 struct kdbh, 14 bytes                      @68
 struct kdbt[1], 4 bytes                    @82
 sb2 kdbr[105]                              @86
 ub1 freespace[87]                          @296
 ub1 rowdata[7805]                          @383
 ub4 tailchk                                @8188
BBED> p *kdbr[27]
rowdata[0]
----------
ub1 rowdata[0]                              @383      0x2c
BBED> x /rnnncnnncc
rowdata[0]                                  @383
----------
flag@383:  0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@384:  0x00
cols@385:    18
col    0[2] @386: 1
col    1[4] @389: 97094
col    2[1] @394: 0
col   3[12] @396: _NEXT_OBJECT
col    4[2] @409: 1
col    5[0] @412: *NULL*
col    6[1] @413: 0
col    7[7] @415: xm....4
col    8[7] @423: xs....6
col    9[7] @431: xm....4
col   10[1] @439: .
col   11[0] @441: *NULL*
col   12[0] @442: *NULL*
col   13[1] @443: .
col   14[0] @445: *NULL*
col   15[1] @446: .
col   16[4] @448: ..8$
col   17[1] @453: .
BBED> set count 32
	COUNT          	32
BBED> set offset 389
	OFFSET         	389
BBED> d
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 241              Offsets:  389 to  420           Dba:0x00000000
------------------------------------------------------------------------
 04c30a47 5f01800c 5f4e4558 545f4f42 4a454354 02c102ff 01800778 6d080f01
 <32 bytes per line>
BBED> set offset +3
	OFFSET         	392
BBED> d
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 241              Offsets:  392 to  423           Dba:0x00000000
------------------------------------------------------------------------
 475f0180 0c5f4e45 58545f4f 424a4543 5402c102 ff018007 786d080f 01113407
 <32 bytes per line>
BBED> m /x 480a
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 241              Offsets:  392 to  423           Dba:0x00000000
------------------------------------------------------------------------
 480a0180 0c5f4e45 58545f4f 424a4543 5402c102 ff018007 786d080f 01113407
 <32 bytes per line>
BBED>  p *kdbr[27]
rowdata[0]
----------
ub1 rowdata[0]                              @383      0x2c
BBED> x /rnnncnnncc
rowdata[0]                                  @383
----------
flag@383:  0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@384:  0x00
cols@385:    18
col    0[2] @386: 1
col    1[4] @389: 97109
col    2[1] @394: 0
col   3[12] @396: _NEXT_OBJECT
col    4[2] @409: 1
col    5[0] @412: *NULL*
col    6[1] @413: 0
col    7[7] @415: xm....4
col    8[7] @423: xs....6
col    9[7] @431: xm....4
col   10[1] @439: .
col   11[0] @441: *NULL*
col   12[0] @442: *NULL*
col   13[1] @443: .
col   14[0] @445: *NULL*
col   15[1] @446: .
col   16[4] @448: ..8$
col   17[1] @453: .
BBED> sum apply
Check value for File 0, Block 241:
current = 0x913d, required = 0x913d

验证bbed修改后效果

SQL> startup
ORACLE instance started.
Total System Global Area 2.6991E+10 bytes
Fixed Size		    2213976 bytes
Variable Size		 1.9327E+10 bytes
Database Buffers	 7516192768 bytes
Redo Buffers		  145174528 bytes
Database mounted.
Database opened.
SQL> select /*+ index(t i_obj4) */ rowid,DATAOBJ#,type#,owner# from obj$  t
minus
select /*+ full(t1) */ rowid,DATAOBJ#,type#,owner# from obj$  t1;
  2    3
no rows selected
SQL>  select /*+ full(t1) */ rowid,DATAOBJ#,type#,owner# from obj$  t1
  minus
  select /*+ index(t i_obj4) */ rowid,DATAOBJ#,type#,owner# from obj$  t
  ;
  2    3    4
no rows selected
SQL> ANALYZE TABLE sys.obj$ VALIDATE STRUCTURE CASCADE;
ANALYZE TABLE sys.obj$ VALIDATE STRUCTURE CASCADE
*
ERROR at line 1:
ORA-01499: table/index cross reference failure - see trace file
SQL> create table t_xifenfei as select * from dual;
create table t_xifenfei as select * from dual
                                         *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 39, file 1, block 93842 (2)

这里比较悲剧,我们看到i_obj4和obj$中对应记录已经一致(条数和数据值),但是依然不能执行创建表操作,依旧报ORA-8102错误.

进一步分析错误原因

SQL> ALTER SESSION SET EVENTS '802 trace name errorstack level 3';
Session altered.
SQL> create table t as select * from dual;
create table t as select * from dual
                                *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 39, file 1, block 93842 (2)
SQL> select value from v$diag_info where name='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/oa/oa/trace/oa_ora_6163.trc
oer 8102.2 - obj# 39, rdba: 0x00416e92(afn 1, blk# 93842)
kdk key 8102.2:
  ncol: 4, len: 16
  key: (16):  04 c3 0a 48 0a 01 80 01 80 06 00 40 00 f1 00 1b
--这里可以看出来,提示ORA-8102错误依旧在I_OBJ4,97109记录上
SQL> select max(dataobj#) from obj$;
MAX(DATAOBJ#)
-------------
	96815
SQL> select name,obj#,dataobj# from obj$ where rowid='AAAAASAABAAAADxAAb';
NAME				     OBJ#   DATAOBJ#
------------------------------ ---------- ----------
_NEXT_OBJECT				1      97109
--这里很奇怪,通过rowid查询我们已经的出来在obj$中有dataobj#为97109,而通过max(dataobj#)只有96815
分析max(dataobj#)执行计划
SQL> SET AUTOT TRACE
SQL> select max(dataobj#) from obj$;
Execution Plan
----------------------------------------------------------
Plan hash value: 721075849
------------------------------------------------------------------------------------
| Id  | Operation		   | Name   | Rows  | Bytes | Cost (%CPU)| Time    |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT	   |	    |	  1 |	  2 |	  2   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE 	   |	    |	  1 |	  2 |		 |    |
|   2 |   INDEX FULL SCAN (MIN/MAX)| I_OBJ4 |	  1 |	  2 |	  2   (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Statistics
----------------------------------------------------------
	  0  recursive calls
	  0  db block gets
	  2  consistent gets
	  0  physical reads
	  0  redo size
	533  bytes sent via SQL*Net to client
	520  bytes received via SQL*Net from client
	  2  SQL*Net roundtrips to/from client
	  0  sorts (memory)
	  0  sorts (disk)
	  1  rows processed
--这里知晓,由于max(dataobj#)使用了INDEX FULL SCAN (MIN/MAX)执行计划,从而的出来最大值为96815,
--而我们从ORA-8102错误中可以看到index中有dataobj#为97109,证明index中的链表可能出问题
--为什么怀疑是链表有问题呢?因为该index的ffs正常

尝试把ORA-8102报错标记坏块尝试
并且通过event和隐含参数屏蔽index坏块

-bash-4.1$ bbed blocksize=8192 mode=edit filename=/u01/app/oracle/oradata/oa/system01.dbf
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Sat Mar 14 20:30:58 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set block 93842
	BLOCK#         	93842
BBED> set offset 8188
	OFFSET         	8188
BBED> d
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 93842            Offsets: 8188 to 8191           Dba:0x00000000
------------------------------------------------------------------------
 010675ad
 <32 bytes per line>
BBED> m /x 02
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 93842            Offsets: 8188 to 8191           Dba:0x00000000
------------------------------------------------------------------------
 020675ad
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 93842:
current = 0x9186, required = 0x9186
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/oa/system01.dbf
BLOCK = 93842
Block 93842 is corrupt
Corrupt block relative dba: 0x00416e92 (file 0, block 93842)
Fractured block found during verification
Data in bad block:
 type: 6 format: 2 rdba: 0x00416e92
 last change scn: 0x0000.c007ad75 seq: 0x1 flg: 0x06
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0xad750602
 check value in block header: 0x9186
 computed block checksum: 0x0
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 1
Total Blocks Influx           : 2
Message 531 not found;  product=RDBMS; facility=BBED
-bash-4.1$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Mar 14 20:33:19 2015
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup pfile='/tmp/pfile'
ORACLE instance started.
Total System Global Area 2.6991E+10 bytes
Fixed Size		    2213976 bytes
Variable Size		 1.9327E+10 bytes
Database Buffers	 7516192768 bytes
Redo Buffers		  145174528 bytes
Database mounted.
Database opened.
SQL> create table t as select * from dual;
create table t as select * from dual
                                *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 1, block # 93842)
ORA-01110: data file 1: '/u01/app/oracle/oradata/oa/system01.dbf'

通过这一步测试证明,在该ora-8102的错误中,通过坏块是无法解决绕过去该错误,只是把错误从ORA-8102转变为了ORA-1578

修复好制造坏块block

BBED> m /x 01
 File: /u01/app/oracle/oradata/oa/system01.dbf (0)
 Block: 93842            Offsets: 8188 to 8191           Dba:0x00000000
------------------------------------------------------------------------
 010675ad
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 93842:
current = 0x9185, required = 0x9185
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/oa/system01.dbf
BLOCK = 93842
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 1
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2.6991E+10 bytes
Fixed Size		    2213976 bytes
Variable Size		 1.9327E+10 bytes
Database Buffers	 7516192768 bytes
Redo Buffers		  145174528 bytes
Database mounted.
Database opened.
SQL> create table t1 as select * from dual;
create table t1 as select * from dual
                                 *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 39, file 1, block 93842 (2)

至此我们大体出来信息:
1. ORA-8102的是I_OBJ4中的_NEXT_OBJECT记录异常和该index链表异常
2. 通过bbed修改I_OBJ4和obj$中相应记录无法解决该问题,因为还有链表异常
3. 通过标记为坏块也无法绕过该问题
由于后续如果继续修复修复i_obj4可能工作量过大,而且可以也比较急,通过人工直接删除I_OBJ4数据字典记录,然后结合bootstrap$核心index(I_OBJ1,I_USER1,I_FILE#_BLOCK#,I_IND1,I_TS#,I_CDEF1等)异常恢复—ORA-00701错误解决处理实现完美恢复

使用bbed 修复I_OBJ4 index 报ORA-8102错误

数据库执行创建表操作报ORA-8102错误

SQL> startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             469765360 bytes
Database Buffers         1090519040 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL> create table t1 as select * from dba_users;
create table t1 as select * from dba_users
                                 *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 87404, file 1, block 97266 (2)

分析ORA-8102错误

SQL> col OBJECT_NAME for a30
SQL> select object_name,object_type from dba_objects where object_id=87404;
OBJECT_NAME                    OBJECT_TYPE
------------------------------ -------------------
I_OBJ4                         INDEX
SQL> select /*+ index(t i_obj4) */ DATAOBJ#,type#,owner# from obj$  t
minus
  2    3  select /*+ full(t1) */ DATAOBJ#,type#,owner# from obj$  t1;
  DATAOBJ#      TYPE#     OWNER#
---------- ---------- ----------
     87420          0          0
SQL> select /*+ full(t1) */ DATAOBJ#,type#,owner# from obj$  t1
  2  minus
  3  select /*+ index(t i_obj4) */ DATAOBJ#,type#,owner# from obj$  t
  4  ;
  DATAOBJ#      TYPE#     OWNER#
---------- ---------- ----------
     87422          0          0
SQL> alter system dump datafile 1 block 97266;
System altered.
SQL>  select value from v$diag_info where name='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_27037.trc
SQL> ALTER SESSION SET EVENTS '802 trace name errorstack level 3';
Session altered.
SQL> create table t1 as select * from dual;
create table t1 as select * from dual
                                 *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 87404, file 1, block 97266 (2)
SQL>  select value from v$diag_info where name='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_27037.trc
*** 2015-03-14 14:46:33.640
kdk key 8102.2:
  ncol: 4, len: 16
  key: (16):  04 c3 09 4b 17 01 80 01 80 06 00 41 7f 25 00 28
  mask: (4096):
*** 2015-03-14 14:46:33.644
dbkedDefDump(): Starting a non-incident diagnostic dump (flags=0x0, level=3, mask=0x0)
----- Error Stack Dump -----
----- Current SQL Statement for this session (sql_id=4yyb4104skrwj) -----
update obj$ set obj#=:4, type#=:5,ctime=:6,mtime=:7,stime=:8,status=:9,dataobj#=:10,flags=:11,
oid$=:12,spare1=:13, spare2=:14 where owner#=:1 and name=:2 and namespace=:3 and
remoteowner is null and linkname is null and subname is null

这里可以的出来由于obj$中的dataobj#为87422,而i_obj4中的dataobj#为87420,因此两者不一致。
另外通过相关trace发现,在创建表操作中会调用update obj$的一个递归操作,而该操作会更新dataobj#,但是由于该值在表和index中不匹配,因此出现ORA-08102导致创建表不成功

使用bbed 修复ORA-8102

[oracle@localhost ~]$ bbed blocksize=8192 mode=edit filename='/u01/app/oracle/oradata/xifenfei/system01.dbf'
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Sat Mar 14 14:55:22 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set block 97266
        BLOCK#          97266
BBED> f /x 04c3
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2714 to 3225           Dba:0x00000000
------------------------------------------------------------------------
 04c3094a 5f02c115 01800600 417f2500 0f000204 c3094b14 02c11501 80060041
 7f25000e 000204c3 094b1202 c1140180 0600417f 25000d00 0004c309 4b150180
 <32 bytes per line>
BBED> f
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2733 to 3244           Dba:0x00000000
------------------------------------------------------------------------
 04c3094b 1402c115 01800600 417f2500 0e000204 c3094b12 02c11401 80060041
 7f25000d 000004c3 094b1501 80018006 00417f25 00280100 04c3094b 10018001
 <32 bytes per line>
BBED> f
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2752 to 3263           Dba:0x00000000
------------------------------------------------------------------------
 04c3094b 1202c114 01800600 417f2500 0d000004 c3094b15 01800180 0600417f
 25002801 0004c309 4b100180 01800600 417f2500 28000004 c3094b08 02c10201
 <32 bytes per line>
BBED> f
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2771 to 3282           Dba:0x00000000
------------------------------------------------------------------------
 04c3094b 15018001 80060041 7f250028 010004c3 094b1001 80018006 00417f25
 00280000 04c3094b 0802c102 01800600 417f2500 24000004 c3094b09 02c10201
 <32 bytes per line>
BBED> f
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2789 to 3300           Dba:0x00000000
------------------------------------------------------------------------
 04c3094b 10018001 80060041 7f250028 000004c3 094b0802 c1020180 0600417f
 25002400 0004c309 4b0902c1 02018006 00417f25 00250000 04c3094b 0a02c103
 <32 bytes per line>
BBED> set count 32
        COUNT           32
BBED> set offset 2771
        OFFSET          2771
BBED> d
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2771 to 2802           Dba:0x00000000
------------------------------------------------------------------------
 04c3094b 15018001 80060041 7f250028 010004c3 094b1001 80018006 00417f25
 <32 bytes per line>
BBED> set offset +4
        OFFSET          2775
BBED> d
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2775 to 2806           Dba:0x00000000
------------------------------------------------------------------------
 15018001 80060041 7f250028 010004c3 094b1001 80018006 00417f25 00280000
 <32 bytes per line>
BBED> m /x 17
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 2775 to 2806           Dba:0x00000000
------------------------------------------------------------------------
 17018001 80060041 7f250028 010004c3 094b1001 80018006 00417f25 00280000
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 97266:
current = 0x7955, required = 0x7955
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/xifenfei/system01.dbf
BLOCK = 97266
Block 97266 is corrupt
Corrupt block relative dba: 0x00417bf2 (file 0, block 97266)
Fractured block found during verification
Data in bad block:
 type: 6 format: 2 rdba: 0x00417bf2
 last change scn: 0x0000.00102ed8 seq: 0x1 flg: 0x06
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x2ed80602
 check value in block header: 0x7955
 computed block checksum: 0x0
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 1
Total Blocks Influx           : 2
Message 531 not found;  product=RDBMS; facility=BBED
BBED> set offset 8188
        OFFSET          8188
BBED> d
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 8188 to 8191           Dba:0x00000000
------------------------------------------------------------------------
 0206d82e
 <32 bytes per line>
BBED> m /x 01
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 97266            Offsets: 8188 to 8191           Dba:0x00000000
------------------------------------------------------------------------
 0106d82e
 <32 bytes per line>
BBED> sum
Check value for File 0, Block 97266:
current = 0x7955, required = 0x7956
BBED> sum apply
Check value for File 0, Block 97266:
current = 0x7956, required = 0x7956
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/xifenfei/system01.dbf
BLOCK = 97266
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 1
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

通过bbed修改i_obj4中的dataobj#值使之和obj$中对应值一致

验证确认ORA-8102被修复

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             469765360 bytes
Database Buffers         1090519040 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL>  create table t1 as select * from dual;
Table created.

通过使用bbed修改index值后,ORA-8102问题解决,可以执行创建表操作
姊妹篇见:通过bbed修改obj$中dataobj$重现I_OBJ4索引报ORA-08102错误

通过bbed修改obj$中dataobj$重现I_OBJ4索引报ORA-08102错误

在最近的数据库恢复中,经历了多次11.2库由于各种原因,数据库打开后,报ORA-8102错误,而且错误对象是OBJ$上的I_OBJ4这个index上,而且不能创建新表,周末开会闲着无事,进行了一个简单的模拟重现
数据库版本信息11.2.0.4

SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

定位需要破坏的OBJ$上记录,为了使之和I_OBJ4中记录不一致,从而实现ORA-8102错误

SQL> select object_id,object_type from dba_objects where object_name='I_OBJ4';
 OBJECT_ID OBJECT_TYPE
---------- -------------------
     87404 INDEX
SQL> select max(DATAOBJ#) from obj$;
MAX(DATAOBJ#)
-------------
        87420
SQL> select dump(87420,16) from dual;
DUMP(87420,16)
-----------------------
Typ=2 Len=4: c3,9,4b,15
SQL> select dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,
dbms_rowid.rowid_row_number(rowid) row#
  2    3  from obj$ where DATAOBJ#=87420;
     FILE#     BLOCK#       ROW#
---------- ---------- ----------
         1      98085         40
SQL>  alter system dump datafile 1  block 98085;
System altered.
SQL>  select value from v$diag_info where name='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/xifenfei/xifenfei/trace/xifenfei_ora_26373.trc
--dump该记录显示
tab 0, row 40, @0x11fc
tl: 72 fb: --H-FL-- lb: 0x0  cc: 18
col  0: [ 2]  c1 02
col  1: [ 4]  c3 09 4b 15
col  2: [ 1]  80
col  3: [12]  5f 4e 45 58 54 5f 4f 42 4a 45 43 54
col  4: [ 2]  c1 02
col  5: *NULL*
col  6: [ 1]  80
col  7: [ 7]  78 71 08 18 0c 26 24
col  8: [ 7]  78 73 03 0d 15 2e 2b
col  9: [ 7]  78 71 08 18 0c 26 24
col 10: [ 1]  80
col 11: *NULL*
col 12: *NULL*
col 13: [ 1]  80
col 14: *NULL*
col 15: [ 1]  80
col 16: [ 4]  c3 07 38 24
col 17: [ 1]  80
tab 0, row 41, @0x9af
tl: 2 fb: --HDFL-- lb: 0x2

这里我们知道i_obj4中的dataobj#最大值为87420对应的16进制记录为04 c3 09 4b 15

使用bbed破坏记录,修改dataobj#中的值,使得obj$.dataobj#和i_obj4中的dataobj#不匹配

SQL> select name from v$datafile where file#=1;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/xifenfei/system01.dbf
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@localhost ~]$ bbed blocksize=8192 mode=edit filename='/u01/app/oracle/oradata/xifenfei/system01.dbf'
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Sat Mar 14 14:23:02 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> show all
        FILE#           0
        BLOCK#          1
        OFFSET          0
        DBA             0x00000000 (0 0,1)
        FILENAME        /u01/app/oracle/oradata/xifenfei/system01.dbf
        BIFILE          bifile.bbd
        LISTFILE
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           80
        COUNT           512
        LOGFILE         log.bbd
        SPOOL           No
BBED> set block 98085
        BLOCK#          98085
BBED> p *kdbr[40]
rowdata[2446]
-------------
ub1 rowdata[2446]                           @4696     0x2c
BBED> x /rnnncnnncc
rowdata[2446]                               @4696
-------------
flag@4696: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@4697: 0x00
cols@4698:   18
col    0[2] @4699: 1
col    1[4] @4702: 87420
col    2[1] @4707: 0
col   3[12] @4709: _NEXT_OBJECT
col    4[2] @4722: 1
col    5[0] @4725: *NULL*
col    6[1] @4726: 0
col    7[7] @4728: xq...&$
col    8[7] @4736: xs....+
col    9[7] @4744: xq...&$
col   10[1] @4752: .
col   11[0] @4754: *NULL*
col   12[0] @4755: *NULL*
col   13[1] @4756: .
col   14[0] @4758: *NULL*
col   15[1] @4759: .
col   16[4] @4761: Ã.8$
col   17[1] @4766: .
BBED> set block 98085
        BLOCK#          98085
BBED> set offset 4702
        OFFSET          4702
BBED> set count 32
        COUNT           32
BBED> d
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 98085            Offsets: 4702 to 4733           Dba:0x00000000
------------------------------------------------------------------------
 04c3094b 1501800c 5f4e4558 545f4f42 4a454354 02c102ff 01800778 7108180c
 <32 bytes per line>
BBED> set offset +4
        OFFSET          4706
BBED> d
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 98085            Offsets: 4706 to 4737           Dba:0x00000000
------------------------------------------------------------------------
 1501800c 5f4e4558 545f4f42 4a454354 02c102ff 01800778 7108180c 26240778
 <32 bytes per line>
BBED> m /x 17
 File: /u01/app/oracle/oradata/xifenfei/system01.dbf (0)
 Block: 98085            Offsets: 4706 to 4737           Dba:0x00000000
------------------------------------------------------------------------
 1701800c 5f4e4558 545f4f42 4a454354 02c102ff 01800778 7108180c 26240778
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 98085:
current = 0xd361, required = 0xd361
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/xifenfei/system01.dbf
BLOCK = 98085
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

使用bbed 修改04 c3 09 4b 15为04 c3 09 4b 17

重现在obj$的I_OBJ4 index上报ORA-8102错误,而且不能创建新对象

SQL> startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             469765360 bytes
Database Buffers         1090519040 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL> create table t1 as select * from dba_users;
create table t1 as select * from dba_users
                                 *
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-08102: index key not found, obj# 87404, file 1, block 97266 (2)
SQL> col OBJECT_NAME for a30
SQL> select object_name,object_type from dba_objects where object_id=87404;
OBJECT_NAME                    OBJECT_TYPE
------------------------------ -------------------
I_OBJ4                         INDEX

如果修复该问题请见:使用bbed 修复I_OBJ4 index 报ORA-8102

注意系统bug—linux在E5、E5 V2、E7 V2 cpu之上的bug 765720

今天晚上群里面兄弟说了一个linux 6上面bug,会导致系统在运行200天以上(hardware uptime),然后进行热重启后,可能在几分钟或者几个小时内出发该bug,导致系统异常.

主要影响条件为:
Red Hat Enterprise Linux 6.1 (kernel-2.6.32-131.26.1.el6 and newer)
Red Hat Enterprise Linux 6.2 (kernel-2.6.32-220.4.2.el6 and newer)
Red Hat Enterprise Linux 6.3 (kernel-2.6.32-279 series)
Red Hat Enterprise Linux 6.4 (kernel-2.6.32-358 series)
Any Intel® Xeon® E5, Intel® Xeon® E5 v2, or Intel® Xeon® E7 v2 series processor
从这里可以看出来该问题主要影响E5、E5 V2、E7 V2 cpu上的redhat 6.1-6.4版本,在6.5版本中修复,具体参考:bug 765720
另外对已ORACLE Linux,如果使用EL Kernel影响和redhat一致,如果使用Unbreakable Enterprise Kernel则在6.2版本中进行了修复该问题。
MOS上类似文章:Oracle Linux 6 RHCK system hang: processes blocked in ext4_file_open(), pick_next_task_fair()

补充说明:
1. 在Red Hat/OEL 5.x版本中不存在。
2. 在32和64位操作系统都有可能发生
3. 鉴于该bug短期内无法修复,而且真的发生了,考虑冷重启主机,临时规避

再次提醒:系统版本选定也很重要,大家在选择Linux版本之时尽量选择避开该bug(el kernel 6.5及其以后版本,uek kernel 6.2及其以后版本)。个人倾向:如果是部署ORACLE db,而且还是redhat系列Linux,更加倾向OEL(省事,相信Oracle)

ORACLE 12C 新特性Identity Columns—实现ORACLE自增长列功能

在ORACLE 12C以前的版本中,如果要实现列自增长,需要通过序列+触发器实现,到了12C ORACLE 引进了Identity Columns新特性,从而实现了列自增长功能,和mysql,sql server类似功能.
使用语法
ORACLE 12C IDENTITY
GENERATED ALWAYS AS IDENTITY方式测试

C:\Users\ffcheng>sqlplus chf/xifenfei@pdb
SQL*Plus: Release 12.1.0.2.0 Production on 星期二 3月 10 14:34:46 2015
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
上次成功登录时间: 星期五 12月 19 2014 21:00:26 +08:00
连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions
XFF_PDB@CHF> select * from v$version;
BANNER                                                 CON_ID
-------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.          0
1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production                      0
CORE    12.1.0.2.0      Production                          0
TNS for 64-bit Windows: Version 12.1.0.2.0 - Produ          0
ction
NLSRTL Version 12.1.0.2.0 - Production                      0
XFF_PDB@CHF>  create table t_xifenfei (id number GENERATED ALWAYS AS IDENTITY,na
me varchar2(100));
表已创建。
XFF_PDB@CHF> select object_name,object_type from user_objects;
OBJECT_NAME     OBJECT_TYPE
--------------- -----------------------
ISEQ$$_91982    SEQUENCE
T_XIFENFEI      TABLE
XFF_PDB@CHF> set long 10000
XFF_PDB@CHF> select dbms_metadata.get_ddl('TABLE','T_XIFENFEI') FROM DUAL;
DBMS_METADATA.GET_DDL('TABLE','T_XIFENFEI')
--------------------------------------------------------------------------------
  CREATE TABLE "CHF"."T_XIFENFEI"
   (    "ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE
   9999999999999999999999999999 INCREMENT BY 1 START WITH 1
   CACHE 20 NOORDER  NOCYCLE  NOT NULL ENABLE,
        "NAME" VARCHAR2(100)
   ) SEGMENT CREATION DEFERRED
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  TABLESPACE "INMEMORY"
XFF_PDB@CHF> INSERT INTO T_XIFENFEI VALUES(1,'WWW.XIFNEFEI.COM');
INSERT INTO T_XIFENFEI VALUES(1,'WWW.XIFNEFEI.COM')
*
第 1 行出现错误:
ORA-32795: 无法插入到“始终生成”身份列
XFF_PDB@CHF> INSERT INTO T_XIFENFEI(name) VALUES('WWW.XIFNEFEI.COM');
已创建 1 行。
XFF_PDB@CHF> INSERT INTO T_XIFENFEI(name) VALUES('WWW.orasos.COM');
已创建 1 行。
XFF_PDB@CHF> commit;
提交完成。
XFF_PDB@CHF> col name for a30
XFF_PDB@CHF> select * from t_xifenfei;
        ID NAME
---------- ------------------------------
         1 WWW.XIFNEFEI.COM
         2 WWW.orasos.COM
XFF_PDB@CHF> update t_xifenfei set id=3 where id=2;
update t_xifenfei set id=3 where id=2
                      *
第 1 行出现错误:
ORA-32796: 无法更新“始终生成”身份列
XFF_PDB@CHF> delete from t_xifenfei where id=1;
已删除 1 行。
XFF_PDB@CHF> commit;
提交完成。
XFF_PDB@CHF> select ISEQ$$_91982.nextval from dual;
   NEXTVAL
----------
         3
XFF_PDB@CHF> INSERT INTO T_XIFENFEI(name) VALUES('WWW.ORASOS.COM');
已创建 1 行。
XFF_PDB@CHF> commit;
提交完成。
XFF_PDB@CHF> select * from t_xifenfei;
        ID NAME
---------- ------------------------------
         2 WWW.orasos.COM
         4 WWW.ORASOS.COM
XFF_PDB@CHF> ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 1
2';
会话已更改。
XFF_PDB@CHF>  select value from v$diag_info where name='Default Trace File';
VALUE
--------------------------------------------------------------------------------
D:\APP\FFCHENG\diag\rdbms\xff\xff\trace\xff_ora_10628.trc
XFF_PDB@CHF> INSERT INTO T_XIFENFEI(name) VALUES('WWW.XIFENFEI.COM');
已创建 1 行。
XFF_PDB@CHF> COMMIT;
提交完成。
--跟踪trace文件
PARSING IN CURSOR #688719640 len=55 dep=0 uid=103 oct=2 lid=103 tim=15129490112 hv=961646460
ad='7ff05d11a18' sqlid='21uzyjhwp33vw'
INSERT INTO T_XIFENFEI(name) VALUES('WWW.XIFENFEI.COM')
END OF STMT
PARSE #688719640:c=15600,e=18909,p=0,cr=44,cu=0,mis=1,r=0,dep=0,og=1,plh=2541165129,tim=15129490112
EXEC #688719640:c=0,e=347,p=0,cr=1,cu=5,mis=0,r=1,dep=0,og=1,plh=2541165129,tim=15129490731
STAT #688719640 id=1 cnt=0 pid=0 pos=1 obj=0 op='LOAD TABLE CONVENTIONAL  T_XIFENFEI (cr=1 pr=0 pw=0 time=296 us)'
STAT #688719640 id=2 cnt=1 pid=1 pos=1 obj=91983 op='SEQUENCE  ISEQ$$_91982 (cr=0 pr=0 pw=0 time=89 us)'
WAIT #688719640: nam='SQL*Net message to client' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=15129490971
XFF_PDB@CHF> alter table t_xifenfei2 modify(id number GENERATED ALWAYS AS IDENTI
TY MINVALUE 1 MAXVALUE 99999999999999 INCREMENT BY 1 START WITH 1 CACHE  100);
表已更改。
XFF_PDB@CHF> drop sequence ISEQ$$_91982;
drop sequence ISEQ$$_91982
              *
第 1 行出现错误:
ORA-32794: 无法删除系统生成的序列
XFF_PDB@CHF> drop table t_xifenfei;
表已删除。
XFF_PDB@CHF> select object_name,object_type from user_objects where object_name=
'ISEQ$$_91982';
OBJECT_NAME          OBJECT_TYPE
-------------------- -----------------------
ISEQ$$_91982         SEQUENCE
XFF_PDB@CHF> select object_name,object_type from user_objects where object_name=
'ISEQ$$_91982';
OBJECT_NAME          OBJECT_TYPE
-------------------- -----------------------
ISEQ$$_91982         SEQUENCE
XFF_PDB@CHF> purge table t_xifenfei;
表已清除。
XFF_PDB@CHF> select object_name,object_type from user_objects where object_name=
'ISEQ$$_91982';
未选定行

这里的出来几个结论:
1. GENERATED ALWAYS AS IDENTITY 列无法人工指定值和修改该值
2. GENERATED IDENTITY 本质也是通过sequence实现
3. GENERATED IDENTITY 中sequence不能单独被删除
4. GENERATED IDENTITY 中的表删除,如果存在回收站中,该sequence依然存储,如果表被彻底删除,则sequence也被删除
5. GENERATED IDENTITY 中的sequence可以通过select 语句查询
6. 通过alert table 语句来修改GENERATED IDENTITY 的sequence相关值

GENERATED BY DEFAULT AS IDENTITY方式测试

XFF_PDB@CHF>  create table t_xifenfei2 (id number GENERATED BY DEFAULT AS IDENTI
TY,name varchar2(100)) tablespace users;
表已创建。
XFF_PDB@CHF> insert into t_xifenfei2 values (1,'www.xifenfei.com');
已创建 1 行。
XFF_PDB@CHF> insert into t_xifenfei2(name) values ('www.orasos.com');
已创建 1 行。
XFF_PDB@CHF> col name for a20
XFF_PDB@CHF> select * from t_xifenfei2;
        ID NAME
---------- --------------------
         1 www.xifenfei.com
         1 www.orasos.com
XFF_PDB@CHF> insert into t_xifenfei2 values (null,'www.xifenfei.com');
insert into t_xifenfei2 values (null,'www.xifenfei.com')
                                *
第 1 行出现错误:
ORA-01400: 无法将 NULL 插入 ("CHF"."T_XIFENFEI2"."ID")
XFF_PDB@CHF> desc t_xifenfei2
 名称                                      是否为空? 类型
 ----------------------------------------- -------- ---------------------------
 ID                                        NOT NULL NUMBER
 NAME                                               VARCHAR2(100)

得出结论:
1. GENERATED BY DEFAULT AS IDENTITY方式不能在该列中插入null值
2. GENERATED BY DEFAULT AS IDENTITY方式可以指定具体值插入

GENERATED BY DEFAULT ON NULL AS IDENTITY方式测试

XFF_PDB@CHF>  create table t_xifenfei3 (id number GENERATED BY DEFAULT on null A
S IDENTITY,name varchar2(100)) tablespace users;
表已创建。
XFF_PDB@CHF> desc t_xifenfei3
 名称                                      是否为空? 类型
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL NUMBER
 NAME                                               VARCHAR2(100)
XFF_PDB@CHF> insert into t_xifenfei3 values (null,'www.xifenfei.com');
已创建 1 行。
XFF_PDB@CHF> select * from t_xifenfei3;
        ID NAME
---------- --------------------
         1 www.xifenfei.com

测试结论:GENERATED BY DEFAULT ON NULL AS IDENTITY的列上可以查询null值,只是默认转换为对应的sequence值

传统自增长列实现方法

XFF_PDB@CHF> create table t_xifenfei4 (id number,name varchar2(100)) tablespace
users;
表已创建。
XFF_PDB@CHF> create sequence xff_sequence
  2  increment by 1
  3  minvalue 1
  4  nomaxvalue
  5  start with 1
  6  cache 20
  7  order;
序列已创建。
XFF_PDB@CHF> create or replace trigger xifenfei_id
  2  before insert on t_xifenfei4
  3  for each row
  4  begin
  5  select xff_sequence.nextval into :new.id from dual;
  6  end;
  7  /
触发器已创建
XFF_PDB@CHF> insert into t_xifenfei4(name) values('www.xifenfei.com');
已创建 1 行。
XFF_PDB@CHF> select * from t_xifenfei4;
        ID NAME
---------- --------------------
         1 www.xifenfei.com