How do rocks store oxygen, and how did they come to store them?

Since this is not my area of expertise, I searched Google under the key words "rocks store oxygen" to get these possible sources:

https://www.google.com/search?client=safari&rls=en&q=rocks+store+oxygen&ie=UTF-8&oe=UTF-8&gws_rd=ssl

In the future, you can find the information you desire more quickly, if you use appropriate key words to do your own search. Also see http://hanlib.sou.edu/searchtools/.