[Koha] bulkmarcimport-problems!

Magdalena Söderqvist soderqvist at sipri.org
Thu Feb 23 01:44:07 NZDT 2012


Hej Magnus - and thanks for the quick response! 

The suggestion to run "-match 999c" - did not work though! I'm attaching error messages from both import attempts. Does anyone have any suggestion on where we might go from here?? 

//Magdalena 

Latest attempt (with -match 999c): 

koha at kohatest:/usr/share/koha/bin/migration_tools$ perl 
./bulkmarcimport.pl -d -match 999c -commit 1000 -v -v -file 
/root/40_77000_2.mrc 
deleting biblios 
DBD::mysql: b do failed: Cannot delete or update a parent row: a 
foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
`issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
(`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. 
DBD::mysql: b do failed: Cannot delete or update a parent row: a 
foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
`issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
(`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 97. 
DBD::mysql: b do failed: Cannot delete or update a parent row: a 
foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
`issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
(`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 98. 
.Use of uninitialized value $recorddata in pattern match (m//) at 
./bulkmarcimport.pl line 392, <GEN16> line 1. 
unable to search the database for duplicates : No query entered at 
./bulkmarcimport.pl line 217, <GEN16> line 1. 



First import attempt (without -match 999c ) 

koha at kohatest:/usr/share/koha/bin/migration_tools$ perl 
./bulkmarcimport.pl -d -commit 1000 -v -file /root/40_77000_2.mrc 
deleting biblios 
DBD::mysql: b do failed: Cannot delete or update a parent row: a 
foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
`issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
(`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. 
DBD::mysql: b do failed: Cannot delete or update a parent row: a 
foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
`issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
(`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 97. 
DBD::mysql: b do failed: Cannot delete or update a parent row: a 
foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
`issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
(`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 98. 
.DBD::mysql::st execute failed: Duplicate entry 'A27112' for key 
'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105, <GEN16> 
line 1. 
ERROR in _koha_new_item INSERT INTO items SET 
biblionumber = ?, 
biblioitemnumber = ?, 
barcode = ?, 











----- Original Message -----

From: "Magnus Enger" <magnus at enger.priv.no> 
To: "Magdalena Söderqvist" <soderqvist at sipri.org> 
Cc: koha at lists.katipo.co.nz 
Sent: Friday, 17 February, 2012 1:01:44 PM 
Subject: Re: [Koha] bulkmarcimport-problems! 

Tjänare, Magdalena! 

2012/2/17 Magdalena Söderqvist <soderqvist at sipri.org>: 
> Hi all, 
> my IT-expert is helping me import some marc-records which I have edited in Marc Edit. But importing the records back into Koha is not working. And the editing itself does not seem to be the problem, we get the same error message when trying to import the original, unedited .mrc file, which I pulled from the "tools/export.pl" page. Do the below messages contain enough information to tell what we're doing wrong? Any help is, as always, much appreciated. We are currently running version 3.6.2 on Debian Squeeze. 
> 
> Also: we're doing this on a copy of the database, could that be part of the problem? 

That should not be a problem, it's a really, really good idea! ;-) 

> ******************** 
> deleting biblios 
>> > DBD::mysql: b do failed: Cannot delete or update a parent row: a 
>> > foreign key constraint fails (`koha`.`issues`, CONSTRAINT 
>> > `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` 
>> > (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. 
> 
> ******************* 

Not sure about this first part. 

> 
> Duplicate entry 'A13150' for key 'itembarcodeidx' at 
> /usr/share/koha/lib/C4/Items.pm line 361, <GEN16> line 804. 
> .DBD::mysql::st execute failed: Duplicate entry 'A13151' for key 
> 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105, <GEN16> 
> line 805. 
> ERROR in _koha_new_item INSERT INTO items SET 

>From the subject I guess you are re-importing with the 
bulkmarcimport.pl command line script. How are you running that? With 
what options? 

The default is that Koha will add your records as if they were new, 
which causes the error above, because the barcodes that you try to 
import are already present in the database. 

I *think* this should be taken care of if you run the script with 
"-match 999c" - this should match on the biblionumber in field 999$c. 
I have not tested that though... 

Best regards, 
Magnus Enger 
libriotech.no 



-- 

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
Magdalena Söderqvist 
Librarian 
SIPRI Library and Documentation Department 

STOCKHOLM INTERNATIONAL 
PEACE RESEARCH INSTITUTE 

Signalistgatan 9 
SE-169 70 Solna, Sweden 
Telephone: +46 8 655 97 78 
Fax: +46 8 655 97 33 
Email: soderqvist at sipri.org 
Internet: www.sipri.org 


More information about the Koha mailing list