R
Railway•9mo ago
Attacler/Bart

Error while trying to restore DB dump

Hi there, I am trying to restore a DB backup but it always says the errors that are inside the attached printscreen. How to fix this?
Solution:
you first need to extract the tar.gz to a folder. then you can use that in the restore command like this:
"C:\Program Files\PostgreSQL\16\bin\pg_restore.exe" -U postgres -d railway backup-2024-03-15T04-00-00-155Z
"C:\Program Files\PostgreSQL\16\bin\pg_restore.exe" -U postgres -d railway backup-2024-03-15T04-00-00-155Z
...
Jump to solution
39 Replies
Percy
Percy•9mo ago
Project ID: b104e257-83ee-41ff-9531-6de29afa5df4
Attacler/Bart
Attacler/BartOP•9mo ago
b104e257-83ee-41ff-9531-6de29afa5df4
Attacler/Bart
Attacler/BartOP•9mo ago
No description
Attacler/Bart
Attacler/BartOP•9mo ago
i am on windows
Brody
Brody•9mo ago
need more info, how was the backup made?
Attacler/Bart
Attacler/BartOP•9mo ago
using the pg backup template
Attacler/Bart
Attacler/BartOP•9mo ago
this one if im correct
No description
Brody
Brody•9mo ago
what is the filesize of your backup
Attacler/Bart
Attacler/BartOP•9mo ago
😂 40 GB
Brody
Brody•9mo ago
yikes
Attacler/Bart
Attacler/BartOP•9mo ago
yea there is something wrong and i have to digg what is wrong 😂
Brody
Brody•9mo ago
what command are you running to restore it
Attacler/Bart
Attacler/BartOP•9mo ago
psql -d railway -U postgres < restore.sql also tried pg_restore but its always complaining
Brody
Brody•9mo ago
about what
Attacler/Bart
Attacler/BartOP•9mo ago
No description
Attacler/Bart
Attacler/BartOP•9mo ago
i am able to extract the tar.gz
Attacler/Bart
Attacler/BartOP•9mo ago
one step further i guess
No description
Brody
Brody•9mo ago
what is your pg_restore version?
Attacler/Bart
Attacler/BartOP•9mo ago
14, already downloading 15
Brody
Brody•9mo ago
is the database on railway that the backup came from 15?
Attacler/Bart
Attacler/BartOP•9mo ago
no, its on 13 😅
Brody
Brody•9mo ago
oh
Attacler/Bart
Attacler/BartOP•9mo ago
tried to use pg restore from version 13 but i guess the pg_dump is using 15
Brody
Brody•9mo ago
well the template uses pg_dump 16, so you may need pg_restore 16 too
Attacler/Bart
Attacler/BartOP•9mo ago
alright i see
Brody
Brody•9mo ago
idk pg_restore 15 might work with dumps from pg_dump 16
Attacler/Bart
Attacler/BartOP•9mo ago
before this experience: only version 14, now 13,14,15 and possible 16 i`ll try thanks so far 🙂
Attacler/Bart
Attacler/BartOP•9mo ago
ah i see okay with PG 16 it seems to work
Brody
Brody•9mo ago
the backup is underway?
Attacler/Bart
Attacler/BartOP•9mo ago
yes but 40GB takes sometime 😂
Brody
Brody•9mo ago
pog
Attacler/Bart
Attacler/BartOP•9mo ago
first going to see locally whats actually worth that much diskspace... fixed it an infinit loop in automation stuff was causing the logs to grow by alot 😂
Brody
Brody•9mo ago
happy you fixed it! what was the full command you use to restore the dump starting from the tar.gz file
Solution
Attacler/Bart
Attacler/Bart•9mo ago
you first need to extract the tar.gz to a folder. then you can use that in the restore command like this:
"C:\Program Files\PostgreSQL\16\bin\pg_restore.exe" -U postgres -d railway backup-2024-03-15T04-00-00-155Z
"C:\Program Files\PostgreSQL\16\bin\pg_restore.exe" -U postgres -d railway backup-2024-03-15T04-00-00-155Z
Brody
Brody•9mo ago
could you pipe the tar.gz file into pg_restore?
Attacler/Bart
Attacler/BartOP•9mo ago
didnt work for me only after extracting the tar.gz it worked
Brody
Brody•9mo ago
fair enough, thanks!
Attacler/Bart
Attacler/BartOP•9mo ago
you too!
Want results from more Discord servers?
Add your server