본문 바로가기
Backup Solution & IT Study/Data Base

[PostgreSQL]PostgreSQL 백업 & 복구

by DellEMC Backup Engineer 2021. 3. 12.

개요

- PostgreSQL DB 생성하고 백업하고 복구하는 테스트.

  DellEMC Avamar PostgreSQL 테스트 하려다 DB 공부까지 하게 된 상황 (2/2)

 

테스트 환경

- Cent OS 7.9 ( Cent OS 2009 )

- PostgreSQL 11.11

- Windows 2019 Std

- pgAdmin 4 v5.0

- 이전 진행 내용 bluelicht.tistory.com/55 참조

 

1. PostgreSQL DB 백업 ( PostgreSQL 은 dump (export) 기능만 지원 )

# testdb 를 testdb_20210312.dmp 로 Dump

[testuser@146pgsql ~]$ /usr/pgsql-11/bin/pg_dump testdb > testdb_20210312.dmp

[testuser@146pgsql ~]$ ls -al testdb_20210312.dmp

2. 기존 testdb 삭제

[testuser@146pgsql ~]$ /usr/pgsql-11/bin/psql -U testuser -d testdb

testdb=# DROP TABLE testtable;

 

3. testdb 복구

# testdb_20210312.dmp 를 testdb 로 복구

[testuser@146pgsql ~]$ /usr/pgsql-11/bin/psql -f testdb_20210312.dmp testdb

 4. 복구 확인

 

 

 

 

 

 

 

 

 

댓글