views:

15

answers:

1

To migrate my database faster, I tried copying the raw files (MYD and MYI) files of a database into another machine. All the tables are working fine except two tables that were partitioned. My directory structure looks like this:

table1.frm
table1.MYI
table1.MYD

table2.frm
table2.par
table2#P#p0.MYD
table2#P#p0.MYI
table2#P#p1.MYD
table2#P#p1.MYI

table3.frm
table3.par
table3#P#p0.MYD
table3#P#p0.MYI
table3#P#p1.MYD
table3#P#p1.MYI

The following is producing an error:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| mysql              | 
| test               | 
+--------------------+
3 rows in set (0.06 sec)


mysql> use test;
Database changed

mysql> show tables;
+---------------------------+
| Tables_in_test            |
+---------------------------+
| table1                    | 
| table2                    | 
| table3                    | 
+---------------------------+
3 rows in set (0.00 sec)


mysql> explain table1;
+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| id    | int(11) | NO   | PRI | NULL    | auto_increment | 
| a     | int(11) | YES  |     | NULL    |                | 
+-------+---------+------+-----+---------+----------------+
2 rows in set (0.01 sec)


mysql> explain table2;
ERROR 1017 (HY000): Can't find file: 'table2' (errno: 2)

mysql> explain table3;
ERROR 1017 (HY000): Can't find file: 'table3' (errno: 2)

mysql> check TABLE table2;
+--------------------------+-------+----------+--------------------------------------------------+
| Table                    | Op    | Msg_type | Msg_text                                         |
+--------------------------+-------+----------+--------------------------------------------------+
| test.table2              | check | Error    | Can't find file: 'table2' (errno: 2)             | 
| test.table2              | check | error    | Corrupt                                          | 
+--------------------------+-------+----------+--------------------------------------------------+
2 rows in set (0.00 sec)

I checked the permissions and everything looks fine. I tried repair but that didn't seem to work either. Is there anything that can be done?

+1  A: 

The server you are porting them to might not have partioning enabled.

Try SHOW VARIABLES LIKE '%partition%'; and check the value of the variable have_partioning or have_partition_engine (depending on your version of mysql).

Further information can be found in the documentation.

Femaref
@Femaref: Looks like my version does not have partitioning. Thanks a lot for the insight!
Legend