1

I was tasked with writing a python script to backup our current instance of Alfresco ECM. The backup works like a charm. I am running into problems with restoring PostgreSQL from the text dump .sql file.

Here is my command:

psql -f /home/alfresco/alfresco-backup/20180124/20180124_183146.sql -h 
localhost

Here is the response:

psql: FATAL:  database "postgres" does not exist

I can not find any information on this online. I have looked deeply into Postgres documentation and found nothing.

Thank you.

Nuri Tasdemir
  • 9,720
  • 3
  • 42
  • 67
sruffatti
  • 37
  • 3

2 Answers2

0

You are getting this error because you are not specifying database name in command and its defaulting to postgres for database name. You can use pg_dump to backup database. Here is how you run a pg_dump command.

pg_dump -U db_user -W -F t db_name > /path/to/your/file/dump_name.tar
  • This is true in the context of dropping a single database, however for this assignment I was instructed to use pg_dumpall. pg_dumpall has a different restore command than pg_dump. – sruffatti Jan 26 '18 at 20:19
0

It seems like the postgres and the template1 databases have been deleted. That shouldn't happen.

Use initdb to create a new, healthy DB cluster.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263