skip to Main Content

I am trying to restore a .tar file in pgadmin 4.

I created a new empty database exercises.
Then clicked on exercises > create restore > select file path with data options as pre-data, data, post-data selected.
While restoring it, I am getting an error.
Screenshot for pgadmin4

Error description logs

Error Logs in plain text:

 C:Program FilesPostgreSQL16pgAdmin 4runtimepg_restore.exe --host "localhost" --port "5432" --username "postgres" --no-password --dbname "exercises" --section=pre-data --section=data --section=post-data --verbose "C:\Users\Bhaskar\DOWNLO~1\EXERCI~1.TAR"

I have also tried to restore without any data options too.

How to resolve this error

2

Answers


  1. Chosen as BEST ANSWER

    It got resolved after doing the following steps

    Open up pgAdmin4 and go to:

    File > Preferences > Paths > Binary paths > PostgreSQL Binary Path
     > select the appropriate postgres version(you may not have the default version listed)
    > select the bin folder of the version selected and click validate > Click OK
    

    • Navigate to the Directory Containing the Tar File using terminal

    • make sure PostgreSQL Server is Running:

    • Run the pg_restore Command :

      pg_restore --verbose --clean --no-acl --no-owner -h localhost -U your_username -d your_database_name your_backup_file.tar

    Explanation of the options:

    -verbose: Show progress information.

    • clean: Drop existing database objects before restoring.

    • no-acl and –no-owner: Ignore access control lists and ownership information.

    • h localhost: Specifies the host (you may need to adjust this).

    • U your_username: Specifies the username to connect to the database.

    • d your_database_name: Specifies the name of the database to restore.

    • your_backup_file.tar: replace this with the actual name of your tar file.
      Adjust the options based on your specific needs and configuration.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search