Horizontal Navigation

Thursday 24 August 2017

Import Koha MARC Records Using Command Line Interface

The following steps must be carefully followed while importing Koha MARC records using Command Line Interface:
Step1: Move your MARC file to the appropriate folder of your Koha Server. Execute the following command: 
mv yourfilename.mrc /usr/share/koha/bin/migration_tools

Step2: Load Environment variables for proper execution of import commands i.e. perl scripts. Execute the following commands carefully: 
 (a)  sudo su  
(b)export PERL5LIB="/usr/share/koha/lib"   
(c)export KOHA_CONF="/etc/koha/sites/library/koha-conf.xml"  

Step3: Go to the appropriate folder where import perl scripts is located. Execute the following command:  
cd /usr/share/koha/bin/migration_tools 

Step4: Finally, execute the following commands as per your requirements:   

Case 1: If you want to place your MARC records in default MARC Bibliographic framework, then execute the following command:
perl bulkmarcimport.pl -file yourfilename.mrc 

Case 2: If you want to place your MARC records in your desired MARC Bibliographic framework, then execute the following command: 

perl bulkmarcimport.pl -framework FRAMEWORK_CODE -file yourfilename.mrc
N.B.: FRAMEWORK_CODE: BKS,SER, CD, TH,etc.

Case 3: If you want to delete all existing records and import new batch of  MARC records, then execute the following command: 

perl bulkmarcimport.pl -d -file yourfilename.mrc

Step5: Rebuild Zebra after import process finish. Execute the following command: 
sudo koha-rebuild-zebra -v -f library