Here's what you should expect from a basic eye exam:
You may do a couple pre-tests where they get an estimate of your prescription and an air puff test to check the pressure in your eyes (part of checking for glaucoma).
You can expect to read the chart to assess your visual acuity. Then you will follow a target with your eyes to assess your eye muscle function and a light will be shined in your eyes to make sure your pupils respond correctly. Your peripheral vision will also be checked by individually covering each eye and reporting how many fingers are held up. (Now if you have the option to do a visual field as a screening test, I would do it since you have the headaches.)
Then you'll do a refraction to see if and how much of a prescription you have. Some doctors do this fast and if you need to, ask them to slow down. If two choices look the same it is absolutely fine to say so. It means the difference between them is so slight, you're where you should be at for that part of your prescription.
After the refraction, the doctor will look at you on the slit lamp which is basically a microscope. If they didn't do the air puff test, they will check your eye pressure with a blue light after putting some drops in your eyes. Yes, it will sting for just a couple seconds. They will probably put two more drops in to finish dilating your eyes. The dilating drops take about 20 minutes to work and will make you blurry up close and light sensitive, but I promise you will still be able to see and will be able to drive home! The dilating drops are important because a big pupil is necessary for the doctor to see all the way in the back of your eye to make sure everything is healthy. It takes 4-6 hours for the drops to wear off. Usually, you're given paper sunglasses for afterwards, but you can bring your own sunglasses too.
After your eyes are dilated, the doctor will put you back into the slit lamp and hold up a small lens in front of each eye to evaluate the optic nerve and retina. Then he/she will put a light that sort of looks like a miner's helmet on their head and use a bigger lens to check your peripheral retina while you sit back in the chair.
And that's it! If there are any abnormalities, the doctor should go over that with you. If there is a prescription for glasses, the doctor will give that to you and tell you when you need to wear them.
Personally, I think you are fine with seeing the optometrist. They are trained to evaluate the health of the eye as well and if there is something they cannot handle, they will recommend a good ophthalmologist. It's usually easier and quicker to get in to see the optometrist and if your problem is due to needing glasses, optometrists are generally much better at prescriptions.
Hope my novel explained everything! Good luck! :)