Rebuild ibdata/ib_logfile from .ibd and .frm

2,838 views
Skip to first unread message

Bill

unread,
May 12, 2011, 5:39:51 PM5/12/11
to Percona Discussion
My apologies if this is off topic, the percona innodb recover tools
seem to be the closest tool I have found to help with this, although I
do not know if it will accomplish what I need.

My MySQL database got a little bit corrupted such that I have a bunch
of valid .ibd and .frm files in a directory (I'm using
innodb_file_per_table) . I will not go into all the details but I am
wondering if there is a way that I can rebuild the ibdata and
ib_logfiles so that I can use/import the existing .ibd and .frm files
without dumping all of the data from them?

This would obviously have the benefit of being able to backup and
recover the .ibd and .frm files (as one can do with the .frm, .MYD
and .MYI files).

Thanks in advance.

--Bill

Aleksandr Kuzminsky

unread,
May 13, 2011, 3:22:02 AM5/13/11
to percona-d...@googlegroups.com
Hello Bill,

You might be interested in checking out a post
http://www.mysqlperformanceblog.com/2011/05/13/connecting-orphaned-ibd-files/.
To get the ibd files back you need:
1. Create empty InnoDB tablespace (remove existing ibdata1, ib_logfile*
and start MySQL).
2. Enable innodb_file_per_table
3. Create tables you want to connect
4. Compile ibdconnect from Percona InnoDB Recovery Tool and run
./ibdconnect -o ibdata1 -f t1.ibd -d <your database> -t <table name, t1
in this case>
for each table.
5. Then fix checksums in ibdata1 as described in the post
6. Copy new ibdata1 and all your *.ibd files to the datadir.
7. Start MySQL and take a dump of the tables.

Good luck,
Aleks

signature.asc
Reply all
Reply to author
Forward
0 new messages