본문 바로가기

[Database]/PostgreSQL

pg_dump insert 구문

특정 insert 구문이 필요 할 경우.

pg_dump -U [계정명] -t [테이블명] -a -O --inserts -E UTF8 [데이터베이스명] > dump.sql

그러면 insert 구문으로 백업된다.


테이블이 여러개일 경우.

pg_dump -U [계정명] -t [테이블명1] -t [테이블명2] -t [테이블명3] -a -O --inserts -E UTF8 [데이터베이스명] > dump.sql


-t 옵션을 빼면 database  전체가 백업된다.


[option 참고]

-U, --username=NAME      connect as specified database user

-t, --table=TABLE            dump the named table(s) only

-a, --data-only              dump only the data, not the schema

-O, --no-owner               skip restoration of object ownership in
                               plain-text format

--inserts                    dump data as INSERT commands, rather than COPY

-E, --encoding=ENCODING      dump the data in encoding ENCODING



 



'[Database] > PostgreSQL' 카테고리의 다른 글

NULL 체크 및 문자열 합치기  (0) 2015.06.08
CSV 백업파일 생성  (0) 2015.04.06
psql 테이블 백업파일 insert  (0) 2015.03.20
pg_dump schema (MySQL : show create table tablename)  (0) 2014.11.12
Start / 기본 명령어  (0) 2014.10.22