I do this regularly, but a 9 hour flight is a tad short. A 10mg tablet will knock me out for about 6 hours. Don't take the medication until the plane has taken off. I've heard a story from a friend about waking up on the plane and not remembering how she got there.
I usually take the tablet just as they start serving the meal. I never drink alcohol until I've arrived at my destination. You'll be fine.