WEB开发网
开发学院数据库MySQL My SQL数据库下损坏数据的恢复操作过程总结 阅读

My SQL数据库下损坏数据的恢复操作过程总结

 2008-09-03 11:07:12 来源:WEB开发网   
核心提示: 注:此为记录我当时操作的全部过程D:Documents and SettingsAdministrator>c:C:>cd mysqlC:mysql>cd dataC:mysqldata>cd hw_enterpriceC:mysqldatahw_enterpric

注:此为记录我当时操作的全部过程

D:Documents and SettingsAdministrator>c:

C:>cd mysql

C:mysql>cd data

C:mysqldata>cd hw_enterprice

C:mysqldatahw_enterprice>myisamchk function_products.frm

‘myisamchk’ 不是内部或外部命令,也不是可运行的程序或批处理文件。

C:mysqldatahw_enterprice>cd

C:>cd mysql

C:mysql>cd bin

注:查看myisamchk的帮助信息 

C:mysqlbin>myisamchkmyisamchkVer2.6forWin95/Win98ati32ByMonty,foryourprofessionaluseThissoftwarecomeswithNOWARRANTY:seethePUBLICfordetails.Description,checkandrepairofISAMtables.UsedwithoutoptionsalltablesonthecommandwillbecheckedforerrorsUsage:myisamchk[OPTIONS]tables[.MYI]Globaloptions:-#,–debug=…Outputdebuglog.Oftenthisis‘d:t:o,filename’-?,–helpDisplaythishelpandexit.-O,–set-variablevar=optionChangethevalueofavariable.Pleasenotethatthisoptionisdeprecated;youcansetvariablesdirectlywith‘–variable-name=value’.-t,–tmpdir=pathPathfortemporaryfiles-s,–silentOnlyprinterrors.Onecanusetwo-stomakemyisamchkverysilent-v,–verbosePrintmoreinformation.Thiscanbeusedwith–descriptionand–check.Usemany-vformoreverbosity!-V,–versionPrintversionandexit.-w,–waitWaitiftableislocked.Checkoptions(checkisthedefaultactionformyisamchk):-c,–checkChecktableforerrors-e,–extend-checkCheckthetableVERYthroughly.Onlyusethisinextremecasesasmyisamchkshouldnormallybeabletofindoutifthetableisokevenwithoutthisswitch-F,–fastCheckonlytablesthathaven’tbeenclosedproperly-C,–check-only-changedCheckonlytablesthathavechangedsincelastcheck-f,–forceRestartwith‘-r’ifthereareanyerrorsinthetable.Stateswillbeupdatedaswith‘–update-state’-i,–informationPrintstatisticsinformationabouttablethatischecked-m,–medium-checkFasterthanextend-check,butonlyfinds99.99%ofallerrors.Shouldbegoodenoughformostcases-U–update-stateMarktablesascrashedifyoufindanyerrors-T,–read-onlyDon’tmarktableascheckedRepairoptions(Whenusing‘-r’or‘-o’)-B,–backupMakeabackupofthe.MYDfileas‘filename-time.BAK’–correct-checksumCorrectchecksuminformationfortable.-D,–data-file-length=#Maxlengthofdatafile(whenrecreatingdatafilewhenit’sfull)-e,–extend-checkTrytorecovereverypossiblerowfromthedatafileNormallythiswillalsofindalotofgarbagerows;Don’tusethisoptionifyouarenottotallydesperate.-f,–forceOverwriteoldtemporaryfiles.-k,–keys-used=#TellMyISAMtoupdateonlysomespecifickeys.#isabitmaskofwhichkeystouse.Thiscanbeusedtogetfasterinserts!-r,–recoverCanfixalmostanythingexceptuniquekeysthataren’tunique.-n,–sort-recoverForcesrecoveringwithsortingevenifthetemporaryfilewouldbeverybig.-p,–parallel-recoverUsesthesametechniqueas‘-r’and‘-n’,butcreatesallthekeysinparallel,indifferentthreads.THISISALPHACODE.USEATYOUROWNRISK!-o,–safe-recoverUsesoldrecoverymethod;Slowerthan‘-r’butcanhandleacoupleofcaseswhere‘-r’reportsthatitcan’tfixthedatafile.–character-sets-dir=…Directorywherecharactersetsare–set-character-set=nameChangethecharactersetusedbytheindex-q,–quickFasterrepairbynotmodifyingthedatafile.Onecangiveasecond‘-q’toforcemyisamchktomodifytheoriginaldatafileincaseofduplicatekeys-u,–unpackUnpackfilepackedwithmyisampack.Otheractions:-a,–analyzeAnalyzedistributionofkeys.WillmakesomejoinsinMySQLfaster.Youcancheckthecalculateddistributionbyusing‘–description–verbosetable_name’.-d,–descriptionPrintssomeinformationabouttable.-A,–set-auto-increment[=value]Forceauto_incrementtostartatthisorhighervalueIfnovalueisgiven,thensetsthenextauto_incrementvaluetothehighestusedvaluefortheautokey+1.-S,–sort-indexSortindexblocks.Thisspeedsup‘read-next’inapplications-R,–sort-records=#Sortrecordsaccordingtoanindex.ThismakesyourdatamuchmorelocalizedandmayspeedupthingsC:mysqlbin>myisamchkc:mysqldatahw_enterpricefunction_products.frmmyisamchk:error:‘c:mysqldatahw_enterpricefunction_products.frm’isnotaMyISAM-tableC:mysqlbin>myisamchkc:mysqldatahw_enterpricefunction_products.myiCheckingMyISAMfile:c:mysqldatahw_enterpricefunction_products.myiDatarecords:85207deletedblocks:39myisamchk:warning:Tableismarkedascrashedmyisamchk:warning:1clientsisusingorhasn’tclosedthetableproperly-checkfile-size-checkkeydelete-chain-checkrecorddelete-chainmyisamchk:error:recorddelete-link-chaincorrupted-checkindexreference-checkdatarecordreferencesindex:1-checkdatarecordreferencesindex:2-checkdatarecordreferencesindex:3-checkrecordlinksmyisamchk:error:Wrongbytesec:0-195-171atlinkstart:841908MyISAM-table‘c:mysqldatahw_enterpricefunction_products.myi’iscorruptedFixitusingswitch“-r”or“-o”继续进行操作:C:mysqlbin>myisamchk–recover–quickc:mysqldatahw_enterpricefunction_products.myi-checkkeydelete-chain-checkrecorddelete-chainmyisamchk:error:recorddelete-link-chaincorruptedmyisamchk:error:Quick-recoveraborted;Runrecoverywithoutswitch‘q’UpdatingMyISAMfile:c:mysqldatahw_enterpricefunction_products.myiMyISAM-table‘c:mysqldatahw_enterpricefunction_products.myi’isnotfixedbecauseoferrorsTryfixingitbyusingthe–safe-recover(-o)orthe–force(-f)option系统提示我使用–safe-recover(-o)orthe–force(-f)option进行修复操作,于是C:mysqlbin>myisamchk–safe-recoverc:mysqldatahw_enterpricefunction_products.myi-recovering(withkeycache)MyISAM-table‘c:mysqldatahw_enterpricefunction_products.myi’Datarecords:85207Wrongbytesec:0-195-171at841908;SkippedDatarecords:85215

将修复后的物理文件复制到mysqldata下之后,通过phpMyAdmin进行访问,OK正常!

上一页  1 2 3 4  下一页

Tags:My SQL 数据库

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接