How often should I replace engine oil?

Hello Paul, I have a Toyota Vitz, 1999 model. I took it to one of the mechanics who opened the engine and it ended up knocking. I bought another used engine and replaced it. After how long should I replace engine oil? What other precautions should I take to ensure that it lasts long?
Silver

Silver, an engine knock often results from mechanical damage inside the engine. This mechanical damage usually results from a poor lubrication system maintenance regime which leads to the damage of fast moving and very hot internal engine parts. Once in a while, an engine will knock because it has been repaired with substandard parts or mistakes made during assembling.

With regards to the used engine you recently bought, You ought to carry out a precautionary timing belt replacement in case its history or mileage exceeds the replacement interval of 100,000 kilometres.
This will prevent potential engine valve and piston damage in the event that the timing belt breaks. Toyota recommends engine oil which meets viscosity index 15W40. Shell provides the Helix HX5 which meets the viscosity requirement and gives you a 5,000 kilometre service or drain interval. Shell Helix HX5 is blended with additives which keep oil in suspension to prevent harmful sludge (semi solid lumpy) formation which blocks thin engine oil passages. Helix HX5 chemical additives will also prevent oxidation and corrosion as well as metal sheer damage.

Use of good engine oil and periodical service with genuine Toyota filters will protect your engine. In case you park this car without use for more than six months it is recommended that you drain and replenish it with new oil as it ages with time even when you don’t drive the car.