I believe you are thinking of the episode "Forest of the Dead" the second part of a two part story- the first part was "Silence in the Library".
Plot Summary Part 1:
The Tenth Doctor takes Donna Noble to a planet-sized library in the
51st century. They find it empty of human life, with a final recorded
message: "4,022 saved, no survivors." As an archaeological expedition
arrives, lead by the mysterious Professor River Song, they can only
give one piece of advice: count the shadows.
Donna is gone, the Vashta Nerada are out for fresh meat and the Tenth
Doctor is running out of options. Can he trust the mysterious
Professor River Song, a woman who claims to be from his future? Why
would his future self have given her his sonic screwdriver, or tell
her his real name? Even if they do work together, can anyone stop the
shadows from claiming them all as their next meal?
In the scene you're thinking of, the (10th) Doctor realizes River Song's screwdriver has a neural relay in it and he races to connect it to the library core to upload her data ghost.
Donna and the other saved people return in the library, and begin to
be evacuated. Donna cannot find Lee, and she and the Doctor conclude
that perhaps he never really existed at all. The real Lee sees as he
steps onto a teleport, but his stammer prevents him from calling out
to her before he is teleported away. The Doctor and Donna briefly muse
over River Song's diary, as it contains details of her life and their
future. Ultimately, they decide not to look in it, and leave it behind
on a shelf along with the sonic screwdriver his future self gave her.
Suddenly, the Doctor comes running back. He realises that since he
knew River's fate all along, his future self would have had years to
think of a way to save her. He knows that he wouldn't just give her a
sonic screwdriver without a good reason. Opening it, he finds that it
contains a hidden neural relay. As with the data ghosts, her
consciousness has been saved there. However, it is fading. The Doctor
takes River for "one last run", as he sprints back to the core. He
uploads River's data ghost into the Library's computer, as the face of
Charlotte looks on and smiles. River appears in a virtual reality
created by Charlotte and is reunited with all of her team members for
Clip (the vortexy part you're remembering is about a minute in):