DBAtlas · 데이터베이스 운영 아틀라스

백업에서 복원

Oracle

impdp system/password DIRECTORY=dpump_dir \
  SCHEMAS=hr DUMPFILE=hr_%U.dmp LOGFILE=hr_imp.log

다른 스키마로 로드하려면 REMAP_SCHEMA를, 다른 테이블스페이스로 로드하려면 REMAP_TABLESPACE를 사용한다.

PostgreSQL

# custom format:
pg_restore -U postgres -d target_db --clean --if-exists db.dump
# plain SQL: psql -U postgres -d target_db -f db.sql

--clean은 기존 객체를 삭제한다. 병렬 복원은 -j <n>을 사용한다.

MySQL

mysql -u root -p target_db < db.sql

대상 데이터베이스가 미리 존재해야 한다(CREATE DATABASE). 대용량 파일은 source 명령이 권장된다.

SQL Server

RESTORE DATABASE [MyDB]
FROM DISK = N'C:\backup\MyDB_full.bak'
WITH REPLACE, RECOVERY;

특정 시점 복구는 전체 백업을 WITH NORECOVERY로 복원한 뒤 STOPAT으로 로그 백업을 적용한다.

MongoDB

mongorestore --uri="mongodb://localhost:27017" \
  --archive=db.archive.gz --gzip --drop

--drop은 복원 전에 대상 컬렉션을 삭제한다. 선택적 복원은 --nsInclude를 사용한다.

Redis

# 1) Stop Redis   2) Copy dump.rdb to the 'dir' location
# 3) Start Redis (the RDB is loaded automatically at startup)
redis-cli CONFIG GET dir   # find the target directory

AOF가 활성화되어 있으면 RDB 대신 AOF가 로드된다. RDB에서 복원하려면 appendonly no로 시작하거나 AOF를 재생성한다.

DBAtlas에서 열기 →