Use a Blocking Command for Switch Active

Use the wait for switch Replication Server blocking command to instruct Replication Server to wait until the standby database is ready for operation.

You can use this command in a script that switches the active database. The syntax is:
wait for switch for logical_ds.logical_db