Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | Prochaine révision Les deux révisions suivantes | ||
linux:postgresql [24-09-2018 16:27] edmc73 [Base] |
linux:postgresql [25-09-2018 15:00] edmc73 [Backup] |
||
---|---|---|---|
Ligne 149: | Ligne 149: | ||
| | ||
===== Backup ===== | ===== Backup ===== | ||
+ | |||
+ | |||
+ | # dump to single SQL file | ||
+ | $ pg_dump -d mydb -n public -f mydb.sql | ||
+ | |||
+ | # dump to a custom format file | ||
+ | $ pg_dump -d mydb -n public -Fc -f mydb.pgdmp | ||
+ | |||
+ | |||
+ | # restoring from a SQL dump file, the simple version | ||
+ | $ psql -d mydb_new < mydb.sql | ||
+ | |||
+ | # restoring from a SQL dump file, the recommended version | ||
+ | $ PGOPTIONS=' | ||
+ | |||
+ | # restoring from a dump written to a custom format file | ||
+ | $ pg_restore -d mydb_new -v -1 mydb.pgdmp | ||
+ | |||
+ | # restore a single table from the dump | ||
+ | $ pg_restore -d mydb_new --table=mytable -v -1 mydb.pgdmp | ||
+ | |||
+ | # restore a single function from the dump | ||
+ | $ pg_restore -d mydb_new --function=myfunc -v -1 mydb.pgdmp | ||
+ | |||
+ | |||
+ | --- https:// | ||
Backup: (-Fc est un format compressé qui prend donc moins de place) | Backup: (-Fc est un format compressé qui prend donc moins de place) |