innodb 共享表空间,数据备份和恢复的一个测试

实验:

 

停掉  mysql

 

移除

 

ib_logfile0                    

ib_logfile1                      
ibdata1

 

重启mysql以后,自动重建了 ib_logfile redo 日志文件 和  ibdata 数据字典文件。

 

能在数据库里面看到表,但 select * from 的时候,却说找不到表。。哈哈。因为我没有移除掉 innodb 的 *.frm 结构文件

 

而新建的 ibdata 里面又真的没有 这个表的信息。

 

我把 ibdata1  mv 回到 原位置。重启 mysql

 

一切又正常了。  而 bi_logfile 日志文件我就没移回去,一样正常,因为这个是 事务恢复日志,如果不是服务器crash 的话,一般没啥事务要redo。 

 

看手册怎么说物理备份innodb 的,看过了就明白innodb 的物理关系了

 

If you are able to shut down your MySQL server, you can make a binary backup that consists of all files used by InnoDB to manage its tables. Use the following procedure:

  1. Shut down the MySQL server and make sure that it stops without errors.

  2. Copy all InnoDB data files (ibdata files and .ibd files) into a safe place.

  3. Copy all the .frm files for InnoDB tables to a safe place.

  4. Copy all InnoDB log files (ib_logfile files) to a safe place.

  5. Copy your my.cnf configuration file or files to a safe place

 

看下ib_logfile 是如何被用上的

 

To recover from a crash of your MySQL server, the only requirement is to restart it. InnoDB automatically checks the logs and performs a roll-forward of the database to the present. InnoDB automatically rolls back uncommitted transactions that were present at the time of the crash

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值