我有一个数据库服务器(Fedora 14),其中mysql是作为数据库服务器运行的。 最近服务器崩溃了,我只能从服务器上获取数据库目录。
我试图把我的数据库目录从分解服务器中获取到另一台PC(也是Fedora 14)上运行的mysql服务器上,但是只有三个表有数据,而且显示了表名,我尝试执行查询,它说表不可用,除了三个表。 那个数据库里有30个表格。
请告诉我一种方法来恢复那些缺less的表格。
我试图修复表如下,但它不是成功,
mysql> show tables; +-----------------------+ | Tables_in_ofm_mnu_jvs | +-----------------------+ | Company | | CostCenters | | CostVariable | | Des_Note | | EDN_Main | | EDN_Sub | | Factory | | ICMT_Main | | ICMT_Sub | | IMT_Main | | IMT_Sub | | ItemLedger | | JC_InOutCrop | | JC_Main | | Ledger | | Log | | OLD_Stock | | SRN_Main | | SRN_Sub | | St_BFG | | St_FGS | | St_OGS | | St_OLS1 | | St_OLS2 | | St_OLS3 | | St_OLS4 | | St_OLS5 | | St_RAW | | St_RDS | | St_SPG | | SysUpdate | | Vw_AllStock | | Vw_AllStokMove | | Vw_AllStokMove1 | | Vw_ExcropBalance | | Vw_JCSummary | | a_user | | act_months | | batchno | | certification | | e_email | | grn_main | | grn_sub | | item_code | | item_grade | | mtn | | san | | stocktype | | supplier | | uom | | zc_Block | | zc_Cetification | | zc_FarmerAccount | | zc_FarmerCer | | zc_FarmerCompany | | zc_FarmerCrop | | zc_FarmerReg | | zc_IcsYear | | zc_Society | | zc_temfar_crop | | zc_temfar_main | | zc_user | +-----------------------+ 62 rows in set (0.00 sec) mysql> repair table Company; +---------------------+--------+----------+-------------------------------------------+ | Table | Op | Msg_type | Msg_text | +---------------------+--------+----------+-------------------------------------------+ | ofm_mnu_jvs.Company | repair | Error | Table 'ofm_mnu_jvs.Company' doesn't exist | | ofm_mnu_jvs.Company | repair | status | Operation failed | +---------------------+--------+----------+-------------------------------------------+ 2 rows in set (0.00 sec)
我认为我的表不是MyISAM表,因为当我运行myisamchk * .MYI时,我得到了以下结果,
myisamchk *.MYI Checking MyISAM file: act_months.MYI Data records: 2 Deleted blocks: 0 myisamchk: warning: 1 client is using or hasn't closed the table properly - check file-size - check record delete-chain - check key delete-chain - check index reference - check data record references index: 1 - check record links MyISAM-table 'act_months.MYI' is usable but should be fixed --------- Checking MyISAM file: OLD_Stock.MYI Data records: 115375 Deleted blocks: 0 myisamchk: warning: 7 clients are using or haven't closed the table properly - check file-size - check record delete-chain - check key delete-chain - check index reference - check data record references index: 1 - check data record references index: 2 - check record links MyISAM-table 'OLD_Stock.MYI' is usable but should be fixed --------- Checking MyISAM file: zc_IcsYear.MYI Data records: 0 Deleted blocks: 0 - check file-size - check record delete-chain - check key delete-chain - check index reference - check data record references index: 1 - check record links [root@localhost ofm_mnu_jvs]# myisamchk *.frm myisamchk: error: 'act_months.frm' is not a MyISAM-table --------- myisamchk: error: 'a_user.frm' is not a MyISAM-table --------- myisamchk: error: 'batchno.frm' is not a MyISAM-table --------- myisamchk: error: 'certification.frm' is not a MyISAM-table --------- myisamchk: error: 'Company.frm' is not a MyISAM-table --------- myisamchk: error: 'CostCenters.frm' is not a MyISAM-table --------- myisamchk: error: 'CostVariable.frm' is not a MyISAM-table --------- myisamchk: error: 'Des_Note.frm' is not a MyISAM-table --------- myisamchk: error: 'EDN_Main.frm' is not a MyISAM-table --------- myisamchk: error: 'EDN_Sub.frm' is not a MyISAM-table --------- myisamchk: error: 'e_email.frm' is not a MyISAM-table --------- myisamchk: error: 'Factory.frm' is not a MyISAM-table --------- . . . .
你最确定你正在运行相同的数据库版本。 包括次要版本。 如果表是MyISAM,则可以使用myisamchk进行恢复。 请参阅: http : //dev.mysql.com/doc/refman/5.0/en/myisam-table-maintenance.html