It takes shy of 7 hours to get from Oslo Central Station to Bergen Central Station via Bergen Railway. What you lose in time compared to air travel you compensate in terms of hassle-free embarkation and disembarkation experience, ease of access to the points of departure and arrival, and of course the scenery. This is one of the most scenic train rides in Europe.
Whether your itinerary allows for overnight sailing (as opposed to a few hours for a door-to-door journey centered on air travel) or you are doing it for pleasure, the trip from Copenhagen to Oslo (or reverse) on DFDS Seaways is likely to leave overall positive impressions. The ship leaves the port of origin at 4:15pm and reaches the destination at 9:45am the following morning. If you are into scenic travel, you have several hours of navigating Øresund and Oslofjord when the sun is up. If you are into shopping and entertainment, you are on a big cruise ship, with all attendant amenities.
Travel by train is considerably more common in Europe than in the US, with multitude of routes, options and departures. Besides vast commuter networks in and around large metropolises and regular long-distance service, there are several high-speed networks that reach most if not all of the major destinations in Western Europe.
We, so far, took advantage with only a couple of those.