SQL cleanup | Default database scheme | tracedata removal

Anyone know if there is a SQL scheme for default tables?

i have a problem that half my database is having tables that are no longer in use, this tables was before related to addons and core. what can be removed and what is needed for the NC 12 and 13 RC1.

i need a list of the tables currently used by the core. it seems that upgrading nextcloud multiple times leaves large amount of tables that are no longer in use, this should be removed.

i also notice NC is not cleaning database properly. i find old passwords in the pawword table that are not removed when deleting the user. there are also many entrys related to old external CIFS shares that has been removed ages ago.

what is best practice to clean up this mess?

1 Like


I saw that the occ command provides some cleanup options. I cannot fully recall what they were and I don’t have access to my NC13 test server to check. Also I’m not sure if these options were available in RC1 already or in RC2 first.
Maybe you can have a look and see if that helps to clean up your DB.


Yes the occ provieds some cleanup for the database but iam sorry to tell that this does not resolve my issue… occ does not remove databse entrys for unused applications, nor does it remove the unvalid CIFS route maps, or old passwords that corresponding users have been removed.

To me it looks like this is a real problem, i have used alot of time on this at it seems that the database has lot of data belonging to old versions of nextcloud and earlier owncloud. this is a very old database that has been upgraded many times.

what iam missing is the SQL layout for the CORE elements in nextcloud

@rullzer @MorrisJobke Is this something you can help with? If not, who would be the right person to address this to?

Cleanup of database tables from not used apps is not yet implemented fully (the methods are there, but we do not call them, because they could destroy data when an app is disabled accidentally). See https://github.com/nextcloud/server/issues/5539 for the corresponding ticket.

Regarding the old tables: usually we clean up behind us and provided repair steps to do so. Maybe the best would be to provide all the available tables and then we could have a look.

@nickvergessen Did a lot of work on the migration and DB cleanup.

1 Like

Its not possible to upload files here with other endings then common pictures, .txt should be allowed.

app_list: https://pastebin.com/6jvn8vQm
DB_structure: https://pastebin.com/2JccaaHW

table: oc_credentials has some passwords that no longer are valid becouse the user in oc_user has been removed, why dont this relation work?

table: oc_storage has references to some CIFS share that has been removed long time ago.

Is this issue still in the works?


-------- Opprinnelig melding --------