Редактиране

Споделяне чрез


sys.sp_verify_database_ledger_from_digest_storage (Transact-SQL)

Applies to: SQL Server 2022 (16.x) Azure SQL Database Azure SQL Managed Instance

Verifies the database ledger and the table ledgers using digests at the specified external digest storage locations.

This stored procedure implements the same ledger verification algorithm as sys.sp_verify_database_ledger. A caller is expected to provide a JSON document that contains the paths pointing to digest storage locations, such as Azure Blob storage containers.

For more information on database ledger, see Ledger.

Transact-SQL syntax conventions

Syntax

sp_verify_database_ledger_from_digest_storage
    [ @locations = ] 'JSON_document_with_digest_storage_locations'
    [ , [ @table_name = ] 'table_name' ]

Arguments

[ @locations = ] 'JSON_document_with_digest_storage_locations'

A JSON document containing a list of ledger digests locations:

Column name JSON data type Description
path string The location of storage digests. For example, a path for a container in Azure Blob Storage.
last_digest_block_id int The block ID for the last digest uploaded.
is_current boolean Indicates whether this is the current path or a path used in the past.

[ @table_name = ] 'table_name'

The name of the ledger table you want to verify. This argument is optional. If this isn't specified, the whole database ledger and the ledger tables are verified.

Example of the input JSON document:

[
    {
        "path": "https://mystorage.blob.core.windows.net/sqldbledgerdigests/serverName/DatabaseName/2020-1-1 00:00:00Z",
        "last_digest_block_id": 42,
        "is_current:true"
    },
    ...
]

Return code values

0 (success) or 1 (failure).

Result set

One row, with one column called last_verified_block_id.

Permissions

Requires the VIEW LEDGER CONTENT permission.