All Products
Search
Document Center

Tablestore:Detach a global table

Last Updated:Apr 29, 2026

Removes one or more distribution locations from a global table using the Java SDK.

Usage notes

  • Detaching a distribution location only removes the association between the replica table and the global table. The replica table and its data are retained. To delete the replica table, call the DeleteTable operation separately.

  • This operation initiates a detach request asynchronously. To confirm the detach is complete, call the Query global table information operation and check the global table status. The detach is complete when the status changes to active.

Prerequisites

Before you begin, ensure that you have initialized a client.

Method description

public UnbindGlobalTableResponse unbindGlobalTable(UnbindGlobalTableRequest request) throws TableStoreException, ClientException

UnbindGlobalTableRequest parameters

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

    Note

    To get the global table ID, call the DescribeTable operation to query the table replica details. If the replica belongs to a global table, the response includes the global table ID.

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

  • Removals (Required) List<Removal>: The distribution locations to remove. Each Removal object contains:

    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<>();

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

    // Remove the replica in the China (Shanghai) region.
    GlobalTableTypes.Removal shanghaiRemoval = new GlobalTableTypes.Removal(
                // The region ID where the replica is located.
                "cn-shanghai",
                // The instance name 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());
}