# Restoring Partial Backups

**URL:** <https://forums.percona.com/t/restoring-partial-backups/7071>\
**Category:** Percona XtraBackup\
**Created:** [June 20, 2019, 10:24am UTC](https://forums.percona.com/t/restoring-partial-backups/7071 "2019-06-20T10:24:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dibble](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@Dibble](https://forums.percona.com/u/Dibble)\
**Post date:** [June 20, 2019, 10:24am UTC](https://forums.percona.com/t/restoring-partial-backups/7071/1 "2019-06-20T10:24:49Z")

</div>

Hi  
I am testing partial incremental backups with XtraBackup. All goes well until I try to run ‘ALTER TABLE datbase.table IMPORT TABLESPACE’ for a table that has a decimal column. When I run this sql command for a table with a decimal column I receive the error ‘Error Code: 1808. Schema mismatch (Column columnName precise type mismatch.)’ where columnName is a decimal column.  
If a table does not have a decimal column I do not run into any problems

I am running  
mysq: Version: 8.0.16  
xtrabackup: 8.0.6  
OS: CentOS Linux release 7.6.1810

The steps I followed are listed below

A) Full/incremental backups for database ‘dbname’  
xtrabackup --user=xxx --host=localhost --password=123 --backup --databases=‘dbname’ --target-dir=/backups/partial/mysql  
xtrabackup --user=xxx --host=localhost --password=123 --backup --databases=‘dbname’ --target-dir=/backups/partial/inc001/ --incremental-basedir=/backups/partial/mysql  
xtrabackup --user=xxx–host=localhost --password=123 --backup --databases=‘dbname’ --target-dir=/backups/partial/inc002/ --incremental-basedir=/backups/partial/inc001

B) Preparation  
xtrabackup --prepare --apply-log-only --export --target-dir=/backups/partial/mysql  
xtrabackup --prepare --apply-log-only --export --target-dir=/backups/partial/mysql --incremental-dir=/backups/partial/inc001  
xtrabackup --prepare --apply-log-only --export --target-dir=/backups/partial/mysql --incremental-dir=/backups/partial/inc002  
xtrabackup --prepare --export --target-dir=/backups/partial/mysql

C) Restore to same database on same server  
i) Delete and recreate all tables in the database as before  
ii) ‘ALTER TABLE database.table DISCARD TABLESPACE’ for all tables  
iii) Copy the exported files (.ibd and .cfg) from ‘/backups/partial/mysql’ to the subdirectory of the destination server’s data directory (and change owner/group to mysql)  
iv) ‘ALTER TABLE database.table IMPORT TABLESPACE’ - which runs into the issue for tables with columns with decimal values

I am wondering if anybody else has run into this issue.

Thanks

---

<div class="post-metadata">

**Author:** ![iftaquar](https://avatars.discourse-cdn.com/v4/letter/i/48db29/32.png) [@iftaquar](https://forums.percona.com/u/iftaquar)\
**Post date:** [April 13, 2020, 10:18am UTC](https://forums.percona.com/t/restoring-partial-backups/7071/2 "2020-04-13T10:18:45Z")

</div>

Have you managed to sort this one out? I m getting into issue

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [May 7, 2020, 1:23am UTC](https://forums.percona.com/t/restoring-partial-backups/7071/3 "2020-05-07T01:23:29Z")

</div>

Please provide table definition here so we can test.

> [@](#):
>
> SHOW CREATE TABLE tblname\G

@iftaquar - please share the same, include exact mysql version and xtrabackup version used as well.

---

<div class="post-metadata">

**Author:** ![jasonh](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jasonh](https://forums.percona.com/u/jasonh)\
**Post date:** [May 14, 2020, 12:08am UTC](https://forums.percona.com/t/restoring-partial-backups/7071/4 "2020-05-14T00:08:38Z")

</div>

I’m having the same issue. Testing for it is trivially easy.

1. Create a new database and simple table with a date column:  
 create database test1;  
create table date\_test (val date default null);  
SHOW CREATE TABLE date\_test\G

> [@](#):
>
> CREATE TABLE `date_test` (  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `val` date DEFAULT NULL  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4\_0900\_ai\_ci

2. Perform a partial dump with xtrabackup:  
xtrabackup --user=root --password=XXX --databases=test1 --backup --target-dir=/backups/partial  
xtrabackup --user=root --password=XXX --databases=test1 --prepare --export --apply-log-only --target-dir=/backups/partial
3. ALTER TABLE test1.date\_test DISCARD TABLESPACE;
4. Copy date\_test.ibd and date\_test.cfg back into the data directory and fix ownership/permissions.
5. ALTER TABLE test1.date\_test IMPORT TABLESPACE;  
ERROR 1808 (HY000): Schema mismatch (Column val precise type mismatch.)

---

<div class="post-metadata">

**Author:** ![jasonh](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jasonh](https://forums.percona.com/u/jasonh)\
**Post date:** [May 14, 2020, 7:40am UTC](https://forums.percona.com/t/restoring-partial-backups/7071/5 "2020-05-14T07:40:29Z")

</div>

I apologize for the double comment…the system was acting odd.Also, here are the software versions i was using: MySQL 8.0.19 and xtrabackup 8.0.11

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [May 15, 2020, 12:20am UTC](https://forums.percona.com/t/restoring-partial-backups/7071/6 "2020-05-15T00:20:26Z")

</div>

Looks like a bug since I can reproduce the same error. Please open a JIRA ticket under the PXB project.

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [May 15, 2020, 9:04pm UTC](https://forums.percona.com/t/restoring-partial-backups/7071/7 "2020-05-15T21:04:30Z")

</div>

Actually there’s a bug reported already - [[PXB-2132] Error: "Schema mismatch (Column date precise type mismatch.)" during a partial backup import - Percona JIRA](https://jira.percona.com/browse/PXB-2132)
