Magento数据库修复工具Magento Database Repair Tool

3,951次阅读
2 条评论

共计 3849 个字符,预计需要花费 10 分钟才能阅读完成。

Magento数据库结构极其复杂,如果遇到数据库结构错误,想手动检查恢复简直是不可能的事情。好在Magento官方提供了一个非常不错的数据库修复工具,Magento Database Repair Tool,目前的版本是1.1。 Magento数据库修复工具的使用非常简单,只有一个简单的php文件。下载之后解压到任何可以通过web服务器访问的地方。在介绍使用方式之…

Magento数据库结构极其复杂,如果遇到数据库结构错误,想手动检查恢复简直是不可能的事情。好在Magento官方提供了一个非常不错的数据库修复工具,Magento Database Repair Tool,目前的版本是1.1。

The Database Repair Tool compares 2 databases (reference [”corrupted”] and target), and updates the target database so it has the same structure as the reference database by doing the following:

  • Adds missing tables, or repairs them to have the same engine type and charset
  • Adds missing fields or repairs them
  • Removes inconsistent data from tables that have broken foreign key references
  • Adds missing foreign keys and indexes

A typical use case for this tool is to fix the database of an existing Magento installation that has some of the errors mentioned above.

Usage Instructions

Crash-course for the impatient

Install the same version of Magento you’re using into a clean database. Use the new database as “reference” and the current database as “corrupted”.

That’s it :)

Below come step-by-step instructions.

Test it before running on a Production Environment!

Warning! Before running the repair tool on a production environment, make sure you have tested it before on a development environment. Make sure to create a backup of your original database before running this tool

It is also highly encouraged to restrict access to your website while repairing the database. Here is an example of restricting your Magento instance to your IP address exclusively. Other visitors, including search spiders, will get the HTTP 503 Service Unavailable error.

Create a file 503.php in your Magento installation root:

  1. <?php
  2. header(‘HTTP/1.1 503 Service Unavailable’);
  3. header(‘Content-Type: text/plain; charset=UTF-8’);
  4. echo “503 Service Unavailable”;

In .htaccess or in Apache server configuration, add the following rewrite rule:

Magento数据库修复工具Magento Database Repair Tool

Where 127.0.0.1 (note the backslashes before dots) should be replaced with your IP-address.

Once you save this .htaccess file or reload Apache configuration, your site will be down until you restore the initial state.

Step-by step

  1. Download Magento database repair tool archive from the download page
  2. Uncompress the archive
  3. Put the magento-db-repair-tool-1.0.php into any folder on your server
  4. Backup your existing database to have ability to restore it if anything goes wrong
  5. Clone it as new database on the same server. Let’s call it “database2”
  6. Create an empty database (”database3”)
  7. Either copy your entire Magento folder (without cache and sessions) into a new one and install there into “database3” (By editing local.xml with credentials for the newly created “database3”);
  8. Or if you already restricted access to your Magento instance, you may just change your database credentials into “database3”, clean cache and launch Magento once: it will be installed automatically.

At this point you should have the clone of your original database in “database2” and a brand new “database3” with empty Magento installed.

  1. Enter access credentials to “database2” as “corrupted” database and to “database3” as “reference” database
  2. Set table prefixes, if applicable
  3. Press “Continue” and you will see result screen where you will see what was done to the “corrupted” database.

Magento数据库修复工具Magento Database Repair Tool

Explanation of the report:

  1. If nothing was changed, then there is no need to fix your database
  2. Only table charset was changed — usually there is no need to worry about it, especially if these tables don’t have text data
  3. Table engine was changed from MyIsam to InnoDb — major issue. Needs developer for investigation
  4. Added missing foreign key or field (or even a table!) — major/fatal issue. Ask a developer for help.

If you are satisfied with database repair report and need to fix your live database, you can either switch your installation to the “database2” (because it was repaired), or perform the repair directly on the live database.

Don’t forget to remove the magento-db-repair-tool-1.0.php and restore access to website when you are done

Magento数据库修复工具的使用非常简单,只有一个简单的php文件。下载之后解压到任何可以通过web服务器访问的地方。在介绍使用方式之 前,我们必须根据当前的Magento版本,重新安装一个Magento,这样做是为了在修复数据库的时候能够有一个正常无错的Magento数据库版本 参照。

正确填写上述的信息之 后,点击Continue按钮。即可开始数据库的修复过程。该过程根据需要修复的Magento的数据库的破损程度,在完成之前,切记不要关闭窗口。

Magento数据库修复工具地址:http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool

正文完
 0
评论(2 条评论)
BadFire
2012-09-01 15:47:49 回复

确实很不错的代码,帮了大忙。

 Windows  Firefox  美国加利福尼亚旧金山
    2012-09-01 16:13:22 回复

    有用的时候方能体现作用。曾经也是找了许久才有这段代码。

     Windows  Firefox  美国加利福尼亚旧金山

空瓶子部落

文章搜索
推荐阅读
如何跳出盒子,打破框架?这三个思考工具挺有用!

如何跳出盒子,打破框架?这三个思考工具挺有用!

做过分析和咨询的伙伴们都知道框架,有人说框架千篇一律,阻碍了创新;有人说框架让他们摆脱了漫无目的的摸索,找到了...
过程能力分析(CP&cpk)

过程能力分析(CP&cpk)

