The story of Noah may have been based on a distant memory of historical events, but the story readers find belongs to the same mythic genre as Genesis 2-4, since it purports to tell us of a long lost age of the world, a world before the waters crashed down and brought everything to an end.
Popular hypotheses are that the 'global flood' story found across ancient Near East mythologies goes back to regional floodings of Mesopotamia from the Tigris and Euphrates rivers, or perhaps from a cataclysmic flooding of the Black Sea region. Whichever the case, that flood persisted in the form of a world-encompassing deluge, through which a one man escaped with his family and animals on a boat.
In the flood stories of Israel's neighbors, the gods tend to send the flood because they're annoyed by humanity; in the Atrahasis and Utanapishtim myths, humanity is too loud and preventing the gods from sleeping. In contrast, Israel's myth presents God sending the flood as divine punishment on a violent world. Noah is spared because, relative to his contemporaries, he is a righteous man.
Israel's myth of Noah survived in two versions.
One theory is that a single core story came to two different regions and diverged in the telling. Another theory is that one of the versions was actually directly based on the other version. Either way, the two versions were combined together. The overarching narrative of both versions is essentially the same, but the details differ, sometimes drastically so. For example, in one story, the waters flood the earth for just forty days, but in the other the waters persist for one hundred fifty days. For about two centuries, scholarship has noted that Genesis 6-9's contradicting details are resolved when the two versions of the myth are separated.
This separation is actually quite easy and readily demonstrates the multi-source nature of Genesis. Readers may print out Genesis 6-9 and highlight all the uses of the name 'Yahweh' (English: Lord) and the uses of the name 'Elohim' (God). Then take note of keywords in the narration surrounding each word: blot, corrupt, righteous, heart, flesh, etc. Certain words appear only in close proximity to one or the other, 'Yahweh' or 'Elohim'.
The result is transparent: in one version, God is identified as 'Yahweh' and portrayed anthropomorphically, and the narration continues the theme of humanity's relationship with the earth, developed in Genesis 2-4. In the other version, God is 'Elohim', and the narration focuses on precise measurements of physical size and dates on the calendar.
In the 'Yahweh' narrative (the J source), the story concludes with God proclaiming to Noah that 'I will never again curse the ground because of man'. The curse which God had placed on Adam (3.17-19), Cain (4.10-11), and their descendants, has been lifted through Noah (8.20-22), just as Lamech had predicted would happen (5.28-29).
I've included below of my own attempts to track the use of key words and themes in proximity to 'Yahweh' or 'Elohim' in Genesis 6-9.
Yahweh // Elohim
Lamech fathered a son and called his name Noah, saying, 'Out of the ground that Yahweh has cursed this one shall bring us relief from our work and from the painful toil of our hands.'
And it came to pass, when men began to multiply on the face of the earth, and daughters were born to them, that the sons of God saw the daughters of men were beautiful. They took wives for themselves from any they wanted. And Yahweh said, 'My spirit will not strive with man forever, because he is flesh. His days shall be one hundred and twenty years.' There were Giants on the earth in those days, and also afterward, when the sons of God came to the daughters of men, and they bore children to them. These were the mighty men of old, men of fame.
Yahweh saw that the wickedness of man was great in the earth, and that every intention of the thoughts of his heart was only evil continually. And Yahweh was sorry that he had made man on the earth, and it grieved him to his heart. So Yahweh said, 'I will blot out man whom I have created from the face of the land, man and animals and creeping things and birds of the heavens, for I am sorry that I have made them.' But Noah found favor in the eyes of Yahweh.
Then Yahweh said to Noah, 'Go into the ark, you and all your household, for I have seen that you are righteous before me in this generation. Take with you seven pairs of all clean animals, the male and his mate, and a pair of the animals that are not clean, the male and his mate, and seven pairs of the birds of the heavens also, male and female, to keep their offspring alive on the face of all the earth. For in seven days I will send rain on the earth forty days and forty nights, and every living thing that I have made I will blot out from the face of the ground.' And Noah did all that Yahweh had commanded him.
And Noah and his sons and his wife and his sons' wives with him went into the ark to escape the waters of the flood. Of clean animals, and of animals that are not clean, and of birds, and of everything that creeps on the ground, two and two, male and female, went into the ark with Noah. And after seven days the waters of the flood came upon the earth. And rain fell upon the earth forty days and forty nights. And Yahweh shut him in.
The flood continued forty days on the earth. The waters increased and bore up the ark, and it rose high above the earth. He blotted out every living thing that was on the face of the ground, man and animals and creeping things and birds of the heavens. They were blotted out from the earth. Only Noah was left, and those who were with him in the ark.
At the end of forty days, he sent forth a dove from him, to see if the waters had subsided from the face of the ground. But the dove found no place to set her foot, and she returned to him to the ark, for the waters were still on the face of the whole earth. So he put out his hand and took her and brought her into the ark with him. He waited another seven days, and again he sent forth the dove out of the ark. And the dove came back to him in the evening, and behold, in her mouth was a freshly plucked olive leaf. So Noah knew that the waters had subsided from the earth. Then he waited another seven days and sent forth the dove, and she did not return to him anymore.
And Noah removed the covering of the ark and looked, and behold, the face of the ground was dry.
Then Noah built an altar to Yahweh and took some of every clean animal and some of every clean bird and offered burnt offerings on the altar. And when Yahweh smelled the pleasing aroma, Yahweh said in his heart, 'I will never again curse the ground because of man, for the intention of man's heart is evil from his youth. Neither will I ever again strike down every living creature as I have done. While the earth remains, seedtime and harvest, cold and heat, summer and winter, day and night, shall not cease.'
These are the generations of Noah. Noah was 500 years old. Noah was a righteous man, blameless in his generation. Noah walked with God. And Noah had three sons, Shem, Ham, and Japheth.
Now the earth was corrupt in God's sight, and the earth was filled with violence. And God saw the earth, and behold, it was corrupt, for all flesh had corrupted their way on the earth. And God said to Noah, 'I have determined to make an end of all flesh, for the earth is filled with violence through them. Behold, I will destroy them with the earth. Make yourself an ark of gopher wood. Make rooms in the ark, and cover it inside and out with pitch. This is how you are to make it: the length of the ark 300 cubits, its breadth 50 cubits, and its height 30 cubits. Make a roof for the ark, and finish it to a cubit above, and set the door of the ark in its side. Make it with lower, second, and third decks. For behold, I will bring a flood of waters upon the earth to destroy all flesh in which is the breath of life under heaven. Everything that is on the earth shall die. But I will establish my covenant with you, and you shall come into the ark, you, your sons, your wife, and your sons' wives with you. And of every living thing of all flesh, you shall bring two of every sort into the ark to keep them alive with you. They shall be male and female. Of the birds according to their kinds, and of the animals according to their kinds, of every creeping thing of the ground, according to its kind, two of every sort shall come in to you to keep them alive. Also take with you every sort of food that is eaten, and store it up. It shall serve as food for you and for them.' Noah did this; he did all that God commanded him.
Noah was six hundred years old when the flood of waters came upon the earth.
In the six hundredth year of Noah's life, in the second month, on the seventeenth day of the month, on that day all the fountains of the great deep burst forth, and the windows of the heavens were opened. On the very same day Noah and his sons, Shem and Ham and Japheth, and Noah's wife and the three wives of his sons with them entered the ark, they and every beast, according to its kind, and all the livestock according to their kinds, and every creeping thing that creeps on the earth, according to its kind, and every bird, according to its kind, every winged creature. They went into the ark with Noah, two and two of all flesh in which there was the breath of life. And those that entered, male and female of all flesh, went in as God had commanded him.
The waters prevailed and increased greatly on the earth, and the ark floated on the face of the waters. And the waters prevailed so mightily on the earth that all the high mountains under the whole heaven were covered. The waters prevailed above the mountains, covering them fifteen cubits deep. And all flesh died that moved on the earth, birds, livestock, beasts, all swarming creatures that swarm on the earth, and all mankind. Everything on the dry land in whose nostrils was the breath of life died. And the waters prevailed on the earth 150 days.
But God remembered Noah and all the beasts and all the livestock that were with him in the ark. And God made a wind blow over the earth, and the waters subsided. The fountains of the deep and the windows of the heavens were closed, the rain from the heavens was restrained, and the waters receded from the earth continually. At the end of 150 days the waters had abated, and in the seventh month, on the seventeenth day of the month, the ark came to rest on the mountains of Ararat. And the waters continued to abate until the tenth month; in the tenth month, on the first day of the month, the tops of the mountains were seen. Noah opened the window of the ark that he had made and sent forth a raven. It went to and fro until the waters were dried up from the earth.
In the six hundred and first year, in the first month, the first day of the month, the waters were dried from off the earth. In the second month, on the twenty-seventh day of the month, the earth had dried out. Then God said to Noah, 'Go out from the ark, you and your wife, and your sons and your sons' wives with you. Bring out with you every living thing that is with you of all flesh - birds and animals and every creeping thing that creeps on the earth - that they may swarm on the earth, and be fruitful and multiply on the earth.' So Noah went out, and his sons and his wife and his sons' wives with him. Every beast, every creeping thing, and every bird, everything that moves on the earth, went out by families from the ark.
And God blessed Noah and his sons and said to them, 'Be fruitful and multiply and fill the earth. The fear of you and the dread of you shall be upon every beast of the earth and upon every bird of the heavens, upon everything that creeps on the ground and all the fish of the sea. Into your hand they are delivered. Every moving thing that lives shall be food for you. And as I gave you the green plants, I give you everything. But you shall not eat flesh with its life, that is, its blood. And for your lifeblood I will require a reckoning: from every beast I will require it and from man. From his fellow man I will require a reckoning for the life of man. Whoever sheds the blood of man, by man shall his blood be shed, for God made man in his own image. And you, be fruitful and multiply, teem on the earth and multiply in it.'
Then God said to Noah and to his sons with him, 'Behold, I establish my covenant with you and your offspring after you, and with every living creature that is with you, the birds, the livestock, and every beast of the earth with you, as many as came out of the ark; it is for every beast of the earth. I establish my covenant with you, that never again shall all flesh be cut off by the waters of the flood, and never again shall there be a flood to destroy the earth.'
And God said, 'This is the sign of the covenant that I make between me and you and every living creature that is with you, for all future generations: I have set my bow in the cloud, and it shall be a sign of the covenant between me and the earth. When I bring clouds over the earth and the bow is seen in the clouds, I will remember my covenant that is between me and you and every living creature of all flesh. And the waters shall never again become a flood to destroy all flesh. When the bow is in the clouds, I will see it and remember the everlasting covenant between God and every living creature of all flesh that is on the earth.'
God said to Noah, 'This is the sign of the covenant that I have established between me and all flesh that is on the earth.'