Koha : How to delete records without items

Records without items are BAD NEWS! They mislead people searching our library’s catalog to think that they have found exactly what they are looking for when in the real sense, they are seeing something that does not exist. To reduce the frustrations of your library users, this post will attempt to help you delete records without items from your koha catalog in a few easy steps.


  1. Access your koha server command-line
  2. putty-ssh-connect
    Connect to server using Putty SSh Client
    You will need to access the server on which koha is installed. You can either access it remotely using ssh or physically. Either way, get to the command-line and move to the second step.

     

  3. Back-up your database
  4. Before you touch anything, you need to backup your database! Don’t say I didn’t say!
    To backup your databse, issue the command below:

     mysqldump -u root -p dbName > backup.sql 

    Key in your password and press enter.
    NB: Replace dbName with the actual name of your database and backup.sql is the name of the file in which you want to store your backup. You can call it any name you want including the file extension as long as it is a text file.

  5. Log-in to MySQL shell
  6. Issue the command below to login to MySQL:

     mysql -u root -p 

    This will request you for a password again.

     

  7. Select koha database
  8. If you are not sure what the name of your koha database is, issue the command below:

     SHOW DATABASES; 

    This will list all the databases on your server. If you still can’t identify it, consult whoever installed Koha or use some other techniques out there. You eventually have it, select using the command below:

     USE dbName; 

    NB: Replace dbName with the actual name of your database.

  9. Delete records
  10. DO NOT CONTINUE BEFORE YOU’VE BACKED UP THE DATABSE !
    Issue the command below to delete records without items from your koha database:

     DELETE FROM biblio WHERE biblio.biblionumber NOT IN (SELECT biblionumber FROM items); 

    Watch out for errors in the out put otherwise you have just successfully deleted records without items from your koha database.

     

    Now you need to exit the database ASAP. Issue the command below:

     exit; 

     

  11. Re-index zebra
  12. To reflect the changes on your database, it must be re-indexed. You can either wait for koha’s scheduled cron-jobs to run or issue the following commands to see results immediately:

    sudo rebuild_zebra.pl -a -b -z 

    The above command should be run in the folder in which koha’s source files are installed precisely, the misc/migration_tools/ folder.

     

  13. Check for records without items
  14. Now you can go ahead to search your catalogue and confirm if the records have actually been removed.



    For feedback and corrections, use the comments section below

Otuoma Sanya

Otuoma Sanya is a full-time systems librarian, tech enthusiast and writer. His areas of interest are data mining, institutional repositories, library automation and web development using python Django.

Leave a Reply