---
# System prepended metadata

title: '`psql`、`pg_dump`、`pg_restore`'
tags: [postgresql]

---

# `psql`、`pg_dump`、`pg_restore`

[TOC]

###### tags: `postgresql`

---

## 備份

```shell
$ pg_dump \
--file ~/pathTo.backup \
--host ipAddressOrHostname \
--port 5432 \
--username login \
--verbose \
--format=c \
--blobs \
databaseName
```

## 還原

```shell
$ pg_restore \
--host ipAddressOrHostname \
--port 5432 \
--username login \
--dbname databaseName \
--verbose \
~/pathTo.backup
```
