All Products
Search
Document Center

Tablestore:Detach a global table

Last Updated:Jan 09, 2026

This topic describes how to use the Java software development kit (SDK) to remove one or more distribution locations from a global table.

Notes

  • The detach operation only removes the association between the replica table and the global table. The replica table and its data are retained. You can call the DeleteTable operation to delete the replica table separately.

  • This operation only initiates a detach request. The detach procedure takes some time to complete. To confirm that the procedure is complete, you can call the Query global table information operation to check the status of the global table. The detach is successful when the status of the global table changes to `active`.

Prerequisite

Initialize a client.

Method description

public UnbindGlobalTableResponse unbindGlobalTable(UnbindGlobalTableRequest request) throws TableStoreException, ClientException

UnbindGlobalTableRequest parameters

  • globalTableId (Required) String: The global table ID.

    Note

    If you do not have the global table ID, you can call the `DescribeTable` operation to query the details of a table replica. If the table replica belongs to a global table, the response from the `DescribeTable` operation contains the corresponding global table ID.

  • globalTableName (Required) String: The global table name. This name must be the same as the base table name.

  • Removals (Required) List<Removal>: The list of distribution locations to remove. This list contains the following parameters:

    Name

    Type

    Description

    regionId (Required)

    String

    The region ID.

    instanceName (Required)

    String

    The instance name.

Example

private static void unbindGlobalTableExample(SyncClient client) {
    // Construct the request.
    UnbindGlobalTableRequest request = new UnbindGlobalTableRequest(
                // The global table ID.
                "gt-ee1b54db-f5d9-43f3-ad36-ec44********",
                // The global table name.
                "my-global-table"
    );
                
    // Build the list of replicas to remove (Removals).
    List<GlobalTableTypes.Removal> removals = new ArrayList<>();

    // Example: Plan to remove the replica in the China (Hangzhou) region.
    GlobalTableTypes.Removal hangzhouRemoval = new GlobalTableTypes.Removal(
                // The ID of the region where the replica is located.
                "cn-hangzhou",
                // The name of the instance to which the replica belongs.
                "instance-replica-hz"
    );

    // Example: Plan to remove the replica in the China (Shanghai) region.
    GlobalTableTypes.Removal shanghaiRemoval = new GlobalTableTypes.Removal(
                // The ID of the region where the replica is located.
                "cn-shanghai",
                // The name of the instance to which the replica belongs.
                "instance-replica-sh"
    );
    
    removals.add(hangzhouRemoval);
    removals.add(shanghaiRemoval);
    request.setRemovals(removals);

    // Initiate the request.
    UnbindGlobalTableResponse response = client.unbindGlobalTable(request);
    System.out.println("Unbind start. Request ID: " + response.getRequestId());
}