MySQL Forums
Forum List  »  Backup

Error 1062 while restoring backup
Posted by: Subin S
Date: January 19, 2013 09:39PM

Sorry, I seen similar threads but I still couldn't find it addressing my issue plus, I needed some more info on this.

Requirement: To create an exact replica 'db4' of an existing DB 'db3'. This is a Request Tracker (RT) database that I'm trying to replicate on the same server.
MySQL version- 5.0.51a-24+lenny3 on Debian Lenny. Basically this is a test environment and but meets all the requirements for successful RT installation and functioning.

Procedure followed:

1. Shutdown webserver to prevent any access to database.
2. mysqldump -uuser -ppass db3 > db3.sql (size is 6G)
3. mysql -uuser -ppass db4 < db3.sql (db4 was a newly created blank database)

The 3rd step throws in the error:

ERROR 1062 (23000) at line 5524: Duplicate entry '600806' for key 1"

I ran the 2nd step again with --force. The restore completed but with 2 additional similar errors:

ERROR 1062 (23000) at line 6309: Duplicate entry '187694' for key 1
ERROR 1062 (23000) at line 6572: Duplicate entry '1567400' for key 1

Obviously the restored database reported missing records.

A "sed -n 5524p db3.sql" showed the "INSERT INTO `Attachments` VALUES ...' query.
Similarly for line numbers 6309 and 6572 "INSERT INTO ..." was reported for
tables 'Tickets' and 'Transactions'. The three tables are Innodb with all the
three having an 'id' column set as PRIMARY KEY with AUTO INCREMENT.


Does this indicate a corrupted/problematic db3 database?

How to proceed to create a 'consistent/working' replica (db4) of db3?


Edited 2 time(s). Last edit at 01/19/2013 09:44PM by Subin S.

Options: ReplyQuote

Written By
Error 1062 while restoring backup
January 19, 2013 09:39PM
January 20, 2013 10:24PM
January 20, 2013 11:21PM
January 23, 2013 03:30AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.