metacity --replace from a virtual console doesn't work because it doesn't know which X11 display to attach to. The default behavior is to attach to the display it runs in...and a shell running in a virtual console isn't on any X11 display.
Instead, you must manually specify the display. It will be
:0 unless you've configured your X11 display differently. (Even if you have multiple monitors, it will still be
:0 unless you've changed your X11 configuration.)
To do that, use this command:
metacity --display=:0 --replace
If that does't work, then try manually killing the
compiz process first. To do that:
killall compiz. Wait a few seconds. Perhaps
compiz will respond to this signal and terminate.
killall -KILL compiz. This almost always ensures that
compiz will be immediately terminated.
Step 1 is optional, but can help processes free some resources and finish up some kinds of important actions (like writing buffered data to files).