Database/Oracle 스크립트

[백업복구] RMAN 백업_여러 경우

리밍 2024. 3. 27. 17:41

 

 

1. 기본모드로 백업, 압축하면서 백업

--기본모드로 전체 datafile백업

RMAN > backup database format 'data/backup/rman/%U_%T'

--압축하면서 전체 datafile백업
RMAN > backup as compressde backupset database
       format '/data/backup/rman/%U_%T';
       
--압축하면서 전체 archive log file전체 백업
RMAN > backup as compressed backupset archivelog all 
       format '/data/backup/rman/%U_%T';

 

 

2. 전체 데이터베이스 백업

RMAN > run {
 allocate channel c1 device type disk 
 foramt 'data/backup/rman/%U_%T';
 backup database;
}

 

- %U :파일 이름 중복 X

- %T: 백업날짜

 

 

3. channel 3개를 할당 해서 example, usrs, system, control file만 백업 수행

RMAN > run {
 allocate channel c1 device type disk;
 allocate channel c2 device type disk;
 allocate channel c3 device type disk;
 backup
 tablespace example, users, system
 include current controlfile;
}

 

-channel: 백업 받을 경로 지정하는 것 

 

 

 

4.Datafile로 백업 받기 (tbs이름이 아닌 datafile명으로)

report schema;
--데이터파일 정보 7개확인 

RMAN > run{
 allocate channel cl type disk;
 backup datafile 1,2,3,4,5,6,7;
}

 

 

 

5. 현재 contorl file만 백업

RMAN {
 allocate channel c1 type disk;
 backup current controlfile;
}

 

 

 

 

6. rman사용해서 sysaux, example, system 테이블 스페이스를 한번에 백업

   백업 경로 

   sysaux -> /data/backup/open/

   example -> /data/backup/rman

   system ->/data/backup/close

-작업형 명령어로 한번에 백업

-채널은 3개로 병렬 작업

-각 채널은 백업 파일 하느이 크리가 최대 10m넘지 않도록 설정

 

RMAN run{
 allocate channel cl type disk maxpiecesize 10M;
 allocate channel c2 type disk maxpiecesize 10M;
 allocate channel c3 type disk maxpiecesize 10M;
 backup
  tablespace example channel c1
    fromat '/data/backup/ramn/%U_%T'
  tablespace system channel c2
    format '/data/backup/close/%U_%T'
  tblespace sysaux channel c3
    format '/data/backup/open/%U_%T'

}

'Database > Oracle 스크립트' 카테고리의 다른 글

[Oracle] expdp  (0) 2024.04.17
[백업복구] 복구 Restore/ Recovery (1)  (0) 2024.03.27
[백업복구] RMAN 백업 진행사항 보기  (0) 2024.03.27