Database error after migration

Good Morning,

My mistake appears when migrate nextcloud instance from server to another

Steps to reproduce

  1. Install new Nextcloud
  2. Copy /var/lib/mysql/nextclouddbname

Expected behaviour

At the login page, after entering admin password, it should print me the nextcloud instance of the account.

Actual behaviour

I have this error message :
"An exception occurred while executing ‘SELECT uid, displayname FROM oc_users WHERE LOWER(uid) = LOWER(?)’ with params [“Admin”]:

SQLSTATE[42S02]: Base table or view not found: 1932 Table ‘nextcloud.oc_users’ doesn’t exist in engine"

Server configuration

Operating system:
Raspbian Stretch lite

Web server: NGINX

Database: MARIADB

PHP version: PHP7.0

Nextcloud version: (see Nextcloud admin page) 12.0.3.3

Updated from an older Nextcloud/ownCloud or fresh install: fresh nextcloud package install but database migration.

Where did you install Nextcloud from: ZIP package

Are you using external storage, if yes which one: /home/$USER/data-folder

Are you using encryption: No

Client configuration

Browser: FireFox, Chrome, Safari

Operating system: Ubuntu 16.04 LTS / iOS 9

Logs

I have this error message :
"An exception occurred while executing ‘SELECT uid, displayname FROM oc_users WHERE LOWER(uid) = LOWER(?)’ with params [“Admin”]:

SQLSTATE[42S02]: Base table or view not found: 1932 Table ‘nextcloud.oc_users’ doesn’t exist in engine"

Thanks for reading and helping,
StrangeMonkey

Have you looked at any documentation for this?

https://docs.nextcloud.com/server/12/admin_manual/maintenance/index.html

Thanks a lot for the documentation.
I’ve lost my boot section and i’ve just backup /etc /var and /home
How can i backup my database without system ?

I’ve copy the /var/lib/mysql/nextcloud backup directory in the fresh distribution. Can i backup data since since that ?

you will have to solve the db-issues first - copying the database-files is NOT database-backup (but of course it’s better than nothing).
on a non-productive system install mariadb and copy the database-files there; you have to get the db to run somehow with those files. then dump it with mysqldump and import it on the (to-be) productive system; there you might still have to adjust some things.
this might help.
GOOD LUCK!

I’ve try to do this but i can’t backup.
I’ve this error :
mysqldump: Couldn’t execute 'show create table oc_accounts': Table ‘nextcloud.oc_accounts’ doesn’t exist in engine (1932)

I’ve create a nextcloud user, a passwrd, the good privileges. I’ve looking for the table and the tables exist. I’ve chown the /var/lib/nextcloud to mysql:mysql…

I really don’t understand why it can’t find the tble !

If i connect to the database with my user, use table nextcloud and select * from oc_accounts, i’ve an error…; It don’t find it on the engine.

OK, i did sth. like this a very long time ago but it might still work.

first, make sure that the copies of the database files you still have are secure.
then, on the non-productive system, install mariadb in the same version you had on the failed system, configure it w/out any dbs and run it once, then stop it.

the next two steps i am not sure about the sequence - you might have to try both:
-stop the db; copy the database-files to /var/lib/mysql/nextcloud/; start the db
-log into your db as db-root and create database nextcloud

after the previous steps are completed, check with sql if the db contains stuff (if it does - good; if it doesn’t, execute these above two steps in the opposite order).

check if your nextcloud user exists in the db with correct perms; if not create it.

then dump the db with mysqldump.
on the new system you can then import and manipulate it.
GOOD LUCK!

2 Likes