-
-
Notifications
You must be signed in to change notification settings - Fork 174
Recovering from DB Backup
Marcel Klehr edited this page Feb 3, 2021
·
1 revision
The plan is as follows:
- drop all bookmarks related database tables
- recover all bookmarks related database tables from your backup
Make a backup of your current nextcloud database.
In your mysql shell run the following to remove all bookmarks related data from the database.
drop table oc_bookmarks; drop table oc_bookmarks_tags; drop table oc_bookmarks_folders; drop table oc_bookmarks_folders_public; drop table oc_bookmarks_root_folders; drop table oc_bookmarks_shared_to_shares; drop table oc_bookmarks_shares; drop table oc_bookmarks_shared_folders; drop table oc_bookmarks_tree;
Assuming you have your nextcloud db backup in nextcloud-db-backup.sql
, we are extracting the bookmarks related tables from that file into a new file:
sed -n -e '/CREATE TABLE.*`oc_bookmarks.*`/,/Table structure for table/p' nextcloud-db-backup.sql > old_bookmarks_tables.sql
Then we're copying the comment headers from the backup file over to the start of olc_bookmarks_tables.sql
to make it work.
Now, we're importing those tables into the database:
mysql nextcloud_db_name < old_bookmarks_tables.sql
(nextcloud_db_name
is the name of your database.)
Update: If you run into errors at this point, this may solve your problems: https://stackoverflow.com/questions/29112716/mysql-error-1231-42000variable-character-set-client-cant-be-set-to-the-val#29115459