papercut: restoring a database from backup

the most straight forward method of restoring a database is:
path: c:\program files (x86)\papercut mf\server\bin\win\
db-tools.exe import-db –force “..\server\data\backups\export-####….zip”

the force option assumes there’s already an existing database with data that needs to be overwritten. the unfortunate part of using this method is that it deletes all the data in the existing db in a very slow fashion (several hours to clear out a 2GB database).

and in my case the deletions eventually errored out with:
Cannot delete or update a parent row: a foreign key constraint fails (`papercut`
.`tbl_user_email_address`, CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFER
ENCES `tbl_user` (`user_id`)) Query: delete from tbl_user Parameters: []
See server.log for full error details

PaperCut Support mentioned that i should try using db-tools import-db -k to work around this. i didn’t get a chance to try this since i took an alternate route.

to get around the very time-consuming deletions i decided to create a new blank db and reinitialized it with the papercut schema with db-tools init-db (after updating the file with the new database name)

i then ran the import-db option again this time without the –force and it went much smoother.

more info:

This entry was written by resinblade , posted on Tuesday September 20 2016at 05:09 pm , filed under IT . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.