Reputation: 309
Today I've made a mistake of deleting a production database.
I was able to restore a database from yesterday evening but I found the IBD and FRM files from a recenter time.
So I would like to know if I'm able to restore those files in anyway. Just overwriting the IBD file wont work, since than Mysqld cant be booted..
Any suggestions on how to fix this?
Upvotes: 2
Views: 1253
Reputation: 1888
No, you cannot just replace the ibd files, their internal state is intrinsically linked to the master tablespace state (ibdata*) and the transaction log state (ib_logfile*).
Restore the whole data set to a spare server, dump the tables you need either with mysqldump or if they are big, using exportable tablespaces:
On restore server: FLUSH TABLE table_name FOR EXPORT; Keep the session running.
On main server: ALTER TABLE table_name DISCARD TABLESPACE;
Copy the ibd file over.
On main server: ALTER TABLE table_name IMPORT TABLESPACE;
That should do what you want.
Upvotes: 2