River Song uses her gun to blast a hole in the wall, enabling her, The Doctor and the others to escape the shadow-possessed Proper Dave.
Donna wakes up in an ambulance with no memories of her past life. She is treated in a facility by Doctor Moon and life quickly flies by. Before she knows it, she is married to her ideal man Lee, who has a stammer, and has two kids of her own. She is then approached by a hooded figure in a playground, who turns out to be Miss Evangelista. She warns Donna that the world is not real. Donna soon observes that all the children in the playground have the same face.
The Doctor squabbles with River Song, but is soon stunned when he learns that he tells her his true name at some stage in his future. The Time Lord tries to reason with the Vashta Nerada and finds out they came as microspores in millions and millions of books and then hatched.
The Doctor figures out that the library computer's hard drive - CAL - is the key to bringing Donna back, for it has literally saved her to its hard drive. The team travels to the core of the planet to locate the computer. It transpires that the little girl is in fact the hard drive, and was originally a relative of Strackman Lux.
River Song knocks The Doctor out to prevent him stopping her sacrificing herself to bring back Donna and the others. In order to restore those who have been saved, she has to provide memory to Cal, which burns out her mind. She dies, as the Doctor looks on, handcuffed to a wall.
Donna and the other saved people return, but she cannot find Lee and thinks that perhaps he didn't exist after all. Lee sees her but his stammer prevents him from calling out to her before he is teleported away.
The Doctor realizes in the nick of time that, knowing River's fate and having years to think of a way to save her, his future self must have given her the screwdriver for a reason. He finds that, like the data ghosts, her consciousness has been saved in her sonic screwdriver. River Song comes back to life in the fantasy world of the hard drive, meeting Miss Evangelista and the rest of her team again.