hi,
Any full backup + differential PostgreSQL backup for PostgreSQL 9.3.6 and let it restore totally good to postgreSQL 11.4 and 13.4/13.5 ?
I just want to make the backup and restore to a much newer postgreSQL quickly.
3) If you use the standard pg_dump or pg_dumpall, likely you can go from your current version all the way up to PostgreSQL 14.
Depending on the number of indexes and materialized views restoring from a pg_dump can take much longer than the dump itself.yes!
pg_dump is pretty much an all or nothing backup method. Not really meant to enable point-in-time recoveries.
You might look at archiving the WALs and using those to apply to a full backup:
pg_restore --jobs=4 ...
executes restore with 4 jobs (thread) in parallel to speed things up. pg_restore -U postgres -j 8 -Ft -C -d ABC < backup.sql
?In the following table, I'm using the 'real' value shown above. In addition, I'm also showing the time it took to restore the dump via pg_store -d testing.
pg_restore -d testing backupfile
This means that pg_restore connects to the testing database and restores the backupfile into that database (as clearly stated in the manual ;) ).
so I am expecting I can use the same parameter -Z1 -Fc ?
e.g. pg_dumpall -U postgres -p 5432 -Z1 -Fc > backup.sql ?
pg_restore -U postgres -j 8 -Ft -C -d ABC backup.sql.tarNote that -Ft tells the restore that the backup is a tar archive file.
but using pg_dumpall the output format is .sql extension, so I should just remove -Ft ?Yes, the -F param is only valid when you use pg_dump and pg_restore. Again, see the manual for more info.
Yes, the -F param is only valid when you use pg_dump and pg_restore. Again, see the manual for more info.
Working with raw files, there is no index production step.
Now add in many complex, mult-column indexes, so during a restore you're restoring data (fast), then rebuilding all indexes (can be massively slow).
pg_restore -U postgres -j 8 -C -d <target database> backup.sqlby this, it seems it only restore the content of ONE DB only, not everything from the source DB?
1) pg_restore -U postgres -j 8 -C -d <target database> backup.sql > error.txt
psql.exe -U postgres -p 5435 -f <full path to the pg_dumpall output files> > error.txt
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:20: ERROR: role "postgres" alread
y exists
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950869665: ERROR: could not creat
e unique index "alf_lock_pkey"
DETAIL: Key (id)=(8) is duplicated.
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950869721: ERROR: could not creat
e unique index "alf_node_pkey"
DETAIL: Key (id)=(845) is duplicated.
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950869729: ERROR: could not creat
e unique index "alf_node_properties_pkey"
DETAIL: Key (node_id, qname_id, list_index, locale_id)=(51394005, 240, -1, 1) i
s duplicated.
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950871476: ERROR: could not creat
e unique index "idx_alf_lock_key"
DETAIL: Key (shared_resource_id, excl_resource_id)=(8, 8) is duplicated.
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950871700: ERROR: could not creat
e unique index "store_id"
DETAIL: Key (store_id, uuid)=(6, 2e2d0396-f940-433c-b48a-f66966d43665) is dupli
cated.
CONTEXT: parallel worker
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872050: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872058: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872146: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872162: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872170: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872218: ERROR: insert or updat
e on table "alf_node" violates foreign key constraint "fk_alf_node_txn"
DETAIL: Key (transaction_id)=(86296005) is not present in table "alf_transactio
n".
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872234: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872322: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872330: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872338: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:950872354: ERROR: there is no uni
que constraint matching given keys for referenced table "alf_node"
psql:E:/DB_Backup/BackupUsingPostgre11_14.sql:20: ERROR: role "postgres" alread
y exists
E:\Program Files\PostgreSQL\11\bin>pg_restore -U postgres -j 8 -C < E:\DB_Backu
p\BackupUsingPostgre11_14.sql > E:\DB_Backup\error_restoreTO11_pgstore.txt
error:E:\Program Files\PostgreSQL\11\bin>pg_restore -U postgres -j 8 -C E:\DB_Backup\
BackupUsingPostgre11_14.sql > E:\DB_Backup\error_restoreTO11_pgstore.txt
error:E:\Program Files\PostgreSQL\11\bin>pg_restore -U postgres -p 5433 -j 8 -C -f E:\DB_Backup\BackupUsingPostgre11_14.sql > E:\DB_Backup\error_restoreTO11_pgstore
.txt
but the process seem shows nothing is going on, no DB created, any idea?--lock-wait-timeout=timeout Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout.
Notes
Since pg_dumpall calls pg_dump internally, some diagnostic messages will refer to pg_dump.
pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers).
pg_restore -U postgres -j 8 -C E:\DB_Backup\
BackupUsingPostgre11_14.sql > E:\DB_Backup\error_restoreTO11_pgstore.txt
ONLY the error_restoreTO11_pgstore.txt
can be created but nothing has been restore, so the pg_restore just pend there forever.
Or rather, speed depends on size of data + number of indexes (along with index complexity) across all tables.
Backup/Restore speed is a function of your data + schemas.
2) You'll use one of the standard tools...
a) https://www.postgresql.org/docs/current/app-pgdump.html
b) https://www.postgresql.org/docs/current/app-pg-dumpall.html
3) If you use the standard pg_dump or pg_dumpall, likely you can go from your current version all the way up to PostgreSQL 14.