Categories:

Information Schema , Table functions

REPLICATION_GROUP_REFRESH_HISTORY

Returns the replication history for a secondary replication or failover group within the last 14 days.

See also:

REPLICATION_GROUP_REFRESH_HISTORY view

Syntax

REPLICATION_GROUP_REFRESH_HISTORY( '<secondary_group_name>' )
Copy

Arguments

secondary_group_name

Name of the secondary group. Note that the entire name must be enclosed in single quotes.

Output

The function returns the following columns:

Column Name

Data Type

Description

PHASE_NAME

TEXT

Current phase in the replication operation. For the list of phases, see the Usage Notes.

START_TIME

TIMESTAMP_LTZ

Time when the replication operation began.

END_TIME

TIMESTAMP_LTZ

Time when the replication operation finished, if applicable. NULL if it is in progress.

JOB_UUID

TEXT

Query ID for the refresh job.

TOTAL_BYTES

VARIANT

A JSON object that provides detailed information about refreshed databases:

  • totalBytesToReplicate: Total number of bytes expected to be replicated.

  • bytesUploaded: Actual number of bytes uploaded.

  • bytesDownloaded: Actual number of bytes downloaded.

  • databases: List of JSON objects containing the following fields for each member database:

    • name: Name of the database.

    • totalBytesToReplicate: Total bytes expected to be replicated for the database.

OBJECT_COUNT

VARIANT

A JSON object that provides detailed information about refreshed objects:

  • totalObjects: Total number of objects in the replication or failover group.

  • completedObjects: Total number of objects completed.

  • objectTypes: List of JSON objects containing the following fields for each type:

    • objectType: Type of object (for example users, roles, grants, warehouses, schemas, tables, columns, etc).

    • totalObjects: Total number of objects of this type in the replication or failover group.

    • completedObjects: Total number of objects of this type that were completed.

PRIMARY_SNAPSHOT_TIMESTAMP

TIMESTAMP_LTZ

Timestamp when the primary snapshot was created.

ERROR

VARIANT

NULL if the refresh operation is successful. If the refresh operation fails, returns a JSON object that provides detailed information about the error:

  • errorCode: Error code of the failure.

  • errorMessage: Error message of the failure.

Usage notes

  • Only returns rows for a role with any privilege on the replication or failover group.

  • Only returns rows for a secondary replication or failover group in the current account.

  • When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.

  • The following is the list of phases in the order processed:

    #

    Phase name

    Description

    1

    SECONDARY_SYNCHRONIZING_MEMBERSHIP

    The secondary replication or failover group receives information from the primary group about the objects included in the group, and updates its membership metadata.

    2

    SECONDARY_UPLOADING_INVENTORY

    The secondary replication or failover group sends an inventory of its objects in the target account to the primary group.

    3

    PRIMARY_UPLOADING_METADATA

    The primary replication or failover group creates a snapshot of metadata in the source account and sends it to the secondary group.

    4

    PRIMARY_UPLOADING_DATA

    The primary replication or failover group copies the files the secondary group needs to reconcile any deltas between the objects in the source and target accounts.

    5

    SECONDARY_DOWNLOADING_METADATA

    The secondary replication or failover group applies the snapshot of the metadata that was sent by the primary. The metadata updates are not applied atomically and instead applied over time.

    6

    SECONDARY_DOWNLOADING_DATA

    The secondary replication or failover group copies the files sent by the primary group to the target account.

    7

    COMPLETED / FAILED / CANCELED

    Refresh operation status.

Examples

Retrieve the refresh history for secondary group myfg.

SELECT phase_name, start_time, end_time,
       total_bytes, object_count, error
  FROM TABLE(
      INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY('myfg')
  );
Copy