Restoring backup in v.8

Hi there,

I had problem while updating the system which lead to losing all data. fortunately, I have backup and I install fresh copy with latest version but I don’t know how to restore it.

Thanks,

Hello @Mahdi_Bukhamseen

Restoring a db is simple, please follow the following:

Restoring From ERPNext Backup · frappe/erpnext Wiki · GitHub

If you encounter any error please paste the full error log.

Thanks ramielian for reply, should I have 2 files for backup or one file. I mean sql.gz and tar. I have only the sql.gz. I tried to restore it but got this error:

tmp$ bench --site site1.local --force restore /tmp/20170503_132842_b5cfdb5f_database.sql
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 26, in cli
return frappe_cmd()
File “/home/frappe/.bench/bench/cli.py”, line 87, in frappe_cmd
os.chdir(os.path.join(bench_path, ‘sites’))
OSError: [Errno 2] No such file or directory: ‘./sites’

looks like you are in `/tmp’ while you execute the restore command?

I guess you may be more successful when you try the restore from within the frappe-bench folder.

I’d try:

cd /home/frappe/frappe-bench
bench --site site1.local --force restore /path/to/backup.sql

(/path/to/backup would be /tmp/20170503_132842_b5cfdb5f_database.sql in your example)

Hi @Mahdi_Bukhamseen

You should be running the command from Frappe folder /home/frappe/frappe-bench as @vrms said, but the SQL file is where you saved the file only ( /tmp/20170503_132842_b5cfdb5f_database.sql is not in your case as it is a backup temporary file used by frappe in order to not mess up the original file).

Backing up and restoring ERPNext would have 2 parts up to what you need and have, files and DB.

If you only have the DB it is ok mostly as ERPNext saves most the modifications in the DB before converting it to files (as far as i know).

You have to just follow the steps and run the commands from Frappe folder.

Hello,
I made a restore from my backup based on:

Everything works well.

FULL VM BACKUP:
cd frappe-bench
bench --site erpnext.vm backup --with-files

I simply ran these commands to generate an instant backup:

cd frappe-bench
bench backup --with-files

This generated the .tar file with the .sql database backup and two other files containing images and other attachments (i.e. pdf’s, etc)

If the scheduler had not been enabled - maybe ‘not enabled’ is the default configuration for the pre-configured virtual machine option. I just ran these commands to start it:

cd frappe-bench
bench enable-scheduler

Hope it helps