SURVIVE {ZONE, REGION} FAILURE

On this page Carat arrow pointing down
Warning:
CockroachDB v22.1 is no longer supported. For more details, see the Release Support Policy.

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

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