Imagine the Earth is struck by a laser/magic beam capable of piercing it and leaving a lasting hole. What effects would observed? Would there be a difference between the hole(s) being made in the ocean (one end in the ocean one end not, both on land, both in the ocean)? Would the effects be different if the laser/magic beam missed the Inner and Outer Cores?
To be honest, "and leaving a lasting hole" piece of your assumption appears to be impossible to sustain with Earth and realist physics.
Insides of Earth (especially the core) are under big pressure and high temperature. As such, any hole would immediately be closed by the surrounding material expanding into the area of lower pressure that the hole provides (I will handwave this but if you need the formulas Physics or Earth Science SE would be good places to ask for details).
The same holds true for the ocean - the water under pressure would expand to fill that hole.
If the hole is big enough, it may generate strong waves or even tsunami when water collapses into it, but that'd have to be pretty gynormous, not a "beam" width. Ditto for hole in the Earth - at big enough diameter there might be some sort of seismic event, but not at what is typically thought of as "beam"/"laser" diameter.
Now, the REALLY interesting question is, what would be the effects of that laser/magic beam itself? Specifically, to make such a hole, it would impact a LOT of energy to Earth. The dissipation of such energy might be into the core/Earth internals by heating them a bit more; OR on the surface.