To answer your question, i will tell you about my own science-based magic system and how necromancy works in that.
My system treats magical energy as another type of energy, such as thermal or kinetic energy. In order to cast a spell, you convert magical energy into another type (or several types) of energy.
For necromancy, you would convert magical energy into kinetic energy, thusly moving the corpse. In this way, you are not really reviving the corpse in the sense of bringing it back to life, instead you are manipulating it, similar to a puppet master pulling its strings. It is far more accurate to call this reanimation rather than resurrection.
In order to prevent the corpse from decomposing, i use what i call “kinetic barriers”. These are areas of kinetic energy which act like a solid object. Essentially, any force put upon this barrier is resisted as the kinetic barrier pushes against the force put upon it, thusly cancelling it out. In terms of a corpse, the kinetic barrier covers its body and pushes away oxygen and pathogens, preventing the corpse from decomposing. This means that, as long as the spell lasts, the corpse will not decompose and will be able to move.
Due to how necromancy works in my world, it means you can’t bring someone back from the dead (unless using the chemical energy method described below). You could control their body but not bring them back to life.
Instead, to somewhat overcome this, i though of using electrical energy much like how a defibrillator is used. In this way, you could ‘revive’ someone by stopping their heart with electricity, allowing it to restart. Whilst this wouldnt work in all cases, it would in the case of a heart attack which could cause someone to ‘die’ (in reality, we know they’re not dead, just suffering from a heart attack. However, medieval people might not realise this and assume the person was brought back to life).
This method allows the revived person to remember most, if not all, of what they did before they ‘died’, prevents them from decomposing and makes sure their biology is exactly the same. However, it isn’t true necromancy, though people may see it as such.
This method is a lot harder to perform (and harder to describe accurately). Essentially, healing magic in my world works by converting magical energy into chemical energy and using that to accelerate the body’s natural healing processes.
Applying this to necromancy, you may be able to repair the damaged cells in the deceased’s body using chemical energy. This would cause any internal injuries to be healed and the body to be refilled with blood. In this case, it is perfectly reasonable to call this method resurrection as you are actually bringing someone who died back to life.
There are several issues with this method, though this plays perfectly into your question. Firstly, the body would need resources to repair itself, such as with proteins obtained from food. Second, if i remember correctly from my CPR training, it only takes around 3-5 minutes without oxygen to get brain damage. This would mean your mage needs to be relatively quick if they want to keep the subject’s memories perfectly intact. Otherwise they might have amnesia or partial amnesia. Finally, if the spell works, the person is no longer dead, they are as alive as they were before they died, meaning they still need to eat and breathe and perform every other bodily function the human body does.
Bonus - Where to get the bodies
When most people think of necromancy, they think of necromancers raising the corpses of deceased solider on a battlefield or raiding graveyards and crypts. However, there are so much more interesting things you could do.
For example, executions. A necromancer might go to a prison and ask the guard if there are any prisoners awaiting execution and, if so, may ask to buy the body. Obviously this would not work as well if they were beheaded, though if they were hung or poisoned you could easily reanimate the body. (Also, a guard may say ‘yes’ and execute a prisoner who wasn’t on the list to get a bit of extra money).
An alternative may be to go to a hospital morgue or a holy site, though they might be more reluctant to hand over the deceased. A thieves guild, mercenary guild or an assassins guild may quite readily hand over bodies though. You could also pay grave robbers to bring you bodies, much like what was done in Victorian London where scientists were dissecting human cadavers to find out how they worked, though this was highly illegal.
Another example would be contracts. Local peasantry or the homeless are famously short on money, something an enterprising necromancer may exploit. A necromancer may go to a local peasant and offer to buy their body once they die, paying them in advance. Whilst this might seem ludicrous and you may think no one would ever do this, you have to remember this peasant may have a large, starving family and no way of paying for or making food. This works especially well in times of famine or war or simply when taxes are raised significantly. (An evil necromancer may pay someone, have them sign the contract and kill them, this works best if if looks like an accident and does not happen immediately after they sign the contract. If the local law enforcement come, the necromancer has the contract proving that the victim’s body belongs to them.)
When someone comes along with a bag of coin offering to buy their body, which they wont be using once they die anyway, it may seem a tempting offer. Its a similar idea to how people donate their bodies to science in our modern world. You have even have this on a larger scale with magical academies making these offers and giving the bodies to their necromancy students.