by Emma Richardson.
Ken is right and has detailed the best way to migrate a server. If you have a specific reason for wanting to restore courses instead, here is a link to a plugin that allows you to export all your site settings and reimport them to a new site. A must have for you type of restore (which I have done several times when wanting to rebuild a fresh database!).
https://moodle.org/plugins/view.php?plugin=block_admin_presets