Backup - RMAN
- RAC를 운영하기 위해 ASM을 사용함 => ASM의 백업은 RMAN을 사용
- open 상태에서는 archive mode 상태에서 백업 받아야함
- 전체 블록 대신 사용하는 블록만 백업을 받을 수 있음 (용량 절약)
- 증분 백업 ; 변경된 부분만 백업받기 가능
- 분할 백업 ; 용량을 분할하여 백업받기 가능
- 복구 카달로그 ; 백업할 내용이 어디에 있는지를 저장
- 채널 ; 백업을 받는 장소
- 접속하는 방법
$ su - ; root 접속
# which rman ; rman이 있는 위치
# cp /home/oracle/product/10g/bin/rman /usr/x11R6/bin/rman ; 실행 가능 파일을 rman 위치로 복사
# exit
$ rman target /
> congifure default device type to disk;
- 파일 크기가 2GB를 넘어가면 성능이 떨어짐 (특히 UNIX 환경) ; 백업 피스로 분할해서 백업하면 됨
- 차등 증분 백업 ; 이전의 백업받은 내용이 현재의 백업 레벨보다 낮거나 같을 경우 앞으로 가지 않고 그 시점에서 백업
- 누적 증분 백업 ; 현재의 레벨보다 작을 경우에만 그 시점에서 백업, 그렇지 않을 경우 이전 백업 레벨로 감
- 백업 문제 실수 ; 채널을 3개 할당했으나 백업 과정에서 지정하지 않아서 오류 발생
run {
allocate channel c1 device type disk maxpiecesize = 10M;
allocate channel c2 device type disk maxpiecesize = 10M;
allocate channel c3 device type disk maxpiecesize = 10M;
backup taplespace sysaux
format '/data/backup/rman/%d_%p_%t'; => 채널 지정이 안됨
backup taplespace example
format '/data/backup/close/%d_%p_%t'; => 채널 지정이 안됨
backup taplespace system
format '/data/backup/open/%d_%p_%t'; => 채널 지정이 안됨
}
- 문제 정답
run {
allocate channel c1 device type disk maxpiecesize = 10M;
allocate channel c2 device type disk maxpiecesize = 10M;
allocate channel c3 device type disk maxpiecesize = 10M;
backup
tablespace sysaux channel c1
format '/data/backup/rman/%d_%p_%t'
taplespace example channel c2
format '/data/backup/close/%d_%p_%t'
taplespace system channel c3
format '/data/backup/open/%d_%p_%t';
}
- 백업 복구 문제 1
run {
allocate channel c1 device type disk
maxpiecesize=500M;
backup database channel c1
format '/data/backup/rman/%d_%p_%t';
}
- 백업 복구 문제 2
$ rman target /
> startup mount
> report schema;
using target database control file instead of recovery catalog
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 490 SYSTEM *** /data/temp1/system01.dbf
3 250 SYSAUX *** /data/temp1/sysaux01.dbf
4 11 USERS *** /data/temp1/users01.dbf
5 100 EXAMPLE *** /data/temp1/example01.dbf
6 20 INSA *** /data/temp1/insa01.dbf
7 10 UNDO *** /data/temp1/undo01.dbf
> run {
restore datafile 4; => 전체를 복원할 경우 restore database
recover datafile 4; => 전체를 복구할 경우 recover database
alter database open; => mount만 시켰으므로 open시킴
}
- 백업 복구 문제 3
> run {
sql 'alter tablespace user offline immediate'; => 복구할 tblspace를 먼저 off시킴
set newname for datafile 4 to '/data/temp/user01.dbf';
restore datafile 4;
switch datafile 4;
recover datafile 4;
sql 'alter tablespace users online'; => 복구한 tblspace를 on함
}
- redo log 문제
alert_testdb.log에서 장애 직전의 시퀀스 번호 확인
$ cd /home/oracle/admin/testdb/bdump
> run {
set until sequence 시퀀스번호 thread 1;
alter database mount;
restore databae;
recover database;
alter database open resetlogs;
}
-
run {
sql 'alter session set nls_dataformat="YYYY-MM-DD:HH24:MI:SS"'; => 한국내의 날짜 시간 세팅과 다르므로 맞춰야 함
set until time='2010-03-19:12:47:23';
restore database;
recover database;
alter database open resetlogs;
}
'Oracle > Backup & Recovery' 카테고리의 다른 글
Data Recovery (0) | 2010.04.20 |
---|---|
RMAN (0) | 2010.04.15 |
Recovery - Flashback (0) | 2010.03.18 |
Backup - Datapump (0) | 2010.03.16 |
Backup - DB Cloning (0) | 2010.03.16 |