Backup and Restore Error Programming Error: (1146, “Table ‘1db3e0294d.tabDefalultValue’ doesn’t exist”)

Hi Gurus
I’m using ERPNexT Version: 6.18.4 production on Ubuntu 14.04 LTS installed using easy installation and tried to restore a backup in a separate pc with same installation, running the below command
/frappe-bench$ bench --force restore /path to sql file
and ended up with: Programming Error: (1146, “Table ‘1db3e0294d.tabDefalultValue’ doesn’t exist”)

when i tried to login shows Internal Server Error!!!

Can anybody guide what went wrong and how to fix it. How to restore backups?

Regards,

@jchakma did you give full path to SQL file?

  1. First you need to unzip the sql.gz file using gunzip filename.sql.gz
  2. Say the file is in /path/to/frappe-bench/sites/site1.local/filename.sql, then run:
    bench --site site1.local --force restore $PWD/sites/site1.local/filename.sql

I am also getting same issue while restoring database using bench restore. But when I ran db backup script from MySQL Workbench, db restore done successfully.

@anand
thanks for your reply. I reinstalled ubuntu 14.04 and erpnext with easy way installation. and followed as below and ended up same as previous:

oong@boong:~$ cd frappe-bench/sites/site1.local/public/files

boong@boong:~/frappe-bench/sites/site1.local/public/files$ gunzip 20160203_50594621_database.sql.gz

boong@boong:~/frappe-bench/sites/site1.local/public/files$ cd

boong@boong:~$ pwd

/home/boong

boong@boong:~$ cd frappe-bench

boong@boong:~/frappe-bench$ bench --site site1.local --force restore /sites/site1.local/public/files/20160203_50594621_database.sql

MySQL root password:

sh: 1: cannot open /sites/site1.local/public/files/20160203_50594621_database.sql: No such file

Traceback (most recent call last):

File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main

"__main__", fname, loader, pkg_name)

File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code

exec code in run_globals

File “/home/boong/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in

main()

File “/home/boong/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main

click.Group(commands=commands)(prog_name='bench')

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call

return self.main(*args, **kwargs)

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main

rv = self.invoke(ctx)

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke

return _process_result(sub_ctx.command.invoke(sub_ctx))

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke

return _process_result(sub_ctx.command.invoke(sub_ctx))

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke

return ctx.invoke(self.callback, **ctx.params)

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke

return callback(*args, **kwargs)

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func

return f(get_current_context(), *args, **kwargs)

File “/home/boong/frappe-bench/apps/frappe/frappe/commands.py”, line 29, in _func

ret = f(frappe._dict(ctx.obj), *args, **kwargs)

File “/home/boong/frappe-bench/apps/frappe/frappe/commands.py”, line 130, in restore

_new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password,

admin_password=admin_password, verbose=context.verbose,
install_apps=install_app, source_sql=sql_file_path, force=context.force)

File “/home/boong/frappe-bench/apps/frappe/frappe/commands.py”, line 89, in _new_site

_install_app("frappe", verbose=verbose, set_as_patched=not source_sql)

File “/home/boong/frappe-bench/apps/frappe/frappe/installer.py”, line 92, in install_app

frappe.clear_cache()

File “/home/boong/frappe-bench/apps/frappe/frappe/init.py”, line 421, in clear_cache

for fn in frappe.get_hooks("clear_cache"):

File “/home/boong/frappe-bench/apps/frappe/frappe/init.py”, line 713, in get_hooks

hooks = _dict(cache().get_value("app_hooks", load_app_hooks))

File “/home/boong/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 68, in get_value

val = generator()

File “/home/boong/frappe-bench/apps/frappe/frappe/init.py”, line 681, in load_app_hooks

for app in [app_name] if app_name else get_installed_apps(sort=True):

File “/home/boong/frappe-bench/apps/frappe/frappe/init.py”, line 661, in get_installed_apps

installed = json.loads(db.get_global("installed_apps") or "[]")

File “/home/boong/frappe-bench/apps/frappe/frappe/database.py”, line 641, in get_global

return self.get_default(key, user)

File “/home/boong/frappe-bench/apps/frappe/frappe/database.py”, line 653, in get_default

d = self.get_defaults(key, parent)

File “/home/boong/frappe-bench/apps/frappe/frappe/database.py”, line 659, in get_defaults

defaults = frappe.defaults.get_defaults(parent)

File “/home/boong/frappe-bench/apps/frappe/frappe/defaults.py”, line 72, in get_defaults

globald = get_defaults_for()

File “/home/boong/frappe-bench/apps/frappe/frappe/defaults.py”, line 177, in get_defaults_for

where parent = %s order by creation""", (parent,), as_dict=1)

File “/home/boong/frappe-bench/apps/frappe/frappe/database.py”, line 135, in sql

self._cursor.execute(query, values)

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute

self.errorhandler(self, exc, value)

File “/home/boong/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler

raise errorclass, errorvalue

_mysql_exceptions.ProgrammingError: (1146, “Table ‘1bd3e0294d.tabDefaultValue’ doesn’t exist”)
boong@boong:~/frappe-bench$

when local host is browsed says “Internal Server Error”

how the fix this and restore the backup. Pls help…

@jchakma you need to follow instructions!

You forgot the $PWD:

bench --site site1.local --force restore $PWD/sites/site1.local/public/files/20160203_50594621_database.sql

@anand
many many thumbs up… Finally it worked. But with *** Scheduler is disabled ***.
Checked data are restored…

Run bench —site site1.local enable-scheduler to enable scheduler

Best,
Anand Doshi

ERPNext

@anand
Thanks a lot. Consider it’s closed.