5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Dockerで構築したpostgreSQLデータベースのバックアップ・リストア

Last updated at Posted at 2022-02-22

手順

# PostgreSQLデータベースのコンテナ名を確認する
docker ps

# DBバックアップ
docker exec コンテナ名 pg_dumpall -c -U DBユーザ名 > dump.sql

# DBリストア
cat dump.sql | docker exec -i コンテナ名 psql -U DBユーザ名 -d データベース名

# DBアクセス
docker exec -it コンテナ名 psql -U DBユーザ名 -d データベース名

# DBテーブル一覧表示
\dt

# テーブルの中身表示
SELECT * FROM テーブル名

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?