Bug #37586 Backup backs up db multiple times if mentioned more than once in backup SQL cmnd
Submitted: 23 Jun 2008 14:12 Modified: 27 Jun 2008 7:22
Reporter: Jørgen Løland Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[23 Jun 2008 14:12] Jørgen Løland
Description:
A backup image will contain as many copies of a database as the db name is mentioned in the backup sql command.

I.e., 
backup database db1, db1 to 'backup.bak'; <- two copies of db1 in backup.bak
backup database db1, ..., db1 to 'backup.bak'; <- n copies of db1 in backup.bak

How to repeat:
mysql> create database db;
Query OK, 1 row affected (0.00 sec)

mysql> use db;
Database changed
mysql> backup database db, db to 'backup.bak';
+-----------+
| backup_id |
+-----------+
| 1         | 
+-----------+
1 row in set (0.13 sec)

Suggested fix:
Check if the database is already in the catalog before adding it. If a duplicate is found, the backup should either fail with an error or just ignore the duplicate database.
[23 Jun 2008 15:28] Susanne Ebrecht
Verified as described.

BACKUP database mydb, mydb, mydb to 'mydb.backup';

$ less mydb.backup

I can see three times: create database mydb
That will make lots of trouble if you want to restore.
[26 Jun 2008 17:55] Hema Sridharan
This Bug looks duplicate of Bug#34480