The group built Castle Oblivion to erase Sora 's memories and trick him into joining them . In the end , NaminÃ tells Sora she erased his memories , and gives him the choice to keep his new memories or have his old ones restored . To allow them to regain their memories , NaminÃ puts Sora , Donald , and Goofy to sleep for a year ; in the process , they must lose the memories of their experience in Castle Oblivion .