"How long will oil in stored gearboxes last?"
If stored properly, the oil could last several years. Consider these points when storing gearboxes:
One concern is the unit’s headspace. The gearbox should either be filled to the top with oil or stored with a preservative oil that incorporates a vapor phase corrosion inhibitor (VPCI).
Be sure to use caution when filling the unit, as filling it entirely could cause leakage around shaft seals.
If there is no VPCI, the components above the oil bath level will likely become dry and susceptible to corrosion. Even if the shaft is periodically rotated (as it should be), some components (splash-lubricated bearings) may not be lubricated.
Additionally, the breather fitting should be removed and replaced with a plug to minimize the ingression of humid air.
It is also a good idea to coat the exposed shafts with an appropriate preservative.
If appropriate measures are taken, the gearbox could likely be stored for extended periods with little or no risk.