Owncloud don`t decrypt user files after rsync and db dump restore

Steps to reproduce

  1. rsync owncloud directory to newpath. (data contains only one user)
    /var/www/owncloud# rsync -av * --exclude=’/date’ /var/www/test
    /var/www/owncloud# cp -rp data/m.shpatserman/ /var/www/test/

  2. make db backup (postgresql database with pgadmin)

  3. restore db backup to another db, change config in newpath (/var/www/test/) to restored db.

  4. decrypt user files with occ (sudo -u www-data php occ encryption:decrypt-all m.shpatserman)

Expected behaviour

/data/m.shpatserman/files/ shoud be decrypted for the user

Actual behaviour

Files stay encrypted. But if you do this in the owncloud installation directory files become decrypted.

Server configuration

Operating system:
Web server:
nginx version: nginx/1.6.2
postgresql 9.5
PHP version:
root@test-b2b-owncloud:/var/www/test# php5 -version
PHP 5.6.40-0+deb8u1 (cli) (built: Feb 17 2019 01:19:33)
ownCloud version: (see ownCloud admin page)
Updated from an older ownCloud or fresh install:
Where did you install ownCloud from:
Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php:

root@test-b2b-owncloud:/var/www/owncloud# sudo -u www-data php occ config:list system
    "system": {
        "updatechecker": false,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Memcached",
        "memcached_servers": [
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "http:\/\/owncloud-test.example.ru",
        "dbtype": "pgsql",
        "version": "",
        "dbname": "owncloud_test",
        "dbhost": "*****",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "instanceid": "ocmxsmf2kc9l",
        "ldapIgnoreNamingRules": false,
        "debug": true,
        "singleuser": false

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Are you using encryption: yes/no

Interesting fact - i`ll try consider this https://doc.owncloud.com/server/admin_manual/maintenance/manually-moving-data-folders.html

Ticket resolved, i should do:
UPDATE oc_storages SET id=‘local::/var/www/test’ WHERE id=‘local::/var/www/owncloud/data/’;
UPDATE oc_accounts SET home=’/var/www/owncloud/data/m.s’ WHERE id=3;