Skip to main content
The SHOW BACKUP lists the contents of a backup created with the statement.
The SHOW BACKUP syntax without the IN keyword has been removed from CockroachDB v24.3 and later.For guidance on the syntax for SHOW BACKUP FROM, refer to the Synopsis and examples on this page.
Removed in v26.2: The incremental_location option has been removed in v26.2, following its prior . Existing backups taken with this option cannot be restored in v26.2 or later. If you have backups that use incremental_location, you can only restore them using a cluster running v26.1 or earlier.

Required privileges

SHOW BACKUP requires read permissions to its target destination. You can grant a user the EXTERNALIOIMPLICITACCESS to interact with external resources that require implicit access. Either the EXTERNALIOIMPLICITACCESS or the role is required for the following scenarios:
  • Interacting with a cloud storage resource using .
  • Using a custom endpoint on S3.
  • Using the command.
No special privilege is required for:
  • Interacting with an Amazon S3 and Google Cloud Storage resource using SPECIFIED credentials. Azure Storage is always SPECIFIED by default.
  • Using storage.
We recommend using .

Synopsis

Parameters

Options

Response

The following fields are returned: See Show a backup with descriptor IDs for the responses displayed when the WITH debug_ids option is specified.

Examples

The examples in this section use one of the following storage URIs:
  • External connections, which allow you to represent an external storage or sink URI. You can then specify the external connection’s name in statements rather than the provider-specific URI. For detail on using external connections, see the page.
  • Amazon S3 connection strings with the default AUTH=specified parameter. For guidance on using AUTH=implicit authentication with Amazon S3 buckets instead, read .
For guidance on connecting to other storage options or using other authentication parameters instead, read .

View a list of the available full backup subdirectories

To view a list of the available subdirectories, use the following command:
The path format is <year/<month/<day-<timestamp.

Show the most recent backup

To view the most recent backup, use the LATEST syntax:

View a list of the full and incremental backups in a specific full backup subdirectory

To view a list of the and backups in a specific subdirectory, use the following command:

Show a backup taken with the incremental location option

To view an incremental backup that was taken with the incremental_location option, run SHOW BACKUP with the full backup and incremental backup location following the original BACKUP statement. You can use the option to show the most recent backup where incremental_location has stored the backup:

Show locality-aware backups

SHOW BACKUP is able to display metadata using check_files for locality-aware backups taken with the option.
To view a list of , pass the endpoint that is set as the default location with COCKROACH_LOCALITY=default:
To view a , pass locality-aware backup URIs to SHOW BACKUP:

Show a backup with schemas

Show a backup with privileges

Use the WITH privileges option to view a list of which users and roles had which privileges on each database and table in the backup. This parameter also displays the original owner of objects in the backup:
You will receive an error if there is a collection of backups in the storage location that you pass to SHOW BACKUP. It is necessary to run SHOW BACKUP with the specific backup directory rather than the backup collection’s top-level directory. Use SHOW BACKUPS IN with your storage location to list the backup directories it contains, which can then be run with SHOW BACKUP to inspect the metadata.

Show details for scheduled backups

When a , it is stored within a collection of backups in the given collection URI. To view details for a backup created by a schedule, you can use the following:

Show an encrypted backup

Depending on how the backup was , use the and the same passphrase that was used to create the backup:
Or, use the kms option and the same KMS URI that was used to create the backup:

Show a backup with descriptor IDs

Use WITH debug_ids to display the descriptor IDs related to each object in the backup:

Validate a backup’s files

  1. Use SHOW BACKUP... check_files with a backup for validation:
    This will return the following output after validating that the backup files are correct and present:
    The output will return file_bytes along with the columns you receive from SHOW BACKUP without check_files. The file_bytes column indicates the estimated bytes in external storage for a particular table object. For more detail on the output columns, see the SHOW BACKUP table.
  2. If SHOW BACKUP... check_files cannot read from a file, it will return an error message similar to the following:
    SHOW BACKUP... check_files will return up to ten file paths for incorrect or missing files.
For more information on validating a backup, see the page.

Show a backup’s internal metadata

Use the WITH as_json option to output a backup’s internal metadata, contained in its manifest file, as a JSON value:
The response will include a manifest column with the file’s contents as the JSON value. Use to query particular data or edit the format of the response. The response returned from SHOW BACKUP FROM... WITH as_json is a backup’s internal metadata. This content is subject to change from version to version of CockroachDB and does not offer the same stability guarantees as the other SHOW BACKUP options and their responses. As a result, as_json should only be used for debugging or general inspection purposes. For example, to return a specific entry from the JSON response as a indented and with newlines use the function:
To query for particular data, use the to expand the desired elements from the JSON response. The following query returns the paths to each of the data files within the backup:

See also