I myself found a solution.
A simple solution is to find the saved copy of CREATE TABLE SQL, run it on the development instance, and then copy the created FRM file to the restored instance.
However, in my case, I did not have a copy of the CREATE TABLE command.
You can get a MySQL server working with ibdata, ib_logfiles and * .ibd files. However, without FRM, there will be no tables in the databases.
- In the restored database, run
create table innodb_table_monitor (a int) ENGINE=InnoDB - See the MySQL server error file until the table monitor data is flushed (usually about a minute).
- Run
drop table innodb_table_monitor Stop recovered database
Write SQL to match the output monitor of the table, for example:
TABLE: name db/mylosttable, id 0 7872, flags 1, columns 5, indexes 1, appr.rows 1828 COLUMNS: id: DATA_MYSQL DATA_NOT_NULL len 12; name: type 12 DATA_NOT_NULL len 45; DB_ROW_ID: DATA_SYS prtype 256 len 6; DB_TRX_ID: DATA_SYS prtype 257 len 6; DB_ROLL_PTR: DATA_SYS prtype 258 len 7; INDEX: name GEN_CLUST_INDEX, id 0 17508, fields 0/5, uniq 1, type 1 root page 3, appr.key vals 1828, leaf pages 9, size pages 10 FIELDS: DB_ROW_ID DB_TRX_ID DB_ROLL_PTR id name
may be expressed as:
drop table if exists mylosttable; create table mylosttable ( id char(12) NOT NULL, name varchar(45) NOT NULL );
If you are confused about the output of a table monitor, look at the output for tables with a known schema.
Run the above SQL in a MySQL development instance
Copy the FRM files created on the development server to the restored database. You will find them in the MySQL data directory in a subdirectory for the corresponding database.
Restart the restored database
Note. You can copy FRM files to a live database instance. The reason for stopping the server above is that if you destroy the database after creating the innodb_table_monitor table, it will leave the ibdata file in an inconsistent state and you will have to start with the backup.
Check if tables work with select * statements. If you are mistaken, you will see:
ERROR 2013 (HY000): Lost connection to MySQL server during query
which means the database crashed.
If this happens, run create table innodb_table_monitor... on the dev instance and compare the output with the original result from the restored instance. You will probably see that you missed NOT NULL or something like this.
source share