This is oracle full backup script using RMAN
-
The following parts need to be modified in the script
-
Backup location
## backup location = /backup <= backup path
-
oracle profile
Change the following variables ( ORACLE_BASE, ORACLE_HOME….)
######### oracle profile ########################################
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/app/oracle/product/11.2
export ORACLE_SID=ppro
export PATH=$PATH:/usr/bin:/usr/sbin:$ORACLE_HOME/bin
#############################################################
3) crontab ( backup time) Register crontab for automatic execution
## 30 3 * * 1-6 /PATH /full_backup.sh ## backup time in crontab
-
How to execute ( #sh full_backup.sh as oracle account)
-
You can check backup file in /backup partition
-
Display full_backup.sh
Script
[oracle@ogg2 backup]$ cat full_backup.sh
#!/bin/sh
#tart the rman commands
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/app/oracle/product/11.2
export ORACLE_SID=east
export PATH=$PATH:/usr/bin:/usr/sbin:$ORACLE_HOME/bin
rman target=/ << EOF
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
RUN
{
ALLOCATE CHANNEL ch1 TYPE DISK MAXPIECESIZE 10G;
sql 'alter system archive log current';
BACKUP AS compressed backupset
FORMAT '/backup/%d_full_db_%T_%s'
DATABASE ;
BACKUP SPFILE
FORMAT '/backup/%d_spfile_%T_%s' ;
BACKUP AS compressed backupset
FORMAT '/backup/%d_arc_%T_%s' archivelog all DELETE INPUT ;
BACKUP AS compressed backupset
FORMAT '/backup/%d_control_%T_%s'
CURRENT CONTROLFILE;
crosscheck backup;
crosscheck archivelog all;
delete noprompt obsolete;
delete noprompt expired backup;
delete noprompt archivelog until time 'SYSDATE - 3';
}
EXIT;
EOF
#
사업자 정보 표시
(주)블루원 | 김홍태 | 서울특별시 용산구 원효로 4가 135 금홍 2빌딩 | 사업자 등록번호 : 106-86-76684 | TEL : 02-3272-7200 | Mail : support_ora@blueone.co.kr | 통신판매신고번호 : 호 | 사이버몰의 이용약관 바로가기
'DB - ORACLE > Oracle DB Admin ' 카테고리의 다른 글
[TD - ORACLE] ORACLE DataGuide 에 대한 소개글 (0) | 2019.08.07 |
---|---|
[TD-ORACLE] Oracle RAC TZ 변경하기 (0) | 2017.11.21 |
[TD-ORACLE] Oracle IP Access Control (0) | 2017.11.09 |
Oracle ASM 프로세스 설명 (0) | 2017.04.12 |
오라클 파티션 테이블 리오그 방법 (0) | 2017.04.11 |