Nextcloud version: 17,0,1,1
Operating system and version: Ubuntu 18.04.4 LTS
Apache or nginx version: Apache 2.4.29
PHP version: PHP 7.2.24
The issue you are facing: Errors occurred whet trying to convert NextCloud database format from SQlite to MySQL.
Is this the first time you’ve seen this error? (Y/N): Yes
Steps to replicate it:
- I don’t think it’s possible to replicate it in some other place except my server.
- See item 1.
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
$CONFIG = array (
'instanceid' => 'XXX',
'passwordsalt' => 'XXX',
'secret' => 'XXX',
'trusted_domains' =>
array (
0 => 'site.tld',
),
'datadirectory' => '/var/www/cloud/nextcloud/data',
'dbtype' => 'sqlite3',
'version' => '17.0.1.1',
'overwrite.cli.url' => 'https://XXX',
'installed' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Memcached',
'memcached_servers' =>
array (
0 =>
array (
0 => 'localhost',
1 => 11211,
),
),
'maintenance' => false,
'updater.secret' => 'XXX',
'theme' => '',
'loglevel' => 2,
'onlyoffice' =>
array (
'verify_peer_off' => true,
),
'mysql.utf8mb4' => true, // Inserted some later
);
The output of your Apache/nginx/system log in /var/log/____
:
<<NOT APPLICABLE>>
During the installation of NectCloud, I chose the SQlite database format because I did not plan to store many files in my cloud. But after a while the number of files became huge, and file operations became a little longer than expected. I thought I could easily convert the database format to a more suitable one for greater speed, but I was a bit wrong.
First I issued the following command with the primary config file (without 'mysql.utf8mb4' => true
in config):
./occ db:convert-type --clear-schema --all-apps -v -- mysql username localhost nextcloud
After some time I had the following error message:
Clearing schema in new database
Creating schema in new database
The following tables will not be converted:
oc_audioplayer_albums
oc_audioplayer_artists
oc_audioplayer_genre
oc_audioplayer_playlist_tracks
oc_audioplayer_playlists
oc_audioplayer_stats
oc_audioplayer_streams
oc_audioplayer_tracks
oc_passman_credentials
oc_passman_delete_vault_request
oc_passman_files
oc_passman_revisions
oc_passman_share_request
oc_passman_sharing_acl
oc_passman_vaults
Continue with the conversion (y/n)? [n] y
oc_accounts
2/2 [============================] 100% < 1 secoc_activity
chunked query, 706 chunks
235500/705701 [=========>------------------] 33% 2 hrs
In AbstractMySQLDriver.php line 106:
[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing 'INSERT INTO `oc_activity` (`activity_id`, `timestamp`, `priority`, `type`, `user`,
`affecteduser`, `app`, `subject`, `subjectparams`, `message`, `messageparams`, `file`, `link`, `object_type`, `object_id
`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["235592", "1565676679", "30", "file_created", "ZERG"
, "ZERG", "files", "created_self", "[{\"147776\":\"\\\/Images2\\\/HUN_Hajd\\uda46\\udfa1s_COA.jpg\"}]", "", "[]", "\/Imag
es2\/HUN_Hajd\uda46\udfa1s_COA.jpg", "https:\/\/site.tld\/index.php\/apps\/files\/?dir=\/Images2", "files", "1477
76"]:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF2\xA1\xAE\xA1s_...' for column 'file' at row 1
Exception trace:
() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:106
Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:169
Doctrine\DBAL\DBALException::wrapException() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:145
Doctrine\DBAL\DBALException::driverExceptionDuringQuery() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1063
Doctrine\DBAL\Connection->executeUpdate() at /var/www/cloud/nextcloud/lib/private/DB/Connection.php:216
OC\DB\Connection->executeUpdate() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:203
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/cloud/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php:214
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:366
OC\Core\Command\Db\ConvertType->copyTable() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:401
OC\Core\Command\Db\ConvertType->convertDB() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:223
OC\Core\Command\Db\ConvertType->execute() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/cloud/nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /var/www/cloud/nextcloud/console.php:97
require_once() at /var/www/cloud/nextcloud/occ:11
In PDOStatement.php line 119:
[Doctrine\DBAL\Driver\PDOException (HY000)]
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF2\xA1\xAE\xA1s_...' for column 'file' at row 1
Exception trace:
() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119
Doctrine\DBAL\Driver\PDOStatement->execute() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1054
Doctrine\DBAL\Connection->executeUpdate() at /var/www/cloud/nextcloud/lib/private/DB/Connection.php:216
OC\DB\Connection->executeUpdate() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:203
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/cloud/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php:214
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:366
OC\Core\Command\Db\ConvertType->copyTable() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:401
OC\Core\Command\Db\ConvertType->convertDB() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:223
OC\Core\Command\Db\ConvertType->execute() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/cloud/nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /var/www/cloud/nextcloud/console.php:97
require_once() at /var/www/cloud/nextcloud/occ:11
In PDOStatement.php line 117:
[PDOException (HY000)]
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF2\xA1\xAE\xA1s_...' for column 'file' at row 1
Exception trace:
() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
PDOStatement->execute() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
Doctrine\DBAL\Driver\PDOStatement->execute() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1054
Doctrine\DBAL\Connection->executeUpdate() at /var/www/cloud/nextcloud/lib/private/DB/Connection.php:216
OC\DB\Connection->executeUpdate() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:203
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/cloud/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php:214
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:366
OC\Core\Command\Db\ConvertType->copyTable() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:401
OC\Core\Command\Db\ConvertType->convertDB() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:223
OC\Core\Command\Db\ConvertType->execute() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/cloud/nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /var/www/cloud/nextcloud/console.php:97
require_once() at /var/www/cloud/nextcloud/occ:11
db:convert-type [--port PORT] [--password PASSWORD] [--clear-schema] [--all-apps] [--chunk-size CHUNK-SIZE] [--] <type> <username> <hostname> <database>
After cirtain investigations in the Internet I have found recommendation to change database charset from utf8
to utf8mb4
and add 'mysql.utf8mb4' => true
to config file. That seemed to solve the problem described above but after long time the following error occurred:
Clearing schema in new database
Creating schema in new database
The following tables will not be converted:
oc_audioplayer_albums
oc_audioplayer_artists
oc_audioplayer_genre
oc_audioplayer_playlist_tracks
oc_audioplayer_playlists
oc_audioplayer_stats
oc_audioplayer_streams
oc_audioplayer_tracks
oc_passman_credentials
oc_passman_delete_vault_request
oc_passman_files
oc_passman_revisions
oc_passman_share_request
oc_passman_sharing_acl
oc_passman_vaults
Continue with the conversion (y/n)? [n] y
oc_accounts
2/2 [============================] 100% 1 secoc_activity
chunked query, 706 chunks
705701/705701 [============================] 100% 6 hrsoc_activity_mq
1/1 [============================] 100% 1 secoc_addressbookchanges
5/5 [============================] 100% < 1 secoc_addressbooks
2/2 [============================] 100% < 1 secoc_appconfig
294/294 [============================] 100% 9 secsoc_authtoken
55/55 [============================] 100% 4 secsoc_bookmarks
182/182 [============================] 100% 6 secsoc_bookmarks_folders
11/11 [============================] 100% 1 secoc_bookmarks_folders_bookmarks
182/182 [============================] 100% 5 secsoc_bookmarks_tags
543/543 [============================] 100% 18 secsoc_bruteforce_attempts
9/9 [============================] 100% < 1 secoc_calendar_invitations
0 [>---------------------------] < 1 secoc_calendar_reminders
3/3 [============================] 100% < 1 secoc_calendar_resources
<<SKIPPED>>
0 [>---------------------------] < 1 secoc_polls_polls
0 [>---------------------------] < 1 secoc_polls_share
0 [>---------------------------] < 1 secoc_polls_votes
0 [>---------------------------] < 1 secoc_preferences
50/50 [============================] 100% 2 secsoc_privacy_admins
0 [>---------------------------] < 1 secoc_properties
chunked query, 843 chunks
771000/842369 [=========================>--] 91% 6 hrs
In AbstractMySQLDriver.php line 106:
[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing 'INSERT INTO `oc_properties` (`id`, `userid`, `propertypath`, `propertyname`, `propertyvalue`) VALUES(?, ?, ?, ?, ?)' with params ["771108", "USER", "\/!TEMP\/udemy - Master Python Programming The Complete 2019 Python Bootcamp (2019)\/20. Working with SQL Databases in Python\/1.2 Dr. Richard Hipp - creator of SQLite - provides a great view into the history of SQLite and situations where it really shines..html", "{urn:schemas-microsoft-com:}Win32CreationTime", "Wed, 18 Dec 2019 23:00:20 GMT"]:
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'propertypath' at row 1
Exception trace:
() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:106
Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:169
Doctrine\DBAL\DBALException::wrapException() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:145
Doctrine\DBAL\DBALException::driverExceptionDuringQuery() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1063
Doctrine\DBAL\Connection->executeUpdate() at /var/www/cloud/nextcloud/lib/private/DB/Connection.php:216
OC\DB\Connection->executeUpdate() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:203
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/cloud/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php:214
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:366
OC\Core\Command\Db\ConvertType->copyTable() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:401
OC\Core\Command\Db\ConvertType->convertDB() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:223
OC\Core\Command\Db\ConvertType->execute() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/cloud/nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /var/www/cloud/nextcloud/console.php:97
require_once() at /var/www/cloud/nextcloud/occ:11
In PDOStatement.php line 119:
[Doctrine\DBAL\Driver\PDOException (22001)]
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'propertypath' at row 1
Exception trace:
() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119
Doctrine\DBAL\Driver\PDOStatement->execute() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1054
Doctrine\DBAL\Connection->executeUpdate() at /var/www/cloud/nextcloud/lib/private/DB/Connection.php:216
OC\DB\Connection->executeUpdate() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:203
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/cloud/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php:214
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:366
OC\Core\Command\Db\ConvertType->copyTable() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:401
OC\Core\Command\Db\ConvertType->convertDB() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:223
OC\Core\Command\Db\ConvertType->execute() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/cloud/nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /var/www/cloud/nextcloud/console.php:97
require_once() at /var/www/cloud/nextcloud/occ:11
In PDOStatement.php line 117:
[PDOException (22001)]
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'propertypath' at row 1
Exception trace:
() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
PDOStatement->execute() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
Doctrine\DBAL\Driver\PDOStatement->execute() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1054
Doctrine\DBAL\Connection->executeUpdate() at /var/www/cloud/nextcloud/lib/private/DB/Connection.php:216
OC\DB\Connection->executeUpdate() at /var/www/cloud/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:203
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/cloud/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php:214
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:366
OC\Core\Command\Db\ConvertType->copyTable() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:401
OC\Core\Command\Db\ConvertType->convertDB() at /var/www/cloud/nextcloud/core/Command/Db/ConvertType.php:223
OC\Core\Command\Db\ConvertType->execute() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:908
Symfony\Component\Console\Application->doRunCommand() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:269
Symfony\Component\Console\Application->doRun() at /var/www/cloud/nextcloud/3rdparty/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/cloud/nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /var/www/cloud/nextcloud/console.php:97
require_once() at /var/www/cloud/nextcloud/occ:11
db:convert-type [--port PORT] [--password PASSWORD] [--clear-schema] [--all-apps] [--chunk-size CHUNK-SIZE] [--] <type> <username> <hostname> <database>
I suspect that field ‘propertypath’ in table ‘oc_properties’ is not wide enough to store the value though the SQlite’s table stored it without a problem…
I still have strong intention to convert my cloud database format but now I do not know what to do next to complete convertion successfully and I would be happy to have any assistence that helps me to move cloud data to MySQL database.
Thanks in advance!
Best wishes, Theodore