It is not possible to be in a physical body and to know everything.But when you are still, when your mind is in absolute stillness, and there is no craving and aversions, it is just free. Then you are like the librarian, who possesses all knowledge of the library and can access it when it is needed if it is needed.
A lawyer has all the books, but he doesn’t learn every word in all the books all the time. But when a particular case comes up, he knows which book to pick up and what to use. In the same way, our consciousness is an abode of all knowledge.
When you are so still and free from mental modulations, that is when you are a yogi. Then you can know the answer. That is why the still consciousness, yogic consciousness is called sarvajna. In that state of samadhi, the seed of all-knowingness is present in that consciousness.
Gurudev Sri Sri Ravi Shankarji