解决 Nextcloud 升级 31 版本后数据库警告要求调整为 DYNAMIC 行格式

Nextcloud 升级到 31 版本之后,后台管理页面的保存信息总是有很大段的黄色警告。下面的报错说明数据库中大量表仍然使用旧的 COMPACT/REDUNDANT 行格式,Nextcloud 31 开始要求 InnoDB 表使用 DYNAMIC 格式。如果不修改,后台会一直显示警告。解决办法就是把这些表改成 ROW_FORMAT=DYNAMIC 并且将默认行格式设置为 DYNAMIC。

Incorrect row format found in your database. ROW_FORMAT=Dynamic offers the best database performances for Nextcloud. Please update row format on the following list: talk_bridges, deck_attachment, mail_coll_addresses, profile_config, share, collres_accesscache, deck_board_acl, schedulingobjects, external_options, analytics_dataset, officeonline_wopi, group_admin, direct_edit, maps_apikeys, sndnt_license, mail_accounts, oauth2_access_tokens, addressbooks, text_steps, activity, appointments_hash, mounts, filecache_extended, trusted_servers, forms_v2_questions, comments_read_markers, mimetypes, twofactor_providers, calendars, calendar_rooms_md, maps_favorites, maps_address_geo, news_items, circles_token, appointments_sync, news_folders, forms_v2_forms, cengine_steps, talk_rooms, sndnt_trmagr, deck_stacks, appointments_pref, maps_devices, cards_properties, deck_assigned_users, dav_shares, federated_reshares, sndnt_stngtmplt, circles_share_lock, cengine_users, systemtag_object_mapping, share_external, known_users, mail_message_tags, flow_operations_scope, directlink, storages_credentials, calendarsubscriptions, talk_attendees, calendar_invitations, mail_recipients, deck_cards, calendar_reminders, user_transfer_owner, file_locks, cards, authorized_groups, user_status, ratelimit_entries, circles_event, addressbookchanges, circles_circle, circles_mount, mail_aliases, deck_assigned_labels, collres_resources, analytics_facts, calendarobjects, mail_mailboxes, talk_commands, group_user, migrations, external_config, mail_provisionings, news_feeds, text_sessions, twofactor_backupcodes, mail_tags, calendar_appt_bookings, appconfig, talk_guestnames, vcategory, dav_cal_proxy, analytics_share, maps_device_points, deck_boards, circles_remote, mail_trusted_senders, filecache, notes_meta, calendar_appt_configs, deck_labels, maps_tracks, sndnt_stngky, calendar_resources, storages, text_documents, external_mounts, circles_mountpoint, sndnt_stnggrval, officeonline_locks, flow_operations, privacy_admins, circles_member, talk_internalsignaling, analytics_whats_new, calendarobjects_props, users, calendarchanges, vcategory_to_object, properties, systemtag, carnet_metadata, groups, comments, richdocuments_assets, whats_new, analytics_threshold, notifications_settings, mail_local_messages, maps_photos, activity_mq, richdocuments_wopi, preferences, richdocuments_direct, circles_membership, calendar_rooms, external_applicable, notifications_pushhash, flow_checks, files_trash, login_flow_v2, mail_messages, notifications, mail_attachments, pdfdraw_items, forms_v2_answers, talk_sessions, recent_contact, analytics_dataload, accounts_data, collres_collections, forms_v2_options, bruteforce_attempts, authtoken, forms_v2_submissions, jobs, oauth2_clients, systemtag_group, sndnt_connuser, analytics_report, maps_favorite_shares, calendar_resources_md, webauthn, accounts. For more details see the documentation ↗.

只需要执行下列内容,将数据表更新即可:

docker-compose exec -T db mariadb -u “$DBUSER” -p”$DBPASS” -N -e ”
SELECT CONCAT(‘ALTER TABLE ‘, TABLE_NAME, ‘ ROW_FORMAT=DYNAMIC;’)
FROM information_schema.tables
WHERE table_schema = ‘$DBNAME’ AND ROW_FORMAT != ‘Dynamic’;” \
| docker-compose exec -T db mariadb -u “$DBUSER” -p”$DBPASS” “$DBNAME”

此外需要注意:

  • 操作之前先备份数据库
  • 修改 InnoDB 行格式会重建表结构,操作时间与表大小成正比,建议在业务低峰期执行。

  • 旧版 MariaDB/MySQL(如 MariaDB 10.2 及以下)要先启用 innodb_file_format=barracudainnodb_large_prefix 等配置docs.nextcloud.com;否则部分表在修改行格式时可能报错“Table storage engine does not support the create option ‘ROW_FORMAT’”,可通过 ALTER TABLE <表> ROW_FORMAT=DYNAMIC, ALGORITHM=COPY; 强制重建docs.nextcloud.com

  • 修改完成后记得将 Nextcloud 从维护模式中退出(如果启用了):

通过以上步骤,可以批量将 Nextcloud 数据库中的表调整为 DYNAMIC 行格式,从而消除后台提示并符合 Nextcloud 31 以后的要求。

发表回复