However, in one of the closing scenes of “The Rise of Skywalker,” R2-D2 uses a back-up version of C-3PO’s memories to restore him back to his normal self.
In Michael Kogge's “Rise of Skywalker” novelization, he provides clarification on which memories were restored. According to the book, C-3PO might recall all of his memories.
C-3PO narrated, “However, seeing that I am still recovering from the effects of a complete redacted memory bypass, I cannot guarantee that my files are completely up-to-date.”