I've seen movies where ships face each other broadside, hold their water and peppered each other with cannonballs for what seems to be a really long time. Is this accurate?
How is possible that a battle ship can withstand such punishment? I think there are only a certain number a holes that a ship can take before it sinks.
Also, how do they repair the ships? Did they just basically patch the holes up with whatever wooden planks they can get?
I'm not sure that the films of Age of Sail combat during the long 18th-century (1689-1815) make the battles seem that terribly long. Usually, a battle sequence in films are between 10 and 30 minutes each. That's the case in Master and Commander with their beginning and end sequences. And they are making the battle scenes seem shorter than they were many times due to the needs of editing. There is maneuvering involved with sea battles with these wooden ships. Sometimes it could be several hours to a day or more before ships engaged (until one decided it was to their advantage to attack at that time, like when one ship who wishes to go on the offensive obtains the weather gauge, or have the wind blowing to where said ship can take the most advantage of it to simplify it).
When that actual battle happens, an engagement could be as short as 10 or 15 minutes minutes if it's something like a frigate action and one side gets just their broadsides to hit just in the right places. Other times, like in an engagement where multiple ships are involved (and especially when the ships of the line were involved) it could be several hours or last the good part of a day.
Here is a passage from Theodore Roosevelt (yes, the president) in his work on American Naval History:
In 1815 the Amelia fought a draw with the Aréthuse, the ships throwing respectively 549 and 463 lbs., according to the English, or 572 and 410 lbs., according to the French accounts. In spite of being superior in force the English ship lost 141 men, and the French but 105. This was a bloodier fight than even that of the Chesapeake with the Shannon; but the gunnery was, nevertheless, much worse than that shown by the two combatants in the famous duel off Boston harbor, one battle lasting four hours and the other 15 minutes.
Roosevelt later offers a more detailed account of the battle between the Chesapeake and the Shannon that shows how a battle at sea would proceed, you can read Roosevelt's depiction of it with times as transcribed here. Roosevelt published his researched account of the War of 1812's Naval war in 1882 - he had an avid interest in the maritime activities of the United States and would play a big role in helping shape it in the years leading up to the Spanish-American war in 1898 and afterwards.
Getting off topic. Anyway, let's talk more about the big ships of the line, those that carried over 400 men and over 60 guns, and gun fire rates. The ships of the line were frequently engaged in fleet battles. Those could last hours upon hours as those vessels try to pound each other into submission. Yea the 72-gun 3rd-rate Ship of the Line had 10 of it's gun on the port side knocked away, but she's still has 20 more in operation. For firing a gun, a good time between firings of a gun was somewhere around 3 minutes. But not all crews constantly trained on their guns, British or otherwise (though the British were the most well known for it). Some of the best crews in existence are said to have done it in around 2 minutes. Then there's the whole Cuthbert Collingwood "3 well aimed broadsides in 5 minutes" thing (basically, if you achieve that ideal, you would be unstoppable in combat). But 3 minutes was doing great, and 4-5 minutes isn't surprising. We are primarily talking about the big warships here, that had huge guns that weighed several tons and required many men (over a dozen) to haul in and out. Then there's the need swab out the gun after firing, waiting for the powder monkey to come back with another round, ram in that round, adding the priming, then running it back out and aiming the gun. Mind you, if you do this all too fast, like that around 2-minutes per firing, you'll tire out a gun crew after a few broadsides (especially if you try that on the bigger guns seen on ships of the line).
As for sinking and damage - depends on where it is and the ship itself. There is no way to count how many hits until it's gone. How skillful, numerous, and quick are the ship's carpenter and gang at going below and filling in shot holes that came below the vessel's waterline with the wooden plugs with oakum and tar that they made? Can the pumps keep the water leaking in from overwhelming and sinking the sihp? Does the ship suffer from having timber that is weak, old, or rotted? How are her seams in her hull between streaks (boards) that make up her hull (since if they start to open up, which could be caused by combat, they could go up)? Meanwhile, above deck, hopefully there is either enough repair supplies in spars, masts, cordage, and sailcloth take care of the rigging getting torn apart, because otherwise they are stuck. But those larger ships of the line could take a beating for hours (and did in fleet battles) and it could take hours for a ship filled with holes to sink (there's the buoyancy factor of these large masses of wood, the crew is fighting to keep her afloat, and it takes time for water to fill up a ship). There is also the factor of battles between ships could be going in highs and lows while ships maneuvered to get in place another well placed broadside, repairs could be going on in those lulls (or if one broadside is not in action, if all of their men weren't helping the other broadside, they could be employed in helping with ship issues). When you had time, then you went through and did repairs more thoroughly, trying to replace what you can more properly or make repairs below the waterline as secure as you could until a ship could be dry docked (or if worse came to worse, brought to a shore and tipped on her side like when you careen her hull).
Hope this gets to what you're looking for. I suspect there will be follow up questions.
Sources: The books of Brian Lavery are some of the best books for a thorough and well sourced history and description of ship construction and operation. In particular, look for his books The Arming and Fitting of English Ships of War, 1600-1815 and both volumes of The Ship of the Line. You would probably have to go to a library for these particular books, since each large books (not just number of pages, but dimensions), with many pictures to help illustrate points, are now all used marketplace books that go for at least $100 per book these days.
HMS Implacable was, in 1949, the last surviving ship from Trafalgar still afloat. Due to measures of austerity, it was decided that she be scuttled, and sunk.
She was towed out to Portsmouth harbour, loaded with 400 tons of pig iron, and scuttling charges placed in her hull.
From Arthur Herman's "To Rule The Waves": "But Implacable fooled her would-be executioners. As Nelson or Blake could have told them, the wooden ship of old did not sink like her modern steel descendants. Instead of turning over, and plunging when her bottom blew out, Implacable stubbornly remained afloat, and stayed afloat, until workers had to go in and break up her might timbers...."
So, as you can see, these ships were incredibly difficult to destroy. What took a ship out of action was not the threat of sinking, but the sheer bludgeoning of firepower directed towards it's crew, and masts/rigging, rendering it unmanageable.
Here's a picture of the carpenters room on the HMS Victory.
https://www.flickr.com/photos/-smokeyjoe/13894220797/
As you can see, he would be quite well prepared to cut pieces to size, to patch, or hammer plugs into any hole. Outside of his room would be plenty of planks, and spare scraps of wood.
All of those ships leaked. The worry wasn't so much that it would eventually sink, but that it would take on too much water, and it's maneuverability would be severely impaired.
The HMS Victory (100-104 gun first rate) has a Keel depth 21-22 inches.
At the waterline her outer 'planking' is 10" thick braced internally to approximately 24" using blocks of oak and elm.
The Middle gun deck outer planking is between 4 to 6" thick. (not including the frames obviously which are still over 1 foot thick)
A 32lb (14.5 Kg) gun (such as the victory carried on her lower gun deck) could penetrate that at a range of 1 mile.
They could take a huge amount of abuse.