yup.....you can buy it the day of, it probably wouldn't be oversold...I'd do an overnight train cuz i can imagine the day trains taking up a full travel day which would kinda stink. I've heard that it's good to get one that has a bunk with a bath inside...a little pricey, yea.. but safer...
if you go the route of taking the train up, make sure you get a reservation so your seat/bunk is guaranteed.
Best train to use is an ICE which is a high speed train like the TGV (very few stops)...look at
Raileurope.com for times & costs.