Exodus 17:6
4 Then Moses cried out to the Lord, “What will I do with this people?—a little more and they will stone me!” 5 The Lord said to Moses, “Go over before the people; take with you some of the elders of Israel and take in your hand your staff with which you struck the Nile and go. 6 I will be standing before you there on the rock in Horeb, and you will strike the rock, and water will come out of it so that the people may drink.” And Moses did so in plain view of the elders of Israel. 7 He called the name of the place Massah and Meribah, because of the contending of the Israelites and because of their testing the Lord, saying, “Is the Lord among us or not?”
Numbers 10:11
10 Then Moses and Aaron gathered the community together in front of the rock, and he said to them, “Listen, you rebels, must we bring water out of this rock for you?” 11 Then Moses raised his hand, and struck the rock twice with his staff. And water came out abundantly. So the community drank, and their beasts drank too. 12 Then the Lord spoke to Moses and Aaron, “Because you did not trust me enough to show me as holy before the Israelites, therefore you will not bring this community into the land I have given them.” 13 These are the waters of Meribah, because the Israelites contended with the Lord, and his holiness was maintained among them.
Notes and References
"... The most impressive example is the story of water from a rock. In two different places there is a story of Moses' striking a rock with a stick and getting water from it. One is in Exodus, and one is in Numbers. In the continuity of the story in the Bible as it stands now, the two similar events happen years and miles apart. Yet both happen at a place with the same name: Meribah. Each story is only a few verses long, so it is worth looking at both ... There is no water for the people in the wilderness. They quarrel. Yahweh stands on a rock (meaning a crag of a mountain, not a stone). Moses hits the rock with his staff, and water comes out. That was the story that the author of P read ... The main thing is that hitting the rock was good in Exodus, and it is bad in Numbers. It was an act of obedience in Exodus. It is ultimate disobedience in Numbers. It is Moses' worst offense ..."
Friedman, Richard Elliott Who Wrote the Bible? (pp. 198-200) Harper San Francisco, 1997