[Koha] Wipe Koha database (just auth and biblio records)

Pablo Bianchi pablo.bianchi at gmail.com
Tue Jun 3 05:33:12 NZST 2014


Hi all,

Once in a while I need to erase / clean / reset Koha database, and with
this I mean to remove bibliographic and authority records (leaving
systempreference intact). Some years ago it works just TRUNCATE TABLE
biblio, biblioitems, items; then with foreign key constraint the harder
DELETE FROM biblio; seems to do the job. cleaning all other tables in
cascade.

But now (with Koha v3.16) I just want to say that *Appendix F. Resetting
the Koha Database
<http://manual.koha-community.org/3.16/en/resetkohadb.html>* might be not
exactly right, but with this trick
<http://stackoverflow.com/questions/5452760/truncate-foreign-key-constrained-table>
(disable foreign key constraint checks) seems to work:








*SET FOREIGN_KEY_CHECKS=0;TRUNCATE TABLE biblio;TRUNCATE TABLE
biblioitems;TRUNCATE TABLE items;TRUNCATE TABLE auth_header;TRUNCATE TABLE
sessions; TRUNCATE TABLE zebraqueue;SET FOREIGN_KEY_CHECKS=1;*

And of course then: *koha-rebuild-zebra --verbose --full  $(koha-list)*

Am I right? This could be risky, having side effects?

Regards,
Pablo


More information about the Koha mailing list