InnoDB中文参考手册---6备份和恢复InnoDB

<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

InnoDB中文参考手册---犬犬(心帆)翻译

 6备份恢复InnoDB数据库
的数据库管理就是使用正规的数据备份

InnoDBHotBackup是一个在线备份工具,你可以在InnoDB数据库运行时使用它来实现在线备份InnoDBHotBackup不需要你关闭你的服务器也不需要加任何锁或影响其它普通的数据操作。InnoDBHotBackup是一个非免费的附加工具,它的费用为每服务器每年400欧元。浏览网页InnoDBHotBackuphomepage可获得更多的信息以及程序屏幕截图。

如果你可以关闭你的MySQL服务,那么可以通过下面几个步骤进行数据库的“二进制”备份
关闭MySQL数据库服务,并确定在关闭时没有发生任何错误将你的所有数据文件复制到一个安全的地方将所有的InnoDB日志文件复制到一个安全的地方将my.cnf配置文件复制到一个安全的地方将所有的InnoDB表.frm文件复制到一个安全的地方
在需要高性能的数据库服务站点上,可以通过MySQL的复制特性来保持数据库的一个副本,MySQL的复制特性同样适用于InnoDB表类型。

除了上面描述的二进制备份方式之外,最好定期地使用mysqldump转储数据表。原因是二进制文件可能会在你未注意时而被破坏,而表转储(dump)文件是以文本文件方式保存的,它与二进制文件相比更简单、有更好的的可读性。因为转储文件更简单所以更容易发现表损坏,重要数据损环的可能性很小。

一个好的主意就是在对数据库做二进制备份的同时也做一个转储(dump)备份。为了得到一致的数据快照,必须关闭所有客户端的连接。然后就可以进行二进制备份,这样你就有了数据一致的两种格式的备份

如了实现通过上面所述的二进制备份方法将InnoDB数据库恢复到当前状态,必须打开MySQL的二进制日志(binlogging)开关。这样你就可以二进制日志与备份数据配合实现分时间点的恢复
mysqlbinlogyourhostname-bin.123|mysql

 

为了恢复一个崩溃了的MySQL服务进程,你所能做的唯一一件事就是重新启动。InnoDB将自动地检查日志并完成数据库的前滚(roll-forward)到当前状态。同时,InnoDB将自动回滚崩溃前未提交的事务。在恢复过程中,mysqld将显示如下所示的提示:

heikki@donna:~/mysql-3.23.48/sql>mysqld02020423:08:31InnoDB:Databasewasnotshutdownnormally.InnoDB:Startingrecoveryfromlogfiles...InnoDB:StartinglogscanbasedoncheckpointatInnoDB:logsequencenumber0177573790InnoDB:Doingrecovery:scanneduptologsequencenumber0177638912InnoDB:Doingrecovery:scanneduptologsequencenumber0177704448InnoDB:Doingrecovery:scanneduptologsequencenumber0177769984InnoDB:Doingrecovery:scanneduptologsequencenumber0177835520InnoDB:Doingrecovery:scanneduptologsequencenumber0177901056InnoDB:Doingrecovery:scanneduptologsequencenumber0177966592InnoDB:Doingrecovery:scanneduptologsequencenumber0178032128InnoDB:Doingrecovery:scanneduptologsequencenumber0178097664InnoDB:Doingrecovery:scanneduptologsequencenumber0178163200InnoDB:Doingrecovery:scanneduptologsequencenumber0178228736InnoDB:Afterthisprintsalineforevery10thscansweep:InnoDB:Doingrecovery:scanneduptologsequencenumber0178884096...InnoDB:Doingrecovery:scanneduptologsequencenumber0193302016InnoDB:Doingrecovery:scanneduptologsequencenumber0193957376InnoDB:Doingrecovery:scanneduptologsequencenumber019461273602020423:08:40InnoDB:Startinganapplybatchoflogrecordstothedatabase...InnoDB:Progressinpercents:0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899InnoDB:ApplybatchcompletedInnoDB:Doingrecovery:scanneduptologsequencenumber0195268096InnoDB:Doingrecovery:scanneduptologsequencenumber0195923456...InnoDB:Doingrecovery:scanneduptologsequencenumber0203132416InnoDB:Doingrecovery:scanneduptologsequencenumber0203787776InnoDB:Doingrecovery:scanneduptologsequencenumber0204443136InnoDB:5uncommittedtransaction(s)whichmustberolledbackInnoDB:Trxidcounteris0129792InnoDB:StartingrollbackofuncommittedtransactionsInnoDB:Rollingbacktrxwithid0129400InnoDB:Rollingbackoftrxid0129400completedInnoDB:Rollingbacktrxwithid0129217InnoDB:Rollingbackoftrxid0129217completedInnoDB:Rollingbacktrxwithid0129098InnoDB:Rollingbackoftrxid0129098completedInnoDB:Rollingbacktrxwithid0128743InnoDB:Rollingbackoftrxid0128743completedInnoDB:Rollingbacktrxwithid0127939InnoDB:Rollingbackoftrxid0127939completedInnoDB:Rollbackofuncommittedtransactionscompleted02020423:08:51InnoDB:Startinganapplybatchoflogrecordstothedatabase...InnoDB:Progressinpercents:0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899InnoDB:ApplybatchcompletedInnoDB:LastMySQLbinlogfileoffset040418561,filename./donna-bin.00102020423:08:53InnoDB:Flushingmodifiedpagesfromthebufferpool...02020423:09:03InnoDB:Startedmysqld:readyforconnections上一页 
<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值