Database Restore Error with POSTGRESQL

Hello Community Member,

We are facing lots of trouble with database restore process.

Previously, our site was based on POSTGRES verion 10.12. and recently we moved our server to new one with POSTGRES version 12.

The problem we are facing is, we are not able to restore our old database(version 10 based) to new site(version 12 based) and also during the restore process there is no error log. bench method for restore is working well but after restore database we found nothing in the server related to our old data.

Below method we used for installation and restore,

  1. bench init frappe-bench
  2. bench new-site dev --db-type postgres
  3. bench install-app frappe
  4. bench start
  5. bench --site dev --force restore sql_file_path

Thanks in Advance

Resolved.

@Sahil

Could please give us some explanation how to solved?

Hi @Sahil

Trust you’re doing well. Pls give some detail as to how you resolved the issue for the benefit of others. Just saying it’s resolved doesn’t really qualify as a solution :blush:

Cheers

@krnkris try below mentioned method

Steps for POSTGRESQL database restore:-

First connect to POSTGRESQL using: sudo -i -u postgres

Then there are two ways to restore a PostgreSQL database:

  1. psql for restoring from a plain SQL script file created with pg_dump ,
  2. pg_restore for restoring from a .tar file, directory, or custom format created with pg_dump .

1. Restore a database with psql

psql db_name < dump_name.sql

where db_name is the database name, and dump_name.sql is the name of your backup file.

2. Restore a database with pg_restore

pg_restore -d db_name /path/to/your/file/dump_name . tar

Hope it will also work for you.

1 Like