1. rman 백업
Disk 복구후 rman 백업시 기존 rman catalog를 unregister하고 새로 등록후 기존 백업 인식, 신규 백업수행
export DT=$(date "+%Y-%m-%d")
export BT=$(date -d '-1 day' "+%Y-%m-%d")
mkdir /data/${DT}
rman target / catalog rcatalog/"test"@rmanc log=${LOG} << EOF
unregister database noprompt;
register database;
catalog start with '/data/${BT}' noprompt;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1DAYS;
CONFIGURE DEVICE TYPE DISK PARALLELISM 10 ;
RUN {
allocate channel ch1 type disk maxpiecesize 500G;
allocate channel ch2 type disk maxpiecesize 500G;
allocate channel ch3 type disk maxpiecesize 500G;
allocate channel ch4 type disk maxpiecesize 500G;
allocate channel ch5 type disk maxpiecesize 500G;
allocate channel ch6 type disk maxpiecesize 500G;
allocate channel ch7 type disk maxpiecesize 500G;
allocate channel ch8 type disk maxpiecesize 500G;
allocate channel ch9 type disk maxpiecesize 500G;
allocate channel ch10 type disk maxpiecesize 500G;
sql 'alter system switch logfile';
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt expired archivelog all;
backup format '/data/${DT}/%d_%U_full_db_%T_%s' database include current controlfile;
backup format '/data/${DT}/%d_arc_%T_%s' archivelog all;
backup format '/data/${DT}/%d_control_%T_%s' current controlfile;
delete noprompt obsolete;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
release channel ch8;
release channel ch9;
release channel ch10;
}
exit;
EOF
-- archive 등록시
-- catalog archivelog '/data/arch/t_1_1_34234_1349234394.arc','/data/arch/t_1_1_34235_1349234394.arc'
2. rman 복구 수행
TDE로 구성된 테이블 스페이스에 특정 테이블 복구후 export
1) 특정 table 복구후 export
export TNS_ADMIN=/home/oracle/work/backup/net -- wallet 위치를 지정 (sqlnet.ora)
rman target / catalog rcatalog/"test"@rmanc log=${LOG} << EOF
set DECRYPTION identified by "test"; -- tde 패스워드
RECOVER TABLE test.'test'
UNTIL scn 13520957638006 -- 복구 시점은 control chk point 이후로 설정 ( list backupset로 확인 )
AUXILIARY DESTINATION '/data/restore' -- until time "to_date('2020/08/05 11:40', 'YYYY/MM/DD HH24:MI')"
DATAPUMP DESTINATION '/data/dmp'
DUMP FILE 'test.dmp'
NOTABLEIMPORT;
exit;
EOF
2) 전체 복구
백업본에서 전체 데이터베이스 복구
- auxiliary db instance 시작
sql> startup nomount pfile='?/db/initTST1.ora'; (pfile를 생성하고 instance 가동)
- catalog db에서 meta 정보를 가져와서 auxiliary db에서 복구
rman catalog rcatalog/"test"@rmanc AUXILIARY /
run {
set newname for database to '/test/%b'; -- 기존 datafile를 test밑에 복구
duplicate database test to tst1
skip tablespace users, example
until time "to_date('2020/04/24 12:00', 'YYYY/MM/DD HH24:MI')"
logfile
group 1 ('/data/restore/redo1a.log', '/data/restore/redo1b.log' ) size 4m reuse,
group 2 ('/data/restore/redo2a.log', '/data/restore/redo2b.log' ) size 4m reuse
backup location '/data/2020-04-24' ;
}
* 백업 디렉토리로부터 복구시..
1) auxiliary db instance 시작
sql> startup nomount pfile='?/db/initTST1.ora'; (pfile를 생성하고 instance 가동)
2) rman 접속하여 복구
rman AUXILIARY /
run {
set newname for database to '/test/%b' ; -- 기존 datafile를 test밑에 복구
duplicate target database to tst1
skip tablespace users, example
logfile
group 1 ('/data/restore/redo1a.log', '/data/restore/redo1b.log' ) size 4m reuse,
group 2 ('/data/restore/redo2a.log', '/data/restore/redo2b.log' ) size 4m reuse
backup location '/data/2020-04-24' ;
}
'RDB > Oracle' 카테고리의 다른 글
enq: iv - contention 완화 (0) | 2020.06.03 |
---|---|
enq: fb - contention 완화 (0) | 2020.06.03 |
oracle 18c flashback database (1) | 2020.04.23 |
oracle rman 복구 (0) | 2020.04.07 |
오라클 rac disk 백업 복구 (0) | 2020.01.28 |