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.