Convert database on hosted owncloud

Hello everyone,

I would want to migrate an hosted Owncloud installation to my own server.
My hosted database is SQLite, and I can dump it by phpmyadmin.
My own server is mysql.
I see on
https://doc.owncloud.com/server/10.0/admin_manual/configuration/database/db_conversion.html?highlight=database
that there is a tool to convert database, but I can’t access to the command line of my host. Indeed, I installed Owncloud by ftp.
Is there a way to convert the hosted database without command line ?
Thanks in advance.

Pascal

1 Like

Hello,

I don’t think there is this feature in the web interface, at least not that I’m aware of.
Maybe you can create a PHP script that you could upload and execute, or run it trough a cron.
Or, you simply install it on your new server in sqlite and you convert it afterwards.
I’d chose the last option.
Cheers.

2 Likes

Hello,
I think it’s a good idea indeed. So today, I tried this solution.
By chance, I can access to my hosted database file by ftp. So, I downloaded it and copied it to the /var/www/owncloud/data of my ownserver.
My hosted owncloud is 10.0 version, and my own server owncloud is 10.4
When I went to my owncloud server page, it said that the installation needed to be upgraded (why ?).
So I ran theses commands:
sudo -u www-data php occ app:disable files_videoplayer
sudo -u www-data php occ app:disable tasks
sudo -u www-data php occ app:disable templateeditor
sudo -u www-data php occ upgrade
At this stage, my old database was well “imported”, all users can login, all calendars, contact, task etc works ok for all users.
So then I followed the database conversion manual, I tweaked mysqld.cnfas indicated
(NB: table_cache = 400 isn’t good, so instead write table_open_cache = 400),
ran the command… Look at the result:

root@ubuntu-server:/var/www/owncloud# sudo -u www-data php occ db:convert-type mysql owncloud 127.0.0.1 owncloud
ownCloud is in maintenance mode - no app have been loaded

This feature is currently experimental.
Enter a password to access a target database: 
Creating schema in new database

In app.php line 188:
                             
  [OC\NeedsUpdateException]  
                             

db:convert-type [--port PORT] [--password PASSWORD] [--clear-schema] [--all-apps] [--chunk-size CHUNK-SIZE] [--] <type> <username> <hostname> <database>

It terminated with error [OC\NeedsUpdateException]… !
If I look in the database, all tables were imported, but it’s impossible to login in owncloud page.

So what’s went wrong ? Have you an idea ?

Thanks in advance for your valuable help,

Pascal

Hello, after this failed conversion, it seems that all users have disappeared, including admin:

root@ubuntu-server:/var/www/owncloud# sudo -u www-data php /var/www/owncloud/occ user:resetpassword admin
User does not exist

Have you an idea ?
Thanks in advance

What did you do that users have disappeared?
Look after existing users:
awk -F: ‘{ print $1}’ /etc/passwd

Hey,

i think you first need to update your hosted ownCloud 10.0 to 10.4 to have the same version as on the ownserver. Then i think this won’t happen:

and maybe your issue also isn’t showing up.

Hi Tom,
I’ve just done upgrade on my hosted owncloud. No majors issues, all works ok.
Then, I downloaded (by ftp) data directory and copied it to the right place in my own server.
At this stage, all seems ok, I can login all my users, agendas, contacts, all are fine.
But converting the sqlite3 database to mysql doesn’t work yet, I’ve got the same issue.
Any clue ?