V13 DB restore in v14

I ran into some problem upgrading from v13 in ubuntu 20.04 so, I decided to take backup with files and clean install new ubuntu 22.04 and installed v14 following this guide. There were no problems in installation of ERPN v14. But when I tried to restore the old database, this error appeared.

ERROR 2006 (HY000) at line 5828: Server has gone away
Table ‘tabDefaultValue’ missing in the restored site. Database not installed correctly, this can due to lack of permission, or that the database name exists. Check your mysql root password, validity of the backup file or use --force to reinstall

This gave Internal Server error in web browser.
Luckily I had taken backup of v14 before giving restore command. I restore and I have v14 up and running but I have yet to restore old data.

Here’s the old site_config.json:

{
 "db_name": "_456ad5fddff313da",
 "db_password": "some password here",
 "db_type": "mariadb",
 "encryption_key": "some key here",
 "pause_scheduler": 0,
 "user_type_doctype_limit": {
  "employee_self_service": 10
 }
}

Here’s the new site_config.json in v14:

{
 "db_name": "_e516733d80f92fe9",
 "db_password": "some other password",
 "db_type": "mariadb",
 "maintenance_mode": 0,
 "user_type_doctype_limit": {
  "employee_self_service": 20
 },
 "domains": [
  "erp.example.com"
 ]
}

How can I resolve this issue and restore v13 backups into v14 ?

Hi,

Have you tried bench --site yourSiteName --force restore pathToBackup.sql.gz ?

If possible to upgrade the Ubuntu 20 to 22 then use switch-to-branch to upgrade from 13 to 14 in place, it sounds like that is no longer an option,

Yes tried it multiple times. Tried it just now as well. Same error persists!

Yes, no longer an option. Actually I tried to do that earlier. But I encountered problems with pip.

Perhaps drop the site , switch to branch 13 frappe and erpnext , try new-site then restore , then switch to branch 14?

I am also thinking to do the same and tried once. But switch to branch 13 also didnot work. I didnot record the error then.

May be there is some solution to this. Let me wait for help. Anything else you can think of would be helpful!

I had to do this to make the restore work. But the process went with a lot of errors most of which I didn’t understand. Nevertheless, managed to switch back to v13, restored backup and then again switched to v14. Now I have up and running ERPNext v14 with all my modifications/customizations and all files.

Also, turns out, this error:

is caused by large sized SQL file. To mitigate this, you need to add this line to /etc/mysql/my.cnf under [mysqld]
max_allowed_packet = 1024M
Increase the value as per you need.

can you help with the steps to achieve this?

Hello

  • Install all the necessary applications on the site
  • Then restore the data.
  • Run “bench --site (sitename) list-apps”.
  • After restore, you will notice that the versions of Frappe applications returned to 13.
  • Run “bench update --reset” command

Hope these steps will help you

Jumping onto the wagon with t slight delay …

so, that max_allowed_packet = 1024M in the my.cnf is the solution? No problem besides that to just take a v14 database dump and restore it on a new v14 installation?

can you tell me how exactly the restoration works ind terms of the bash commands to do this?

I guess putting the {public,private}/files/ to where they belong to has to be executed before the restoration of the database-dump, right?

Yes. A v14 db dump can be restored easily in v14. No problems should arise.

No. You don’t need to put files manually.
Check out bench restore command:

Refer this link: Bench Commands Cheatsheet

1 Like