alterDatabaseReplication

Alters replication and failover settings on an existing Snowflake database. Supports enabling/disabling replication to accounts, refreshing replica databases, managing failover configurations, and promoting replica databases to primary.

Note: This change type does not support automatic rollback or database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

databaseName

String

Name of the database to alter

Yes

ifExists

Boolean

Only alter if the database exists using IF EXISTS

No

refresh

Boolean

Refresh replica database with changes from primary

No*

primary

Boolean

Promote replica database to primary

No*

enableReplicationForAccounts

Nested

Enable replication to specified accounts

No*

disableReplicationForAccounts

Nested

Disable replication to accounts

No*

enableFailoverForAccounts

Nested

Enable failover to accounts (Business Critical)

No*

disableFailoverForAccounts

Nested

Disable failover to accounts

No*

* Exactly one operation (nested element or attribute) must be specified.

enableReplicationForAccounts attributes

Attribute

Type

Description

Required

name

String

Account identifier (e.g., ORGNAME.ACCOUNT_NAME)

Yes

disableReplicationForAccounts attributes

Attribute

Type

Description

Required

name

String

Account identifier (empty element disables all)

No

enableFailoverForAccounts attributes

Attribute

Type

Description

Required

name

String

Account identifier (requires Business Critical)

Yes

disableFailoverForAccounts attributes

Attribute

Type

Description

Required

name

String

Account identifier (empty element disables all)

No

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:pro-snowflake="http://www.liquibase.org/xml/ns/pro-snowflake"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
        http://www.liquibase.org/xml/ns/pro-snowflake
        http://www.liquibase.org/xml/ns/pro-snowflake/liquibase-pro-snowflake-latest.xsd">
  <!-- Enable replication to accounts -->
  <changeSet id="enable-replication" author="examples">
    <pro-snowflake:alterDatabaseReplication
            databaseName="MY_DATABASE"
            ifExists="true">
      <pro-snowflake:enableReplicationForAccounts>
        <pro-snowflake:account name="MYORG.ACCOUNT1"/>
        <pro-snowflake:account name="MYORG.ACCOUNT2"/>
      </pro-snowflake:enableReplicationForAccounts>
    </pro-snowflake:alterDatabaseReplication>
  </changeSet>
  <!-- Disable replication to all accounts -->
  <changeSet id="disable-replication-all" author="examples">
    <pro-snowflake:alterDatabaseReplication databaseName="MY_DATABASE">
      <pro-snowflake:disableReplicationForAccounts/>
    </pro-snowflake:alterDatabaseReplication>
  </changeSet>
  <!-- Disable replication to specific accounts -->
  <changeSet id="disable-replication-specific" author="examples">
    <pro-snowflake:alterDatabaseReplication databaseName="MY_DATABASE">
      <pro-snowflake:disableReplicationForAccounts>
        <pro-snowflake:account name="MYORG.ACCOUNT1"/>
      </pro-snowflake:disableReplicationForAccounts>
    </pro-snowflake:alterDatabaseReplication>
  </changeSet>
  <!-- Refresh replica database -->
  <changeSet id="refresh-replica" author="examples">
    <pro-snowflake:alterDatabaseReplication
            databaseName="MY_REPLICA_DB"
            refresh="true"/>
  </changeSet>
  <!-- Enable failover (Business Critical Edition) -->
  <changeSet id="enable-failover" author="examples">
    <pro-snowflake:alterDatabaseReplication databaseName="MY_DATABASE">
      <pro-snowflake:enableFailoverForAccounts>
        <pro-snowflake:account name="MYORG.ACCOUNT1"/>
      </pro-snowflake:enableFailoverForAccounts>
    </pro-snowflake:alterDatabaseReplication>
  </changeSet>
  <!-- Disable failover -->
  <changeSet id="disable-failover" author="examples">
    <pro-snowflake:alterDatabaseReplication databaseName="MY_DATABASE">
      <pro-snowflake:disableFailoverForAccounts/>
    </pro-snowflake:alterDatabaseReplication>
  </changeSet>
  <!-- Promote replica to primary -->
  <changeSet id="promote-to-primary" author="examples">
    <pro-snowflake:alterDatabaseReplication
            databaseName="MY_REPLICA_DB"
            primary="true"/>
  </changeSet>
</databaseChangeLog>