Backup data
- Archiving of output directory format
Backup in this way can avoid the restriction of the operating system to the size of a single file.
pg_dump.exe -U postgres -F d -f E:\mydbbak mydb
After the backup is completed, a backup folder will be generated.
- tarFormat archiving (no parallel recovery is supported when recovering with pg_resotre)
pg_dump.exe -U postgres -F t mydb > mydb.tar
- Generate SQL script
pg_dump.exe -U postgres -F p mydb > mydb.sql
- Generate custom format archive
pg_dump.exe -U postgres -F c mydb > mydb.bin
Apart from SQL scripts, all three of the above four formats can be restored via pg_store, where the tar format backup does not support parallel recovery
Recovery data
- Create target database before recovery
create database mydb;
- Recovery data
pg_restore.exe -U postgres -d mydb -j 4 E:\dataBak\mydbbak
- Recovery structure
pg_restore.exe -U postgres -d mydb –section=pre-data -j 4 E:\dataBak\mydbbak
-j Parallel execution threadTar format backup does not support parallel recovery.