Categories:

System functions (System Information)

SYSTEM$DATABASE_REFRESH_HISTORY — Deprecated

返回一个显示辅助数据库刷新历史记录的 JSON 对象。

Note

此函数返回过去 14 天内的数据库刷新活动。

语法

SYSTEM$DATABASE_REFRESH_HISTORY( '<secondary_db_name>' )

实参

secondary_db_name

辅助数据库的名称。如果辅助数据库是当前会话中的活动数据库,则此实参可选。

请注意,整个名称必须放在单引号内。

输出

该函数在 JSON 对象中返回以下元素:

Column NameData TypeDescription
startTimeUTCNUMBERTime when the replication operation began. Format is epoch time.
endTimeUTCNUMBERTime when the replication operation finished, if applicable. Format is epoch time.
currentPhaseTEXTCurrent replication phase. For the list of phases, see the usage notes.
jobUUIDTEXTQuery ID for the secondary database refresh job.
copy_bytesNUMBERNumber of bytes copied during the replication operation.
object_countNUMBERNumber of database objects copied during the replication operation.

使用说明

  • 仅返回账户管理员(具有 ACCOUNTADMIN 角色)的结果。
  • 以下是所处理订单中的阶段列表:
    1. SECONDARY_UPLOADING_INVENTORY
    2. PRIMARY_UPLOADING_METADATA
    3. PRIMARY_UPLOADING_DATA
    4. SECONDARY_DOWNLOADING_METADATA
    5. SECONDARY_DOWNLOADING_DATA
    6. COMPLETED / FAILED / CANCELED

示例

The following example retrieves the refresh history for the mydb secondary database. The results are returned in a JSON object:

SELECT SYSTEM$DATABASE_REFRESH_HISTORY('mydb');

下面的示例与上一示例检索相同的详细信息,但结果被扁平化为关系形式:

SELECT
    to_timestamp_ltz(value:startTimeUTC::numeric,3) AS "start_time"
    , to_timestamp_ltz(value:endTimeUTC::numeric,3) AS "end_time"
    , value:currentPhase::string AS "phase"
  , value:jobUUID::string AS "query_ID"
  , value:copy_bytes::integer AS "bytes_transferred"
FROM TABLE(flatten(INPUT=> PARSE_JSON(SYSTEM$DATABASE_REFRESH_HISTORY('mydb'))));