Moving Service Broker Applications
The usual way to move a Service Broker application is to move the database that contains the application to another instance. Many aspects of the Service Broker application move with the database. Some aspects of the application must be recreated or reconfigured in the new location.
The database contains the Service Broker objects, stored procedures, certificates, users, and outgoing routes for the application. These move with the database:
You must configure logins for any users with logins that the application uses.
Since certificates are contained in the database where the certificate was created, they are preserved when you move a database.
Most Service Broker databases have database master key. You must use the password for the master key when attaching the database in the new location.
You must also update the services that initiate conversations with the service you are moving. In each database that contains a route for the service you are moving, alter the route to use the new network address.
The CREATE DATABASE command and the ALTER DATABASE command contain options to activate Service Broker message delivery in the restored database and to set a different broker instance identifier. A broker instance identifier should only be in use by one database on the network at a time. In general, you do not change the instance identifier when you restore a backup that is intended to be identical to the original database. For example, you do not change the broker instance identifier when you attach a database:
For recovery purposes.
To create a mirrored pair.
To configure log shipping for a standby server.
When you make a copy of the database, you change the broker instance identifier or ensure that Service Broker message delivery is inactive. For more information on the options for attaching databases, see CREATE DATABASE (Transact-SQL) and ALTER DATABASE (Transact-SQL). For instructions on how to activate Service Broker message delivery in a database, see How to: Activate Service Broker Message Delivery in Databases (Transact-SQL).
Routes for incoming messages are not included in the database that contains the service. If your service uses an explicit route in the msdb database to route incoming messages to the service, you must recreate this route when you attach a database in a different instance.
Service Broker endpoints and transport security apply to the instance as a whole rather than to a specific database. Attaching a database to a new instance does not affect endpoints or transport security for that instance. If your service sends or receives messages over the network, you must ensure that the new instance has a Service Broker endpoint, and that transport security for the instance is configured as required for your application.
TasksHow to: Activate Service Broker Message Delivery in Databases (Transact-SQL)
Service Broker Routing
Other ResourcesALTER DATABASE (Transact-SQL)
ALTER ROUTE (Transact-SQL)
CREATE DATABASE (Transact-SQL)
CREATE ENDPOINT (Transact-SQL)
Copying Databases to Other Servers