Backup and Restore procedure

I had been trying to search for some kind of documentation for taking backups from remote and doing a complete restore on the local desktop. After searching the whole of discussion forum and getting stuck at few places, I was able to download the backup from the remote site on the local machine and do a restore on the local desktop. I will share the steps that I followed so that it can be useful for other people also:

Backup and Restore

  1. Download the latest backup from the Setup:

  1. This will get saved on your local desktop in the downloads folder.

  2. Copy this file under this folder:
    frappe-bench/sites/site-name/public/files

The site-name is the name of the site on your local desktop.

  1. Unzip the file using the following commands:

umag@epoch~$ cd frappe-bench/sites/site-name/public/files
umag@epoch~/frappe-bench/sites/site-name/public/files$ gunzip 20160602_78570815_database.sql.gz
umag@epoch~/frappe-bench/sites/site-name/public/files$ cd
umag@epoch:~$ pwd
/home/umag
umag@epoch~$ cd frappe-bench
umag@epoch~/frappe-bench$ bench - - site site-name - - force restore $PWD/sites/site-name/public/files/ 20160602_78570815_database.sql

It will ask for the MySQL root password. Once you enter the password, it will get restored.

Though, I was able to restore the files on the local machine, it was giving some operational error of table not found while logging into the localhost. So, I searched the web again and realized that I had to do a bench migrate as well. So, I ran this command in the command prompt.

umag@epoch:~frappe-bench$ bench - -site site-name migrate

Once this was done, I was able to view the remote databases on my local machine.

4 Likes

Hi, there’s existing documentation for restoring a database :

2 Likes

Are you using Oracle Virtual Box for the local machine? If yes can you give details on step 2. I could not find how to do that step

Hi Ron,

I had used the Ubuntu desktop and had copied the file from the Files explorer. I am not using Oracle Virtual Box.

@Ron_Taylor one of easy way if you’re using VM is by using ftp client to copy files

Bitvise is a good ssh program with built in ftp, saves a step during the restore process

Can you explain how for me? I am Totally rubbish for this kind of thing

  1. Connect your ftp client to VM e.g. 192.168.56.1:8080
  2. Locate backup files under ~/frappe-bench/sites/[your-site]/private/backups

get “winSCP”

use “sftp” proto
add hostname “localhost”
port “3022”

PS i know its old question, but :slight_smile:

1 Like

Thank you, you saved me a lot of time

Can someone tell me what the MySQL root password is when using the Oracle VM? Been stuck on that for a while now…

frappe is the default

Got it. Thanks! Would you also happen to know what to do when this happens when running the “bench restore” command?
“Exception: Database 46459e8459d14de1 already exists”

I am guessing that you will need to drop the database before executing the restore.

Welcome to ERPNext and thanks ptsiampas

Check this to do that Database already exists

Yeah, I got that, I was replying to the guy above my comment. Figured it was a pretty simple thing to do from MySQL :slight_smile: unless you have zero experience with databases then, well time to read stuff.

1 Like

can Mack video for this please