I am not too sure if this is the correct section to post this. (Mods pls move this to the appropriate section if not)
This is a common scenario when you need to move your live website which has a good amount of traffic all the time to a new server. How do you manage to move the db WITHOUT locking the db or putting up a "site under maintenance" page and loosing any data?
Avoiding downtime is almost impossible, the thing to think through is to limit the downtime. For example, if the database is large then this implies more data will need to be copied across from one server to another before the database is available. Once all the data is copied then you flip the switch and make the database live.
Another approach is to enable replication from one database to the other. This way you have the two databases in sync. Then you stop access on the primary databases and change the scripts to point to the other database. This reduces the downtime of the application and impact on your end users.