use a pg_basebackup in a database pg 12 code example Example: how to backup postgresql database using pg_dump pg_dump dbname > outfile