📚 Using PG_Dump to backup specific objects¶
### 1. For example backup Table in DB(schema + data)
- 1.1 Doing the dump aalc tables for postgres DB
- 1.2 Before restoring, we check the table status
- 1.3 Do the restore table from our dump file
use -Fc use pgrestor to recovery,use psql Fp(Default) use psql to recover
- 1.4 Go to check table again. You will find the deleted tableback
### 2. For example backup a DB in cluster(schema + data)
Note: use “-C” include Create Dabase in the dump file
### 3. backup Schema in DB(schema + data)
Note: Use “--inserts” Will cause the backup files to increase in size, Advantage is quickly execute a single resotre command
### 4. backup schema in DB and Restore a part(schema + data)
- 4.1 Doing the dump MMS_PRD Schema for postgres DB
-
4.2 Selective backup and recovery of files
-
4.2.1 Generate files based on binary backup files
- 4.2.2 Modify the TOC file using '; ’Annotate the content that does not need to be restored(Example mark refrence table mms_introduce_main)
- 4.2.3 Restore with TOC file list
### 5. backup schema in DB and Restore to new Schema(schema + data)
- 5.1 Doing the dump MMS_PRD Schema for postgres DB
- 5.2 Use Sed command to replace(schema and function/trigger/producure content)
- 5.3 Create refrence objects(maybe you shou create tablespace and role)
- 5.4 restore



















