Hamlet's tragic flaw is embedded in his character, so there is not just one act or scene where he realizes this flaw. His indecision to act, to be caught up in a state of his own inertia, becomes this tragic flaw. However, don't be too hard on Hamlet. The Ghost of his father gives him a baffling message: to seek both revenge and remembrance. Thus, Hamlet has a double mission.
Hamlet also questions the appearance and message from the Ghost: "The spirit that I have seen / May be a [devil] ... to damn me" (2.2.627-632). Also, Hamlet is no murderer, so he finds the duty of killing his uncle/father distasteful, to say the least. Yet, he gathers his resolve as "'This thing's to do,' / Sith I have cause and will and strength, and means to do 't" (4.4.47-49). Perhaps Hamlet's greatest flaw is his focus on his mother's guilt (3.4.95) rather than on the future of Denmark, although his main source of hesitation is that his Protestant beliefs forbid revenge killing even if his kingdom's customs demand it.
Yes, Hamlet realizes that he is slow in action because he overthinks the problem. He first goes into this frustration at length in Act 2.2 in his soliloquy that closes the scene and act. There he explains how frustrated he is and says he will use the play to test the Ghost's words so he can be assured that the Ghost is not lying to him.
In his famous soliloquy in Act 3.1, he again is frustrated and the main source of his frustration is his lack of action. Then again, in Act 4.4 in that scene's closing soliloquy, Hamlet vents his frustration over not having done anything yet to avenge his father's death. Having just heard how far Fortinbras will go to avenge his father, Hamlet vows that from that point on, he will work toward getting revenge.
yes of couse he realizes his tragic flaw. he knows that he has a philosophical nature and his bent of mind , education anf training do not permit him to do a murder. at heart he want to avenge himself but lacks appropriate courage to do it. that is why he condemns himself by saying : that ever i was born to set it right.
lack of decision power and too much pondering over the subject made him such a character who in the end will not only ruin himself but will be a cause of mass destruction