Categories:

Account & Session DDL

SHOW REPLICATION DATABASES

Lists all the primary and secondary databases (i.e. all databases for which replication has been enabled) in your organization and indicates the region in which each account is located.

See also:

SHOW GLOBAL ACCOUNTS

Syntax

SHOW REPLICATION DATABASES [ LIKE '<pattern>' ]
                           [ WITH PRIMARY <snowflake_region>.<account_name>.<primary_db_name> ]

Parameters

LIKE 'pattern'

Filters the command output by object name. The filter uses case-insensitive pattern matching, with support for SQL wildcard characters (% and _).

For example, the following patterns return the same results:

... LIKE '%testing%' ...
... LIKE '%TESTING%' ...
WITH PRIMARY {snowflake_region}.{account_name}.{primary_db_name}

Specifies the scope of the command, which determines whether the command lists records only for the specified primary database.

Usage Notes

  • The command does not require a running warehouse to execute.

  • The command returns a maximum of 10K records for the specified object type, as dictated by the access privileges for the role used to execute the command; any records above the 10K limit are not returned, even with a filter applied.

    To view results for which more than 10K records exist, query the corresponding view (if one exists) in the Information Schema.

  • To post-process the output of this command, you can use the RESULT_SCAN function, which treats the output as a table that can be queried.

Output

The command output provides primary and secondary database properties and metadata in the following columns:

| region_group | snowflake_region | created_on | account_name | name | comment | is_primary | primary | replication_allowed_to_accounts | failover_allowed_to_accounts |

Column

Description

region_group

Virtual Private Snowflake customers only: Region group where the account that stores the database is located.

snowflake_region

Snowflake Region where the account that stores the database is located.

created_on

Date and time when the database was created.

account_name

Name of the account in which the database is stored.

name

Name of the database.

comment

Comment for the database.

is_primary

Whether the database is a primary database; otherwise, is a secondary database.

primary

Fully-qualified name of a primary database, including the region, account, and database name.

replication_allowed_to_accounts

Where IS_PRIMARY is TRUE, shows the fully-qualified names of accounts where replication has been enabled for this primary database. A secondary database can be created in each of these accounts.

failover_allowed_to_accounts

Where IS_PRIMARY is TRUE, shows the fully-qualified names of accounts where failover has been enabled for this primary database. A secondary database can be created in each of these accounts for business continuity and disaster recovery.

Examples

Show all the replication databases whose name starts with mydb:

SHOW REPLICATION DATABASES LIKE 'mydb%';

Show all the secondary databases for the aws_us_west_2.myaccount1.mydb1 region, account, and primary database, respectively:

SHOW REPLICATION DATABASES WITH PRIMARY aws_us_west_2.myaccount1.mydb1;