You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/backup/restore-azure-database-postgresql-flex.md
+24-7Lines changed: 24 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Restore Azure PostgreSQL-Flexible server as Files using Azure portal
3
3
description: Learn about how to restore Azure PostgreSQL-Flexible server as Files.
4
4
ms.topic: how-to
5
-
ms.date: 04/30/2025
5
+
ms.date: 05/06/2025
6
6
ms.service: azure-backup
7
7
ms.custom:
8
8
- ignite-2024
@@ -24,10 +24,12 @@ Before you restore from Azure Database for PostgreSQL Flexible server backups, r
24
24
25
25
- 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.
26
26
27
-
## Restore Azure PostgreSQL-Flexible database
27
+
## Restore Azure PostgreSQL - Flexible server backups as files
28
28
29
29
>[!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.
31
33
32
34
To restore Azure PostgreSQL-Flexible database, Follow these steps:
33
35
@@ -50,13 +52,11 @@ To restore Azure PostgreSQL-Flexible database, Follow these steps:
50
52
:::image type="content" source="./media/restore-azure-database-postgresql-flex/review.png" alt-text="Screenshot showing the review process page.":::
51
53
52
54
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
-
55
55
56
56
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:
57
57
58
58
-`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.
60
60
-`Tablespace.sql file`: Tablespace file.
61
61
-`Schema.sql file`: Contains schema information for all the databases on the server.
62
62
@@ -121,7 +121,24 @@ Here are the key considerations:
121
121
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.
122
122
-**Create Non-Entra Roles**: Use a local admin account to run the role creation scripts.
123
123
-**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.
124
141
125
-
## Next steps
142
+
## Next steps
126
143
127
144
[Manage backup of Azure PostgreSQL - Flexible Server using Azure portal](backup-azure-database-postgresql-flex-manage.md).
0 commit comments