How to delete library data in koha using the command line

 How to delete library data in koha using the command line

Sometimes you need to empty the all data (e.g. bibliographic, borrowers, and transaction details)  from your Koha LMS without losing the configuration settings and authorized values, e.g. libraries, item types, patron categories, locations, etc. Let us know how to delete data from the Koha instance/library.

Delete Koha's bibliographic data
NB: I would recommend taking a backup of the database before applying the following commands.

Login as a root user

sudo su

Log into MySQL database

mysql -uroot -p

Enter MySQL root password

use koha_library;

Disable foreign key constraints when you truncate the tables

SET FOREIGN_KEY_CHECKS=0;

Delete all bibliographic details

TRUNCATE items; 
TRUNCATE biblioitems; 
TRUNCATE biblio; 
TRUNCATE deletedbiblioitems;
TRUNCATE deletedbiblio; 
TRUNCATE biblio_metadata;
Delete all transactions 
TRUNCATE old_issues; 
TRUNCATE issues; 
Delete borrowers details
TRUNCATE borrowers; 
TRUNCATE deletedborrowers;

Don't forget to Enable foreign key constraints when you are done

SET FOREIGN_KEY_CHECKS=1;

Refer: 

Comments

Popular posts from this blog

Install Dspace 7.2 on Ubuntu 22.04 LTS

Koha INSTALLATION

Total views