Hi,
You have to change the written script to perform the operation in batch wise. Lets say if you have 10k records to import or update from some where, split it in a batch of 1k records and once it is processed successfully put some marker and exclude it from next batch.
Thanks