In ancient times, different religious schools developed for interpreting the Vedas.
Different schools would specialize in learning certain Vedas, and perhaps not others.
The members of these schools would memorize and orally recite the Vedas that the schools focused on, thereby preserving those oral texts.
In this way, the Vedic texts have hardly changed for more than 3,000 years.