프로그래밍

PostgreSQL DB 백업 및 MS-SQL로의 이전

채윤아빠 2007. 12. 21. 23:58
728x90
반응형

pg_dump 명령으로 데이터베이스를 백업합니다.

pg_dump --help
pg_dump dumps a database as a text file.

Usage:
  pg_dump [options] dbname

Options:
  -a                       dump out only the data, no schema
  -b                       dump out blob data
  -c                       clean (drop) schema prior to create
  -C                       output commands to create database
  -d                       dump data as INSERT, rather than COPY, commands
  -D                       dump data as INSERT commands with attribute names
  -f FILENAME              specify output file name
  -F {c|t|p}               output file format (custom, tar, plain text)
  -h HOSTNAME              server host name
  -i                       proceed when database version != pg_dump version
  -n                       suppress most quotes around identifiers
  -N                       enable most quotes around identifiers
  -o                       dump object ids (oids)
  -O                       do not output \connect commands in plain text
                           format
  -p PORT                  server port number
  -R                       disable ALL reconnections to the database in
                           plain text format
  -s                       dump out only the schema, no data
  -S NAME                  specify the superuser user name to use in plain
                           text format
  -t TABLE                 dump for this table only (* for all)
  -u                       use password authentication
  -v                       verbose
  -x                       do not dump ACL's (grant/revoke)
  -Z {0-9}                 compression level for compressed formats

If no database name is not supplied, then the PGDATABASE environment
variable value is used.

Report bugs to <pgsql-bugs@postgresql.org>


MS-SQL로 이전할 경우에는...

pg_dump -f [파일명] -d -u [DB Name]

로 INSERT 문으로 덤프하여 쿼리 분석기 등에서 INSERT 를 실행하면 이전이 가능합니다.