Skip to content

Commit 1d5aabd

Browse files
Updates to restore PostgreSQL flex doc
1 parent f97d0d1 commit 1d5aabd

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed
-58 Bytes
Loading
-55.1 KB
Loading
-59.4 KB
Loading
25 KB
Loading

articles/backup/restore-azure-database-postgresql-flex.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Restore Azure PostgreSQL-Flexible server as Files using Azure portal
33
description: Learn about how to restore Azure PostgreSQL-Flexible server as Files.
44
ms.topic: how-to
5-
ms.date: 04/30/2025
5+
ms.date: 05/06/2025
66
ms.service: azure-backup
77
ms.custom:
88
- ignite-2024
@@ -24,10 +24,12 @@ Before you restore from Azure Database for PostgreSQL Flexible server backups, r
2424

2525
- Ensure the target storage account for restoring backup as a file is accessible via a public network. If the storage account uses a private endpoint, [update its public network access settings](backup-azure-database-postgresql-flex-manage.md#enable-public-network-access-for-the-database-storage-account) before executing a restore operation.
2626

27-
## Restore Azure PostgreSQL-Flexible database
27+
## Restore Azure PostgreSQL - Flexible server backups as files
2828

2929
>[!Note]
30-
>The restore operation transfers all PostgreSQL – flexible server databases to a designated storage account container. After restoration, move the files to a new or existing PostgreSQL – Flexible server.
30+
>Restore operation is a two step process:
31+
>1. Restore the backup from Backup vault to a storage container.
32+
>2. Restore the backup files from storage container to a new or existing flexible server.
3133
3234
To restore Azure PostgreSQL-Flexible database, Follow these steps:
3335

@@ -50,13 +52,11 @@ To restore Azure PostgreSQL-Flexible database, Follow these steps:
5052
:::image type="content" source="./media/restore-azure-database-postgresql-flex/review.png" alt-text="Screenshot showing the review process page.":::
5153

5254
1. Submit the Restore operation and track the triggered job under **Backup jobs**.
53-
:::image type="content" source="./media/restore-azure-database-postgresql-flex/validate.png" alt-text="Screenshot showing the validate process page.":::
54-
5555

5656
After the restore job is completed successfully, go to the storage account container to view the restored databases as files (`.sql` files) from your PostgreSQL – Flexible server. Azure Backup also generates the following backup files:
5757

5858
- `Database.sql file` per database: Contains data and schema information for a particular database.
59-
- `Roles.sql files` for entire instance: Contains all role information ((azure_su(superuser) azure_pg_admin, replication, local admin, Microsoft Entra admins and any other custom roles on the server)) that exists at server level.
59+
- `Roles.sql files` for entire instance: Contains all role information that exists at server level.
6060
- `Tablespace.sql file`: Tablespace file.
6161
- `Schema.sql file`: Contains schema information for all the databases on the server.
6262

@@ -121,7 +121,24 @@ Here are the key considerations:
121121
Before you restore the database objects, ensure that you properly dump and clean up the roles. To perform this action, download the `roles.sql`script from your storage container and create all required logins.
122122
- **Create Non-Entra Roles**: Use a local admin account to run the role creation scripts.
123123
- **Create Microsoft Entra Roles**: If you need to create roles for Microsoft Entra users, use a Microsoft Entra administrator account to run the necessary scripts.
124+
125+
You can download the roles script from your storage account as shown in the following screenshot:
126+
127+
:::image type="content" source="./media/restore-azure-database-postgresql-flex/containers.png" alt-text="Screenshot showing the containers page.":::
128+
129+
When you migrate the output file, `roles.sql` might include certain roles and attributes that aren't applicable in the new environment. You must consider the following:
130+
131+
- **Removing attributes that can be set only by superusers**: If you migrate to an environment where you don't have superuser privileges, remove attributes such as *NOSUPERUSER* and *NOBYPASSRLS* from the roles dump.
132+
- **Excluding service-specific users**: Exclude Single server service users, such as `azure_superuser` or `azure_pg_admin`. These are specific to the service and are created automatically in the new environment.
133+
134+
Use the following sed command to clean up your roles dump:
135+
136+
```
137+
sed -i '/azure_superuser/d; /azure_pg_admin/d; /azuresu/d; /^CREATE ROLE replication/d; /^ALTER ROLE replication/d; /^ALTER ROLE/ {s/NOSUPERUSER//; s/NOBYPASSRLS//;}' roles.sql
138+
```
139+
140+
This command deletes the lines containing `azure_superuser`, `azure_pg_admin`, `azuresu`, lines starting with *CREATE ROLE* replication and *ALTER ROLE* replication, and removes the *NOSUPERUSER* and *NOBYPASSRLS* attributes from *ALTER ROLE* statements.
124141

125-
## Next steps
142+
## Next steps
126143

127144
[Manage backup of Azure PostgreSQL - Flexible Server using Azure portal](backup-azure-database-postgresql-flex-manage.md).

0 commit comments

Comments
 (0)