This troubleshooting guide addresses common issues that you might encounter with
AlloyDB for PostgreSQL backups, recovery, and replication. Recommended fixes are
provided.

## You want to restore a deleted cluster

**Description:** In AlloyDB, both on-demand and automated
backups are independent of the cluster that you want to restore. You can restore
data from a backup to a new AlloyDB cluster even if the cluster
that you used to create the backup is deleted. The storage layer handles
AlloyDB backups. Also, the database doesn't lock during the
backup process, which ensures continuous availability.

Backup restoration in AlloyDB is *out of place*, which means
that you restore the backup to a new cluster rather than overwriting an existing
cluster. After you restore the cluster, you can add new primary or read pool
instances to the restored cluster.

When you restore a cluster using point-in-time recovery (PITR), you
can only restore a cluster from a time that is in the configured recovery
window. You must choose a timestamp for a time when the cluster had an instance.

**Recommended fix:**
[Restore a cluster from a stored backup](https://docs.cloud.google.com/alloydb/docs/backup/restore.md.txt).

By default, AlloyDB continuously backs up your data with a
14-day recovery window. If you reconfigure your backup plan, it might take up to
24 hours for continuous backups and recovery to create a backup and enable
continuous recovery functionality.

If you need help with this issue, contact
[Cloud Customer Care](https://docs.cloud.google.com/support).

## You don't know how to find your backups

**Description:** Backups are stored separately from cluster storage for
security and accessibility reasons.

**Recommended fix:** Find your backups using the following interfaces:

| **Interface** | **Find backups** |
|---|---|
| Google Cloud console | [View a list of backups](https://docs.cloud.google.com/alloydb/docs/backup/list.md.txt) in a project. |
| Google Cloud CLI | [View a list of backups](https://docs.cloud.google.com/alloydb/docs/backup/list.md.txt) in a project. |
| REST API | Use the `projects.locations.backups.list` method, which lets you list all backups in a specified project and location. |

## You want to perform a PITR, but you can't select a time

**Description:** AlloyDB offers PITR as
part of its continuous backup and recovery. Transaction logs, which are
essential for PITR, are offloaded to Cloud Storage, which ensures that the
logs don't impact the size or performance of your clusters.

You might be unable to select a specific time for PITR for the following
reasons:

- The cluster that you want to restore doesn't exist. You can't use PITR to restore a deleted cluster.
- The continuous backup feature isn't enabled. PITR relies on write-ahead logs (WAL) that are only collected when the continuous backup feature is enabled.
- The backup restoration point is earlier than the date of the earliest continuous backup.
- You didn't select a timestamp for a time when the cluster had an instance.

**Recommended fix:** Select a specific time for PITR.

Try the following fixes:

- Verify that the cluster you want to restore exists. If the cluster exists, then follow the steps in [Use point-in-time recovery (PITR)](https://docs.cloud.google.com/alloydb/docs/backup/restore-pitr.md.txt).
- Check if continuous backups are enabled on your cluster. If continuous backups are enabled, then follow the steps in [Use point-in-time recovery (PITR)](https://docs.cloud.google.com/alloydb/docs/backup/restore-pitr.md.txt).
- Check if the time that you want to restore the backup is in the configured recovery window. By default, AlloyDB continuously backs up your data with a 14-day recovery window. For more information, see [Configure continuous backup](https://docs.cloud.google.com/alloydb/docs/backup/configure.md.txt#configure-continuous).

## Your backups are deleted unexpectedly

**Description:** Your AlloyDB backups aren't deleted
automatically unless automatic backup deletion is required by your retention
configuration. The retention period of a backup is determined when
a backup plan creates the backup---the retention period is written into
the backup metadata at the time of backup creation, and the field is immutable.

Backups are created by backup plans, such as continuous backup and recovery or
automatic backups. Backups have a retention window that's defined in the
configuration of the backup plan, which is either the default retention window
of 14 days, or is a user-configured retention parameter. You can't choose a
retention period directly. On-demand backups have a 365-day retention
period.

**Recommended fix:** To avoid unexpected backup deletions, review your
backup plan configurations.

## You need to restore a backup to a different region

**Description:** You can only restore backups in the region where the backup is
located, unless you first create a new on-demand backup of the original cluster.

**Recommended fix:** Restore a cluster to a new region by creating a new
on-demand backup of the original cluster:

1. Create the new backup in the target region.
2. Use the new backup to perform the restore in your preferred region.

AlloyDB also supports backups on cross-region replicas. If you
have a cross-region replica, taking a backup from that replica can fulfill many
cross-region backup requirements. For more information, see
[Cross-region replication overview](https://docs.cloud.google.com/alloydb/docs/cross-region-replication/about-cross-region-replication.md.txt).