Campbell Boyd
Campbell Boyd

Reputation: 83

tablespace error restoring a table in Mariadb

Trying to restore a martiadb table backupd uyp to ibd format. using the MAriadb documentation.

I dropped the table, then recreated from the frm file.

THen when I try to import the dataspace, if I don't discard the tablespace I get:

Error SQL query: ALTER TABLE tbl_bm IMPORT TABLESPACE MySQL said: Documentation #1813 - Tablespace for table 'bm/tbl_bm' exists. Please DISCARD the tablespace before IMPORT

If I do discard the tablespace, I get:

Error SQL query: ALTER TABLE tbl_bm IMPORT TABLESPACE MySQL said: Documentation #1030 - Got error 194 "Tablespace is missing for a table" from storage engine InnoDB

Advice please.

Upvotes: 2

Views: 12069

Answers (1)

Maciej
Maciej

Reputation: 181

I have run into this issue today. I have tried to restore a database from backup server using mysql data files (frm,ibd)

I have created the database in the destination server. I have discarded the tablespace for each table that I wanted to import. I have stopped the mysql server. I have placed the ibd and frm files in the /var/lib/mysql/{db}/ folder. I have started the mysql server I have tried to import the tablespace but run into this error.

After checking in /var/log/mysql/error.log it turned out that I have not copied some ibd files from backup folder. The error stated:

[ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file

I stopped the server. I copied again the missing files and checked the permissions. I started the server and reimported the tablespace.

Upvotes: 1

Related Questions