What is "storage account" during postgresql flexible server restoration process?

Mateusz Klimas 20 Reputation points
2024-08-01T14:11:16.1833333+00:00

Hello,

I know that probably I am missing something, but cannot figure out what I am doing wrong. I created a backup for my Postgresql flexible server exactly as described here:

https://learn.microsoft.com/en-us/azure/backup/backup-azure-database-postgresql-flex

It worked well - meaning, backup was created without any issues. Then, I wanted to restore the backup with the following procedure:

https://learn.microsoft.com/en-us/azure/backup/restore-azure-database-postgresql-flex

But at the third step "Restore parameters" I am being asked about... storage account as a restore target, which sounds ridiculous. When I press "Select from the existing storage accounts" I don't see any storage account that could fit as the restoration target. Can someone please tell me what am I missing, what am I doing wrong and how to restore this backup to the actual database, not the storage account?

Thanks in advance,
Mateusz

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,256 questions
Azure Database for PostgreSQL
0 comments No comments
{count} votes

Accepted answer
  1. Stanislav Zhelyazkov 24,051 Reputation points MVP
    2024-08-02T06:41:43.8866667+00:00

    Hi,

    From the documentation:

    "Backup data is stored in the Backup vault as a blob within the Microsoft tenant. During a restore operation, the backup data is copied from one storage account to another across tenants. Ensure that the target storage account for the restore has the AllowCrossTenantReplication property set to true."

    Basically Azure Backup does not restore directly on the PostgreSQL flexible server. Instead it restores all the backed up files to Storage account:

    "Once the job is finished, the backed-up data is restored into the storage account. Below are the set of files recovered in your storage account after the restore:

    The first file is a marker or timestamp file that gives the customer the time the backup was taken at. The file cannot be restored but if opened with a text editor should tell the customer the UTC time when the backup was taken.

    The Second file database is an individual database backup for database called tempdata2 taken using pg_dump. Each database has a separate file with format – {backup_name}database{db_name}.sql

    The Third File _roles. Has roles backed up using pg_dumpall

    The Fourth file _schemas. backed up using pg_dumpall

    The Fifth file _tablespaces. Has the tablespaces backed up using pg_dumpall

    1. Post restoration completion to the target storage account, you can use pg_restore utility to restore an Azure Database for PostgreSQL flexible server database from the target. Use the following command to connect to an existing postgresql flexible server and an existing database pg_restore -h <hostname> -U <username> -d <db name> -Fd -j <NUM> -C <dump directory>
      • -Fd: The directory format.
      • -j: The number of jobs.
      • -C: Begin the output with a command to create the database itself and then reconnect to it.
      Here's an example of how this syntax might appear: pg_restore -h <hostname> -U <username> -j <Num of parallel jobs> -Fd -C -d <databasename> sampledb_dir_format If you have more than one database to restore, re-run the earlier command for each database."

    Flexible server is like PostgreSQL on VM but without the hassle of managing the VM but still having all the PostgreSQL capabilities thus the restore process is similar to how you will do restore if the PostgreSQL was installed on VM.

    From the documentation it is not clear exactly what are the requirements of the storage account but most likely you need type Standard general-purpose v2 in the same location as the vault setting AllowCrossTenantReplication enabled.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.