Error in Restoring Database - Table tabSingles doesn't exist

Hi,

I have a problem when I try Restore database in localhost machine.

It give me this error :

pymysql.err.ProgrammingError: (1146, u"Table ‘d56cb677eaab3383.tabSingles’ doesn’t exist")

Note :

  • Database is backup form my cloud

  • Both localhost and the cloud same version
    Installed Apps
    ERPNext: v10.1.2 (master)
    Frappe Framework: v10.1.0 (master)

  • NO CUSTOMIZATION MADE

Any help or suggestion ?

Thanks

which command are you using to restore database?

bench or mysql?

bench

try with these parameters

bench --force --site erpnext restore /home/frappe/frappe/

Thank you For your comment and support

I try it but same error I get :sleepy:

do the following steps.

  1. create new site at new server with same name
  2. install erpnext app
  3. restore with the following command.
    bench --force --site erpnext restore /home/frappe/frappe/

it’ll work.

the error, in your backup,is it’s trying to insert records in table which dosen’t exist.

I try it I create new site at new server with same name I install Erpnext
I use this commend bench --force --site erpnext restore /home/frappe/frappe/

Again same error

pymysql.err.ProgrammingError: (1146, u"Table ‘1bd3e0294da19198.tabSingles’ doesn’t exist")

:confused:

try to restore your DB directly from MYsql

mysql -u root -p 1bd3e0294da19198 < /home/path to sql file.

it’ll ask for your DB root password

please make sure your file should be extracted from *.sql.gz extention.

after this you can run bench migrate

I do it , Now I have this error

pymysql.err.ProgrammingError: (1146, u"Table ‘1bd3e0294da19198.tabPatch Log’ doesn’t exist")

i have a doubt about your backup file.

if you still have access to oldserver you can take the backup again directly from Mysql

mysqldump -u root -p 1bd3e0294da19198 > /home/path to sql file.

and then restore that new file.

i too have the same problem.
Followed all the above specified steps.
but not resolved

1 Like

I also tried the steps above using bench and mysql, bench is getting same error but when i try using mysql it was successful yet my data is not restored.

i have the same issue. the problem is in backup file for me.

but there is no error rise at ‘bench backup’. but when i backup with ‘mysqldump’ got an timeout then tuning the parameters at *.cnf file fixed the issue.

I am also getting the same issue Table “tabSingles” doesn’t exist.
I tried --force method also but still getting the same error.
But i tried to restore the database form backend with this command “bench --site your_site_name mariadb” and then “source /mysqldb_file_location” it worked.
I want to know the exact reason why the backup is not being uploaded with the bench command.

