However, it's important to consider the context.
* If you are asking someone about their residency in Oxford, the sentence is perfect.
* If you are asking about the history of the city of Oxford itself, the sentence wouldn't be correct. You'd need to say something like, "How long has Oxford been a city?"
Always remember to think about the meaning you're trying to convey.