Question

I have a server on which 1 InnoDB table was inadvertently dropped. I need to recover the data for just this table, without rolling back the data from all the other tables that use InnoDB. My latest backup is from about 24 hours ago. Is there any way to do this?

Edited to add: I should've specified: the backup is a tape backup, it is not a mysqldump file. What I have is a copy of ibdata and other mysql files from 24 hours ago. I did find a solution, see below.

Was it helpful?

Solution 2

This is what I ended up doing:

  1. Shut down the MySQL server.
  2. Made a copy of /var/lib/mysql (tar -cpvzf mysql.tgz /var/lib/mysql)
  3. Copied /var/lib/mysql from the backup to replace the current /var/lib/mysql
  4. Turned on MySQL server.
  5. Mysqldump of needed database.
  6. Shut down MySQL server.
  7. Restored /var/lib/mysql from the tgz file I made in step 2
  8. Turned on MySQL server.
  9. Inserted data of needed database from mysqldump file created in step 5.

Hope this helps anyone faced with the same dilemma!

More Thoughts I highly recommend turning on innodb_file_per_table=1 in my.cnf. This should be done between steps 8 and 9 in the list above.

OTHER TIPS

Backup (usually) is simple SQL code. Open the file with text editor and get the data you need :).

Other way is to restore DB local, and export only the needed table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top