It indeed looks like the data set is too large to handle. You have several options such as decreasing the size of the dataset, split it into batches or increase the memory of the server.
You can also consider transfering the data using database replication, rest or another type of interface.
It al depends on your specific situation.