LoginSignup
0
0

More than 1 year has passed since last update.

【psql】ダンプ方法

Last updated at Posted at 2021-11-15

テーブル定義を取得する
pg_dump -U postgres -d <テーブル名> -s > dev04.schema.dump

本番サーバーのデータのバックアップを取る
pg_dump -U postgres -d <テーブル名> -a > dev04.data.dump

バックアップしたい環境でコマンド入力
psql -U postgres -d <テーブル名(復元先)> -f C:\Users\kkura<ディレクトリー>\dev04.data.dump

テーブルとデータ両方同じ書き方でOK

圧縮
tar -zcvf dev04.tar.gz <ファイルのディレクトリー>
解凍
tar -zxvf dev04.tar.gz

圧縮するフォルダーを除外する方法
tar -zcvf html.tag.gz <ファイルのディレクトリー> --exclude <除外するフォルダー>
tar -zcvf html.tag.gz /var/www/html --exclude webroot

外部サーバーからファイルのダウンロード方法
ダンプのコマンド一覧

0
0
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
0
0