The safest tan is no tan at all. Exposure to sunlight that is strong enough to make you tan can also cause skin cancer over time. Sun burn greatly increases your risk of cancer as well as aging your skin quickly.
If you want to look tanned, then a 'fake' tan is the best (not UV lamps though).
The body does indeed manufacture vitamin D when the skin is exposed to daylight. This doesn't have to be direct sunlight.
Using any kind of oil on the skin whilst sunbathing will effectively 'fry' your skin...not a good idea! It's OK as an aftersun treatment though.