pg_restore problem

Andrei Haba 0 Reputation points
2024-01-02T11:42:21.7333333+00:00

I want to restore a postgres database and i have a problem.

i do this line of code pg_restore -Fd -j 2 -d template1 /var/lib/postgresql/backup.dump -h postgres-17.postgres.database.azure.com -p 5432 -U habacookplok 2> ~/errors.log => i specify the document where i have the dump database.

After i press the enter buttom i have this error /var/lib/postgresql/backup.dump/toc.dat => but i didnt specify /toc.dat

Please tell me what to change to restore ?

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,547 Reputation points Microsoft Employee Moderator
    2024-01-02T17:22:51.03+00:00

    Hi, @Andrei Haba Welcome to Microsoft Q&A thanks for posting your question.

    It looks like you are specifying the wrong file path for the backup file. based on the documentation i tried below commends and was able to restore successfully.

    https://learn.microsoft.com/en-us/azure/postgresql/migrate/how-to-migrate-using-dump-and-restore

    Can you try as below?

    pg_dump -Fc -v --host=postgrestest.postgres.database.azure.com --username=yourusername --dbname=testdb -f mytest.dump

    pg_restore -v --no-owner --host=postgrestest2.postgres.database.azure.com --port=5432 --username=yourusername2 --dbname=test2db mytest.dump

    Regards

    Geetha


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.