SURVIVE {ZONE, REGION} FAILURE

On this page Carat arrow pointing down
Warning:
CockroachDB v21.1 is no longer supported as of November 18, 2022. For more details, refer to the Release Support Policy.

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

Note:

SURVIVE {ZONE,REGION} FAILURE is a subcommand of ALTER DATABASE.

Synopsis

ALTER DATABASE database_name SURVIVE ZONE REGION FAILURE

Parameters

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

Required privileges

The user must be a member of the admin or owner roles, or have the CREATE privilege on the database.

Examples

Survive zone failures

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

icon/buttons/copy
ALTER DATABASE {db} SURVIVE ZONE FAILURE;
ALTER DATABASE SURVIVE
Note:

Surviving zone failures is the default setting for multi-region databases.

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:

icon/buttons/copy
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


Yes No
On this page

Yes No