ERROR 2006 (HY000) at line 10867: Server has gone away ] 47% ETA 0:02:17
726MiB 0:02:03 [5.87MiB/s] [========================> ] 48%
App frappe already installed
File “/usr/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 109, in
main()
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/commands/init.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/commands/site.py”, line 199, in restore
_new_site(
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/installer.py”, line 108, in _new_site
scheduler.toggle_scheduler(enable_scheduler)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 141, in toggle_scheduler
frappe.db.set_single_value(“System Settings”, “enable_scheduler”, int(enable))
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/database/database.py”, line 835, in set_single_value
return self.set_value(doctype, doctype, fieldname, value, *args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/database/database.py”, line 985, in set_value
modified = modified or now()
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/data.py”, line 370, in now
return now_datetime().strftime(DATETIME_FORMAT)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/data.py”, line 303, in now_datetime
dt = convert_utc_to_system_timezone(datetime.datetime.utcnow())
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/data.py”, line 350, in convert_utc_to_system_timezone
time_zone = get_system_timezone()
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/data.py”, line 324, in get_system_timezone
return frappe.cache().get_value(“time_zone”, _get_system_timezone)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 81, in get_value
val = generator()
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/utils/data.py”, line 317, in _get_system_timezone
return frappe.db.get_system_setting(“time_zone”) or “Asia/Kolkata” # Default to India ?!
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/database/database.py”, line 1297, in get_system_setting
return frappe.get_system_settings(key)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/init.py”, line 2286, in get_system_settings
local.system_settings = get_cached_doc(“System Settings”)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/init.py”, line 1109, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/init.py”, line 1200, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/model/document.py”, line 78, in get_doc
return controller(*args, **kwargs)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/model/document.py”, line 110, in init
self.load_from_db()
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/model/document.py”, line 138, in load_from_db
single_doc = frappe.db.get_singles_dict(self.doctype, for_update=self.flags.for_update)
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/database/database.py”, line 782, in get_singles_dict
queried_result = frappe.qb.get_query(
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
File “/home/ajaymahiwal/frappe-instances/instance_2_newcom/frappe-bench/apps/frappe/frappe/database/database.py”, line 272, in sql
traceback.print_stack()
Error in query:
(‘SELECT field,value FROM tabSingles WHERE doctype=%(param1)s’, {‘param1’: ‘System Settings’})
Table ‘_001ca6ffbc7a8e3a.tabSingles’ doesn’t exist

1 Like

erpnext@erp:~$ cd frappe-bench/
erpnext@erp:~/frappe-bench$ bench --site kelioa restore /home/erpnext/20250703_030001-kelioa-database.sql
File “/usr/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 109, in
main()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/init.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py”, line 205, in restore
_new_site(
File “/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py”, line 72, in _new_site
enable_scheduler = _is_scheduler_enabled()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py”, line 25, in _is_scheduler_enabled
enable_scheduler = cint(frappe.db.get_single_value(“System Settings”, “enable_scheduler”))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 859, in get_single_value
).run()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 272, in sql
traceback.print_stack()
Error in query:
(‘SELECT value FROM tabSingles WHERE doctype=%(param1)s AND field=%(param2)s’, {‘param1’: ‘System Settings’, ‘param2’: ‘enable_scheduler’})
MySQL root password:
Restoring Database file…
App frappe already installed
File “/usr/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 109, in
main()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/init.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py”, line 205, in restore
_new_site(
File “/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py”, line 108, in _new_site
scheduler.toggle_scheduler(enable_scheduler)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 141, in toggle_scheduler
frappe.db.set_single_value(“System Settings”, “enable_scheduler”, int(enable))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 835, in set_single_value
return self.set_value(doctype, doctype, fieldname, value, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 985, in set_value
modified = modified or now()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/data.py”, line 371, in now
return now_datetime().strftime(DATETIME_FORMAT)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/data.py”, line 304, in now_datetime
dt = convert_utc_to_system_timezone(datetime.datetime.utcnow())
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/data.py”, line 351, in convert_utc_to_system_timezone
time_zone = get_system_timezone()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/data.py”, line 325, in get_system_timezone
return frappe.cache().get_value(“time_zone”, _get_system_timezone)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 81, in get_value
val = generator()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/data.py”, line 318, in _get_system_timezone
return frappe.db.get_system_setting(“time_zone”) or “Asia/Kolkata” # Default to India ?!
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 1301, in get_system_setting
return frappe.get_system_settings(key)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 2289, in get_system_settings
local.system_settings = get_cached_doc(“System Settings”)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 1109, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 1200, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 78, in get_doc
return controller(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 110, in init
self.load_from_db()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 138, in load_from_db
single_doc = frappe.db.get_singles_dict(self.doctype, for_update=self.flags.for_update)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 782, in get_singles_dict
queried_result = frappe.qb.get_query(
File “/home/erpnext/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 272, in sql
traceback.print_stack()
Error in query:
(‘SELECT field,value FROM tabSingles WHERE doctype=%(param1)s’, {‘param1’: ‘System Settings’})
Table ‘_b0f75b9d893607f1.tabSingles’ doesn’t exist

i have the same issue did you find a solution ??

Did you try restoring in mariadb instead of bench restore?

The main problem isn’t with the restore, but with the backup that was taken for the restore.
Fix the problem with the database that was backed up (repair the tables), then attempt to restore it.

you are right .The problem was in the Error Log Doctype …

the engine was wrong . it has been fixed .