PostgresSQL
テーブルのみのバックアップとリストア
テーブルのみバックアップ
(オプション -t)
pg_dump.exe --host 192.168.xx.xxx --port 5432 --username "postgres" --no-password --format plain --verbose --file "X:\PathName\tbl_001.sql" --table "public.m_tblname" "pg_adtabase_name"
C:\Program Files (x86)\pgAdmin III\1.22\
pg_dump.exe --host 192.168.24.63 --port 5432 --username "postgres" --no-password --format plain --verbose --file "F:\PathName\TBL_001.SQL" --table "public.m_person" "test1"
CD C:\Program Files\pgAdmin 4\v3\runtime
pg_dump.exe --file "C:\\tpeno2.sql" --host "192.168.24.63" --port "5432" --username "postgres" --no-password --verbose --format=p --table "public.m_person" "test2"
pgAdmin4でテーブルのみバックアップを実行
1.
2.
3.
4.
5.
C:\Program Files\pgAdmin 4\v3\runtime\pg_dump.exe --file "D:\\tbl1.sql" --host "192.168.24.63" --port "5432" --username "postgres" --no-password --verbose --format=p --table "public.m_person" "test2"
リストア対象のデータベースに同名のテーブルがある場合は、psqlなどで、対象テーブルを先に削除
drop table tbl_name
テーブルのみリストア処理は、psqlで実行
CD C:\Program Files\pgAdmin 4\v3\runtime
SET PGPASSWORD=Passwd643
psql -h 192.168.24.63 -U postgres -f F:\PathName\TBL_001.backup test1
psql -h 192.168.24.63 -U postgres -f D:\tpeno2.sql test1