Retrieving SQL Availability Group Replication Information Using the Command Line Interface

Updated

Use XML to retrieve the SQL Availability replication information.

Complete this procedure so that you have the required Availability Group replication element values for the command line interface.

Procedure

  1. Run the qlogin command to log on to the CommServe computer.

  2. Download the GetReplica.xml file and save it on the computer from where you will run the command.

  3. Open the GetReplica.xml file and update the values for the XML parameters.

    For more information about the additional parameters, see XML Request Parameters for SQL Availability Group Operations.

  4. On the command line, go to <Software_Installation_Directory>/Base and type the following command:

    qoperation execute -af GetReplica.xml

  5. Run the qlogout command to log off the CommServe computer.

Response Parameters

Name

Description

name

The replica host name.

backupPriority

The SQL backup priority.

availabilityMode

The SQL availability mode

failoverMode

The SQL availability mode.

role

The SQL role.

connectionState

The SQL connection state.

endpointURL

The SQL endpoint URL. This URL contains the instance and the port number.

Example

The following file retrieves the information about the SQL Availability group AvailabilityG1.

<App_GetAvailabilityGroupsReq> <App_GetAvailabilityGroupReplicasReq availabilityGroup="AvailabilityG1"> <sqlClient clientName="ida18"/> <instanceEntity clientName="ida18" instanceName="IDA18"/>
</App_GetAvailabilityGroupReplicasReq>
    

The following file is the response.

<App_SQLAvailabilityReplicas>
  <SQLAvailabilityReplicasList>
    <name>IDA18</name>
    <backupPriority>50</backupPriority>
    <availabilityMode>1</availabilityMode>
    <failoverMode>0</failoverMode>
    <role>2</role>
    <connectionState>1</connectionState>
    <endpointURL>TCP://ida18.mycompany.com:5022</endpointURL>
  </SQLAvailabilityReplicasList>
  <SQLAvailabilityReplicasList>
    <name>IDA19</name>
    <backupPriority>50</backupPriority>
    <availabilityMode>1</availabilityMode>
    <failoverMode>0</failoverMode>
    <role>3</role>
    <connectionState>2</connectionState>
    <endpointURL>TCP://ida19.mycompany.com:5022</endpointURL>
  </SQLAvailabilityReplicasList>
</App_SQLAvailabilityReplicas>
    

Result

Use the response values as the values for the CreateAGClient replication element parameters.

Was this page helpful?