Nextcloud migration with postgres dump file

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.6
  • Operating system and version (e.g., Ubuntu 24.04):
    • TrueNas scale
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • TrueNas App(Docker)

can sombody help me to migrate my nextcloud.

  1. I have created a new nextcloud App in trunas scale. It is running.

  2. i copied all user data to the Dataset "UserData"
    
  3. created a directory Backups in the dataset "PostgresData" where i copied in my dump file.
    
  4. moved into the Postgres container with
    

docker exec -it ix-nextcloud-postgres-1 bash

  1. dropped existing database
    

    psql -U nextcloud -d template1 -c "CREATE DATABASE \"nextcloud\";"

  2. created now one
    

    psql -U nextcloud -d template1 -c "CREATE DATABASE \"nextcloud\";"

  3. restore from dump file
    

    pg_restore -U nextcloud -d nextcloud nextcloud2025.sql

  4. it was working a wile. then i looked it up
    

postgres@23234142195d:/$ psql -U nextcloud psql (17.3 (Debian 17.3-1.pgdg120+1)) nextcloud=# \c nextcloud You are now connected to database "nextcloud" as user "nextcloud". nextcloud=# \dt Did not find any relations.
  1. Seems that it have not worked. What do I need to do? And after it’s working, how do i add the user oc_admin as it is in the nc config.php to the database?

It’s not very clear what you are trying to achieve? clean installation? in this case I assume there must be some docs how to spin up the app on TrueNas - I would ask the author of the appliance. In case you look for server_migration there are detailed server migration docs available

thanks for answering.
i want do a server migration. i am using this documentation but i am stucking at restoring my db from the dump file.

I’m doing it slightly different

cat postgres.sql| docker compose exec -i pgdb bash -c 'psql -d "$POSTGRES_DB" -U "$POSTGRES_USER"'

but your version should work as well. you don’t need to create the DB in advance pg_restore / psql will do (you dump should include respective commands - at least in case you use pg_dumpall).

restore of the postgres DB is more or less not in scope of this forum - I would reach out to postgres support. this might help: