7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PostgreSQL の pg_restore でリストアしたくないテーブルを除外する

Last updated at Posted at 2018-05-22

pg_restore -lpg_restore -L を使う。

手順

1. リストアされる内容の一覧を出力

pg_restore -l dump_file_name > content_list

2. リストアされる内容の一覧の確認と修正

vim content_list

リストアされる予定のテーブル定義やレコードが確認できるので、除外したい部分をコメントアウトする

;いらんテーブル
;000 000; 000 0000 TABLE public unused_table ...

...

;いらんデータ
;0000; 0 00000 TABLE DATA public unused_records ...

3. リストアする

pg_restore -L content_list dump_file_name

便利!

参考ページ

7
3
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?