引入过程能力分析的目的? 在我们现有的管理过程中,我们经常会遇到有些具体指标总是不尽人意,存在许多需要改进的地...
共识不是开会,而是这2个关键动作!

共识不是开会,而是这2个关键动作!

每到年底,季末,月末,老板们最爱干的事就是开会。 战略会、务虚会、复盘会……一群人关在会议室里,对着PPT翻来...
你真的了解R²吗?

你真的了解R²吗?

一、引言 你真的了解R²吗? 当你骄傲地展示一个R²=0.95的模型时,全场掌声雷动。 但如果这个模型在新数据...
多平台IPTV聚合工具Pixman

多平台IPTV聚合工具Pixman

什么是 pixman/pixman ? pixman/pixman 是一个基于 Docker 的 IPTV 工...
最新文章
Free TV:全球免费电视频道 M3U 播放列表,狂揽数万 Star

Free TV:全球免费电视频道 M3U 播放列表,狂揽数万 Star

https://github.com/Free-TV/IPTV 项目简介 Free TV 是一个精心维护的开源...
群晖 Let’s Encrypt 泛域名证书自动更新

群晖 Let’s Encrypt 泛域名证书自动更新

目前acme协议版本更新,开始支持泛域名(wildcard),也就是说,可以申请一个类似*.domain.co...
可以卸载TV Box 了,这款支持「绅士模式」的影视神器你值得拥有

可以卸载TV Box 了,这款支持「绅士模式」的影视神器你值得拥有

还在为找优秀片源难、广告多、平台会员太贵而烦恼?今天给大家挖到一款真正的影视宝藏工具——小猫影视! 作为开源免...
【收藏】一次性解决TV点播/直播自由

【收藏】一次性解决TV点播/直播自由

很多时候,资源就在面前,但是我们视而不见,因为长久的安逸,已经让人失去动手的兴趣。但是每次我需要挨个切换APP...
OpenWrt 存储空间扩容的两种方案

OpenWrt 存储空间扩容的两种方案

说明:当我们通过群晖 VMM 虚拟机安装 Open­Wrt 时,默认会分配一个 10GB 的存储空间,而实际情...
热门文章
提高过程能力指数(CP/CPK)的途径

提高过程能力指数(CP/CPK)的途径

编者按:过程能力指数(CP/CPK)想必各位质量人都耳熟能详、运用自如,质量工程师之家前期也共享过数篇关于过程...
SPC控制图的八种模式分析

SPC控制图的八种模式分析

SPC控制图有八种模式,即八种判断异常的检验准则,每一种检验准则代表一种异常现象,应用SPC控制图进行过程评估...
测量高手放大招:圆跳动测量技巧总结

测量高手放大招:圆跳动测量技巧总结

01. 前言 在五金机加工厂实际的测量工作中,经常碰到要求测量两个要素的圆跳动问题, 利用不同的测量辅件及夹具...
过程能力分析(CP&cpk)

过程能力分析(CP&cpk)

引入过程能力分析的目的? 在我们现有的管理过程中,我们经常会遇到有些具体指标总是不尽人意,存在许多需要改进的地...
新能源汽车 “两会”精神宣贯会

新能源汽车 “两会”精神宣贯会

此次和大家分享新能源汽车相关政策: [embeddoc url=”https://www.ctro...
最新评论
多乐士 多乐士 通过摸索发现ssh拉取会报错,直接网页访问下载会报404错误,不知道原因;但是可以通过群晖CM注册表访问下载,其方法如下: Container Manager-注册表-设置-新增-注册表名称随便写,注册表URL填你的加速地址,勾选信任的SSL自我签署证书,登录信息不填-应用-使用你的地址,这是注册表会显示了,在搜索栏中输入映像名称,搜索结果在每一页的最后一个,你需要划到最后一个进行下载,实测可正常下载安装。 以上供网友参考。
多乐士 多乐士 还有一个比较简单的方法,只是需要一些外部工具。 1、讲损毁硬盘取出,装入外部移动硬盘 2、打开Diskgenius,定位到硬盘 3、格式化系统分区 4、重新插入硬盘 5、存储池->修复存储池即可
多乐士 多乐士 写的不错的文章
辞了老衲 辞了老衲 这个确实有帮助。
渋驀 渋驀 当然任何时候都可以用curl命令和crontab来实现动态更新DDNS的ip地址: 1、安装crontab之后为root用户创建文件/var/spool/cron/root 2、创建并配置ddnsupdate.sh,放到/usr/bin/文件下,文件内容(以he.net为例): Autodetect my IPv4/IPv6 address: IPV4:curl -4 "http://dyn.example.com:password@dyn.dns.he.net/nic/update?hostname=dyn.example.com" IPV6:curl -6 "http://dyn.example.com:password@dyn.dns.he.net/nic/update?hostname=dyn.example.com" 3、添加执行权限chomod +x /usr/bin/ddnsupdate.sh 4、编辑root用户的crontab:*/10 * * * * /usr/binddnsupdate.sh,每10分钟执行一次。好了,可以享受你的DDNS了
21410 21410 请问下载链接在那里?
madkylin madkylin 不错,不错,谢谢分享了,好东西啊 :lol:
feilung feilung 求方法
zengsuyi zengsuyi 应该挺不错的
zise zise 看看是怎么操作的。。 :oops: