That shot the doctor gave you was an inoculation — that is, a preventative measure against disease. Inoculation is also known as "vaccination."
Inoculation is a fancy word from the Latin term inoculationem, meaning "engrafting" or "budding." That is exactly what an inoculation is — the grafting of a milder form of some horrible disease in you that will prevent you from getting a far nastier version. Inoculation and its various forms has also taken on a metaphorical meaning of being protected against something, as in the American politician Alan K. Simpson's quote that "an educated man is thoroughly inoculated against humbug."