Export (0) Print
Expand All
Expand Minimize

How to: Work with Replication Agent Profiles (RMO Programming)

Replication agent profiles are used to define the default values when an agent job is created. Each agent has a default profile, and some agents have additional predefined profiles. You can create user-defined profiles by using Replication Management Objects (RMO). For information about profiles, see Replication Agent Profiles.

To create a new agent profile

  1. Create a connection to the Distributor by using an instance of the ServerConnection class.

  2. Create an instance of the AgentProfile class.

  3. Set the following properties on the object:

  4. Call the Create method to create the profile on the server.

  5. Once the profile exists on the server, you can customize it by adding, removing, or changing the values of replication agent parameters.

  6. To assign the profile to an existing replication agent job, call the AssignToAgent method. Pass the name of the distribution database for distributionDBName and the ID of the job for agentID.

To modify an existing agent profile

  1. Create a connection to the Distributor by using an instance of the ServerConnection class.

  2. Create an instance of the ReplicationServer class. Pass the ServerConnection object created in step 1.

  3. Call the LoadProperties method. If this method returns false, verify that the Distributor exists.

  4. Call the EnumAgentProfiles method. Pass an AgentType value to narrow down the returned profiles to a specific type of replication agent.

  5. Get the desired AgentProfile object from the returned ArrayList, where the Name property of the object matches the profile name.

  6. Call one of the following methods of AgentProfile to change the profile:

    • AddParameter - adds a supported parameter to the profile, where name is the name of the replication agent parameter and value is the specified value. To enumerate all supported agent parameters for a given agent type, call the EnumParameterInfo method. This method returns an ArrayList of AgentProfileParameterInfo objects that represent all supported parameters.

    • RemoveParameter - removes an existing parameter from the profile, where name is the name of the replication agent parameter. To enumerate all current agent parameters defined for the profile, call the EnumParameters method. This method returns an ArrayList of AgentProfileParameter objects that represent the existing parameter for this profile.

    • ChangeParameter - changes the setting of an existing parameter in the profile, where name is the name of the agent parameter and newValue is the value to which the parameter is being changed. To enumerate all current agent parameters defined for the profile, call the EnumParameters method. This method returns an ArrayList of AgentProfileParameter objects that represent the existing parameter for this profile. To enumerate all supported agent parameter settings, call the EnumParameterInfo method. This method returns an ArrayList of AgentProfileParameterInfo objects that represent the supported values for all parameters.

To delete an agent profile

  1. Create a connection to the Distributor by using an instance of the ServerConnection class.

  2. Create an instance of the AgentProfile class. Set the name of the profile for Name and the ServerConnection from step 1 for ConnectionContext.

  3. Call the LoadProperties method. If this method returns false, either the specified name was incorrect or the profile does not exist on the server.

  4. Verify that the Type property is set to User, which indicates a customer profile. You should not remove a profile that has a value of System for Type.

  5. Call the Remove method to remove the user-defined profile represented by this object from the server.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft