Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.91 KB

survive-failure.md

File metadata and controls

77 lines (53 loc) · 2.91 KB
title summary toc
SURVIVE {ZONE, REGION} FAILURE
The SURVIVE {ZONE,REGION} FAILURE statement configures a multi-region database.
true

New in v21.1: The ALTER DATABASE .. SURVIVE {ZONE,REGION} FAILURE statement sets the survival goal for a multi-region database.

{{site.data.alerts.callout_info}} SURVIVE {ZONE,REGION} FAILURE is a subcommand of ALTER DATABASE {{site.data.alerts.end}}

Synopsis

{% include {{ page.version.version }}/sql/generated/diagrams/alter_database_survival_goal.html %}

Parameters

| Parameter | Description | |-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | database_name | The database whose survival goal you are configuring. |

Required privileges

The user must be a member of the admin role or must have the CREATEDB parameter set.

Examples

Survive zone failures

To change the survival goal of a multi-region database to survive zone failures, use the following statement:

{% include copy-clipboard.html %}

ALTER DATABASE {db} SURVIVE ZONE FAILURE;
ALTER DATABASE SURVIVE

{{site.data.alerts.callout_info}} Surviving zone failures is the default setting for multi-region databases. {{site.data.alerts.end}}

For more information about the zone survival goal, see Surviving zone failures.

Survive region failures

To change the survival goal of a multi-region database to survive region failures, use the following statement:

{% include copy-clipboard.html %}

ALTER DATABASE {db} SURVIVE REGION FAILURE;
ALTER DATABASE SURVIVE

If you try to change a database with less than 3 database regions to survive region failures, the following error will be signalled:

ERROR: at least 3 regions are required for surviving a region failure
SQLSTATE: 42602
HINT: you must add additional regions to the database using ALTER DATABASE mr ADD REGION <region_name>

For more information about the region survival goal, see Surviving region failures.

See also