I had some struggle migrating database users with their data and shares to new accounts, using an LDAP backend. The problem was that I wasn't able to move the transfered files (using the occ transfer command) out of the created "transferred from..." folder as administrator in the new users root.
This way worked for me (without resetting ldap passwords):
uid1 -> uid of database user
uid2 -> uid of ldap user
make sure that there is no user data in user2's datadir before moving on!
disable user1 + user2
sudo -u www-data php occ user:disable uid1
sudo -u www-data php occ user:disable uid2
connect to the mysql database and change user mappings
mysql -u root -p
to check internal usernames and ldap_dn use:
select ldap_dn , owncloud_name from oc_ldap_user_mapping;
update the ldap user mapping table and delete the old mapping
update oc_ldap_user_mapping set owncloud_name="uid1" , directory_uuid="uid1" where ldap_dn="ldap_dn(user2)";
delete from oc_users where uid="uid1";
enable user1 which is now mapped to the ldap account and delete the obsolete datadir of user2
sudo -u www-data php occ user:enable uid1
rm -rf /owncloud_data/uid2
I don't know if there is something wrong with this approach, but it seems to work. I tested this succsessfull on a non productive environment.