DBMS Auto Increment(Delete circulation entries from databse tables)


Certain records reluctant to Checkin due to DBMS auto increment problem. In such cases, the transaction remains in the tables. Developers still working on the solution. Here is a temporary solution. I tried this steps on Koha installed on Debian 8,9 and Ubuntu 16.04 with MySQL and MariaDB Server.

Symptoms of DB increment problem
Record reluctant to check-in.

See the message when trying to check-in the book.
Check Koha > About > System Information where you can find affected tables and entries in it.
Find the entries duplicated.
Clean the wrong entries from the affected tables
The problem often affected on deletedbiblio, deleteditems, deletedborrowers and old_issues tables in Koha database. We have to access the database of Koha and delete that specific entry. Then we apply DBMS auto increment fix. First identify the tables with wrong entries. Apply SQL queries to delete the wrong entries;

Log into MySQL/MariaDB

sudo mysql -uroot -p

use koha_library;

Apply following SQL query to delete the wrong entries from old_issues table;

DELETE FROM old_issues WHERE issue_id IN (Copy and paste issue IDs inside the brackets);

e.g. DELETE FROM old_issues WHERE issue_id IN (910,909,908,911);

Delete wrong entries from deletedbiblio

DELETE FROM deletedbiblio WHERE biblionumber IN (Copy and paste biblio numbers inside the brackets);

Delete wrong entries from deleteditems

DELETE FROM deleteditems WHERE biblionumber IN (Copy and paste biblionumbers inside the brackets);

Delete wrong entries from deletedborrowers

DELETE FROM deletedborrowers WHERE borrowernumber IN (Copy and paste borrower numbers inside the brackets);

Exit from MySQL after the deletion of wrong entries from all tables. Apply the following command;

exit
Check again Koha > About Koha > System Information after deleting all wrong entries from affected tables.
Reference-Koha Geek