Restring the working site onto local server

I have a working site. I want to do some customizations and i take backup of site by bench backup which gives a sql file. When i’m restoring it on local server than it it showing this error _mysql_exceptions.ProgrammingError: (1146, "Table '1bd3e0294da19198.tabCustom DocPerm' doesn't exist")
i’m trying around 1 week.

Below are the steps i followed

  1. Install fresh frappe
  2. Create new site
  3. Restore the backup file
    this not worked so i followed a another step
  4. Install fresh frappe
  5. Install erpnext
  6. Install customized app on local server which is on remove server
  7. restore the file
    but results is same.
  8. Create new site
  9. Restore the backup file

Here is the traceback
php@php-H81M-S:/opt/erp/frappe-bench$ bench --site site1.local --force restore /home/php/Davinder/Projects/2017/erpnext/Site_Bacup/20170325_002817_2cfb8c16_database.sql MySQL root password: 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 "/opt/erp/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module> main() File "/opt/erp/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main click.Group(commands=commands)(prog_name='bench') File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/opt/erp/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 "/opt/erp/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func ret = f(frappe._dict(ctx.obj), *args, **kwargs) File "/opt/erp/frappe-bench/apps/frappe/frappe/commands/site.py", line 104, in restore force=context.force) File "/opt/erp/frappe-bench/apps/frappe/frappe/commands/site.py", line 63, in _new_site frappe.utils.scheduler.toggle_scheduler(enable_scheduler) File "/opt/erp/frappe-bench/apps/frappe/frappe/utils/scheduler.py", line 210, in toggle_scheduler ss = frappe.get_doc("System Settings") File "/opt/erp/frappe-bench/apps/frappe/frappe/__init__.py", line 606, in get_doc return frappe.model.document.get_doc(arg1, arg2) File "/opt/erp/frappe-bench/apps/frappe/frappe/model/document.py", line 51, in get_doc return controller(arg1, arg2) File "/opt/erp/frappe-bench/apps/frappe/frappe/model/document.py", line 84, in __init__ self.load_from_db() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/document.py", line 101, in load_from_db if not getattr(self, "_metaclass", False) and self.meta.issingle: File "/opt/erp/frappe-bench/apps/frappe/frappe/model/base_document.py", line 61, in meta self._meta = frappe.get_meta(self.doctype) File "/opt/erp/frappe-bench/apps/frappe/frappe/__init__.py", line 623, in get_meta return frappe.model.meta.get_meta(doctype, cached=cached) File "/opt/erp/frappe-bench/apps/frappe/frappe/model/meta.py", line 30, in get_meta return frappe.cache().hget("meta", doctype, lambda: Meta(doctype)) File "/opt/erp/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 171, in hget value = generator() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/meta.py", line 30, in <lambda> return frappe.cache().hget("meta", doctype, lambda: Meta(doctype)) File "/opt/erp/frappe-bench/apps/frappe/frappe/model/meta.py", line 66, in __init__ self.process() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/meta.py", line 226, in process self.set_custom_permissions() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/meta.py", line 313, in set_custom_permissions filters=dict(parent=self.name), update=dict(doctype='Custom DocPerm')) File "/opt/erp/frappe-bench/apps/frappe/frappe/__init__.py", line 1139, in get_all return get_list(doctype, *args, **kwargs) File "/opt/erp/frappe-bench/apps/frappe/frappe/__init__.py", line 1112, in get_list return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs) File "/opt/erp/frappe-bench/apps/frappe/frappe/model/db_query.py", line 83, in execute result = self.build_and_run() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/db_query.py", line 95, in build_and_run args = self.prepare_args() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/db_query.py", line 112, in prepare_args self.set_optional_columns() File "/opt/erp/frappe-bench/apps/frappe/frappe/model/db_query.py", line 212, in set_optional_columns columns = frappe.db.get_table_columns(self.doctype) File "/opt/erp/frappe-bench/apps/frappe/frappe/database.py", line 808, in get_table_columns return self.get_db_table_columns('tab' + doctype) File "/opt/erp/frappe-bench/apps/frappe/frappe/database.py", line 804, in get_db_table_columns return [r[0] for r in self.sql("DESC%s" % table)] File "/opt/erp/frappe-bench/apps/frappe/frappe/database.py", line 149, in sql self._cursor.execute(query) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "/opt/erp/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.ProgrammingError: (1146, "Table '1bd3e0294da19198.tabCustom DocPerm' doesn't exist")

Is the version of ERPNext account from which database backup is taken same as version of new ERPNext instance?

The DocType Custom DocPerms is added in version 8. If you have downloaded backup from the version 7 account, then you should also ensure that version of new site is same. Else, upgrade you old ERPNext instance to version, ensure that new site is on the same version, and then try restoring.

1 Like

Ok. Let me check this and also if i updgrade erpnext to new on working site, are you sure it will not effect the site ?

I think you are right.
The version of working site’s erpnext is v7.0.58
Screen shot:- http://i.prntscr.com/e0d577f1ecfd44e7b12e1fa8057d02e2.png

and erpnext on local server is 8.0-beta
Screen shot:- http://i.prntscr.com/c09f73d29e1144debfe60906c70294f4.png

Now can you please suggest me a sensible solution without affecting the working site?

Can you please let me know how can i degrade or install account 7 on my local server. I followed official doc and erpnext and frappe’s version is 8.

No option to degrade, Rather you should upgrade you old site to the new version and try.

FYI, we will merge changes of develop branch into master branch by tomorrow. Once merged, you can setup new site, forked from master branch which will be on version 8 then.

1 Like

And no option to install account 7?
How can i update old site? with bench update?

can you please let me know is there any probability of occurring issue?

Add new site and fork it from ERPNext master branch which is running on version 7 now.

1 Like

Ok but what about frappe? it is also showing 8 version(developr)? how to install 7 version and production version?

for now frappe version showing like this
Frappe Framework: v8.0.0-beta (develop)

Can you please reply on last question?

To switch to master branch you can use the bench switch-to-master command, take the database backup before running bench switch-to-master.

Thanks,
Makarand

1 Like

Thanks both. Finally i have restore remote site on local server after tying hard 7days.

umair, can you please give me a step-by-step process to do this? I am completely new to Github ,Frappe, bench and all that there is about it. I am having the same problem. I have installed ERPNext on a Centos 7 but i need to restore from an existing one running on Ubuntu. Followed the restore process and getting the same error.
I will be very grateful if i could get a step-by-step procedure.

Thank you in advance.