# How to use history option when xtrabackup database?

**URL:** https://forums.percona.com/t/how-to-use-history-option-when-xtrabackup-database/11993
**Category:** Percona XtraBackup
**Tags:** mysql
**Created:** [September 1, 2021, 5:30am UTC](https://forums.percona.com/t/how-to-use-history-option-when-xtrabackup-database/11993 "2021-09-01T05:30:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Wison](https://avatars.discourse-cdn.com/v4/letter/w/dec6dc/32.png) [@Wison](https://forums.percona.com/u/Wison)
#### Post date: [September 1, 2021, 5:30am UTC](https://forums.percona.com/t/how-to-use-history-option-when-xtrabackup-database/11993/1 "2021-09-01T05:30:58Z")

</div>

I need to store the information after xtrabackup database, such as when the backup starts and when is the end time, the backup type,lsn etc.  
And after some searching, find there one option history for xtrabackup command. I tested several times, it can run the xtrabackup successfully, but there is no data in table percona\_schema.xtrabackup\_history.  
ps: the version is mysql 8.0.23 + xtrabackup 8.0.23  
so what is the right command to run xtrabackup with history option? below is the command I ran:

> xtrabackup --user=root -p --backup --target-dir=backup2/ --history

---

<div class="post-metadata">

### Author: ![Marcelo\_Altmann](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/marcelo_altmann/32/11299_2.png) [@Marcelo\_Altmann](https://forums.percona.com/u/Marcelo_Altmann)
#### Post date: [September 1, 2021, 11:35am UTC](https://forums.percona.com/t/how-to-use-history-option-when-xtrabackup-database/11993/2 "2021-09-01T11:35:52Z")

</div>

You are correct, all you need to do is to pass `--history` on xtrabackup command.  
You will need to have enough privileges to create a database and a table on the server - `PERCONA_SCHEMA.xtrabackup_history` .

Here is a sample of the information xtrabackup will save when using --history:

```auto
mysql> SELECT * FROM PERCONA_SCHEMA.xtrabackup_history\G
***************************1. row***************************
            uuid: 5df7eded-0b18-11ec-b379-d45d64347a19
            name: NULL
       tool_name: xtrabackup
    tool_command: --backup --stream=xbstream --host=127.1 --port=3310 --history
    tool_version: 8.0.26-18
ibbackup_version: 8.0.26-18
  server_version: 8.0.25-15-debug
      start_time: 2021-09-01 08:32:57
        end_time: 2021-09-01 08:33:02
       lock_time: 1
      binlog_pos: filename 'binlog.001208', position '276', GTID of the last change '31a0afa2-0991-11ec-b94d-d45d64347a19:1-4090912,446df73a-09c1-11ec-9d9d-d45d64347a19:1-7,946bbbde-09c1-11ec-bb72-d45d64347a19:1-227499'
 innodb_from_lsn: 0
   innodb_to_lsn: 5236283927
         partial: N
     incremental: N
          format: xbstream
         compact: N
      compressed: N
       encrypted: N
1 row in set (0,00 sec)

```

Optionally, you can pass a name to your history entry as `--history=my_backup_name` and this will reflect in the `name` field of your entry in `PERCONA_SCHEMA.xtrabackup_history` table.
