You are not logged in.

#1 2024-08-28 10:30:03

miro279
Member
Registered: 2010-10-02
Posts: 155

[SOLVED] need help with mariadb

Hi, maybe there is someone around who can help me out.

I'm running a nextcloud instance and dis setup a new server, I all the data of the old system but forgot to export my contacs (and calendar) before cutting the connection with the old server. So I still have all the files from the database but the instance is not running any longer.

I searched the net and found that I could import the raw .idb files to my new database. So I entered the mariadb database and to run

ALTER TABLE oc_cards DISCARD TABLESPACE;

therafter I copied the old oc_cards.idb file in the new mysql folder and run:

ALTER TABLE example_table IMPORT TABLESPACE;

but this failed with

ERROR 1815 (HY000): Internal error: Drop all secondary indexes before importing table nextcloud/oc_cards when .cfg file is missing.

so I corrupted my new database as the table oc_cards is no longer present there.


Is there anything I can do to recover? Best case would be to import the "old" oc_cards.idb in the new database, otherwise to repair the database to make oc_cards usable again.

Thanks for your help!

Last edited by miro279 (2024-08-30 18:23:58)

Offline

#2 2024-08-29 08:54:31

miro279
Member
Registered: 2010-10-02
Posts: 155

Re: [SOLVED] need help with mariadb

Ok, I was able to solve my problems, if anyone is interessted how...

within the database I made a copy of the table in question:

CREATE TABLE oc_cards_new LIKE oc_cards;

this creates both, oc_cards_new.idb and oc_cards_new.frm with a new tablespace.
I then dumped the original table:

DROP TABLE oc_cards;

and renamed the new table like the old one:

RENAME TABLE oc_cards_new TO oc_cards

Of course this did not recover data, but at least tha database was not currupted any longer.

After this I used a different linux machine, intalled mariadb and copyed the whole contend of my backup to /var/lib/mysql/nextcloud/ (changed ownership of the files to mysql:mysql) and started mariadb so I had the old database running again.
I then installed nextcloud on this machine and copied over config.php from my backup files. After this, I was able to run calcardbackup to extract contact and calender files from the database which I imported therafter via the webinterface. Instructions can be found here: https://codeberg.org/BernieO/calcardbac … d-instance

So this was recoverable, but it took some effort and I can only recommand to export all needed data before migrating the server ;-)

Offline

Board footer

Powered by FluxBB