move AMS to another SQL instance

How to move AMS or its SQL databases to another machine.