# Tablespace import issue with the database exported using percona xtrabackup

**URL:** <https://forums.percona.com/t/tablespace-import-issue-with-the-database-exported-using-percona-xtrabackup/7348>\
**Category:** Percona XtraBackup\
**Created:** [December 12, 2019, 9:18pm UTC](https://forums.percona.com/t/tablespace-import-issue-with-the-database-exported-using-percona-xtrabackup/7348 "2019-12-12T21:18:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jspatel](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jspatel](https://forums.percona.com/u/jspatel)\
**Post date:** [December 12, 2019, 9:18pm UTC](https://forums.percona.com/t/tablespace-import-issue-with-the-database-exported-using-percona-xtrabackup/7348/1 "2019-12-12T21:18:50Z")

</div>

I am using Percona-Server 8.0.x and I am following percona xtraback documentation.

[URL][https://www.percona.com/doc/percona-xtrabackup/8.0/xtrabackup\_bin/restoring\_individual\_tables.html[/URL]](https://www.percona.com/doc/percona-xtrabackup/8.0/xtrabackup_bin/restoring_individual_tables.html%5B/URL%5D)

I am exporting all tables in one or more databases from a single server. I am trying to restore them on a different server by using discard and import tablespace query. However the import works for some tables (not containing the certain column type) but not for many others. It fails exactly on particular type of data column type.

Steps. [LIST=1]  
[_]Use xtraback to export the selected databases.  
[_]Prepare the backup  
[_]On the destination server, discard tablespace ALTER TABLE db.table\_name DISCARD TABLESPACE  
[_]Move .ibd and .cfg file to @@datadir/database/ with proper permission  
[\*]Import the table space. ALTER TABLE db.table\_name IMPORT TABLESPACE  
[/LIST] Error I am getting is following.

Schema mismatch (Column precise type mismatch.)

Here in all the failures I am facing are related to TEXT or LONGTEXT datatype. The original schema were created in MySQL 5.5. era. Also I am running percona-server with non strict SQL mode sql\_mode=‘’

So I scanned the MySQL source code and I found this are where it throws the error.  
// Check if the table schema that was read from the .cfg file matches the in memory table definition.  
[url][mysql-server/row0import.cc at 91a17cedb1ee880fe7915fb14cfd74c04e8d6588 · mysql/mysql-server · GitHub](https://github.com/mysql/mysql-server/blob/91a17cedb1ee880fe7915fb14cfd74c04e8d6588/storage/innobase/row/row0import.cc#L1192%5B/url%5D)

So I performed TABLESPACE export and IMPORT using MySQL prompt. That works fine.  
One thing I noticed that cfg file generated using xtrabackp and MySQL are different in size. Because cfg is a binary file and I don’t have the structure information, I couldn’t exactly tell which bytes are causing the mismatch and IMPORT to break on MySQL side when the data is exported using Percona Xtrabackp.

Do you have any workaround for this? This is a complete blocker for the work I am currently doing.

---

<div class="post-metadata">

**Author:** ![hkbharath](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hkbharath](https://forums.percona.com/u/hkbharath)\
**Post date:** [June 10, 2020, 7:29am UTC](https://forums.percona.com/t/tablespace-import-issue-with-the-database-exported-using-percona-xtrabackup/7348/2 "2020-06-10T07:29:07Z")

</div>

Use the latest version of xtrabackup 8.0.12. This issue,&nbsp;[https://jira.percona.com/browse/PXB-2133](https://jira.percona.com/browse/PXB-2133),&nbsp;is fixed.

---

<div class="post-metadata">

**Author:** ![jspatel](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jspatel](https://forums.percona.com/u/jspatel)\
**Post date:** [September 29, 2020, 11:10pm UTC](https://forums.percona.com/t/tablespace-import-issue-with-the-database-exported-using-percona-xtrabackup/7348/3 "2020-09-29T23:10:41Z")

</div>

Thanks for finally fixing it. It was blocking me from the longer term solution.
