'Rman Backup 스크립트'에 해당되는 글 1건


Oracle Rawdevice구성 RMAN Backup스크립트


#/bin/bash

#RMAN backup script 2018/12/28


echo ##### BACKUP START!!!! #####

date

echo ###########################

# archive file delete(after 30 days)

echo ##### rac1,rac2 ARCHIVE LOG FILE DELETE -AFTER 30 DAYS- ##### 

find /archive/. -mtime +30 -print -exec rm {} \;

ssh rac2 'find /archive/. -mtime +30 -print -exec ssh rac2 rm {} \;' 


# ocr, vote backup

echo ##### OCR BACKUP START #####

dd if=/dev/raw/raw13 of=/dbbackup/rman/ocrvote_bak/ocr.bak bs=200M count=1

echo ##### OCR BACKUP END   #####

echo ##### VOTE BACKUP START #####

dd if=/dev/raw/raw15 of=/dbbackup/rman/ocrvote_bak/vote.bak  bs=100M count=1

echo ##### VOTE BACKUP END   #####


# spfile backup

echo ##### SPFILE BACKUP START #####

sqlplus "/ as sysdba" << EOF

create pfile='/backup/rman/pfile/initrac1.bak' from spfile;

exit

EOF

echo ##### SPFILE BACKUP END   #####


# rman full backup

rman target / << EOF


rman target /

sql 'alter system archive log current';

sql "alter session set nls_date_format=''dd.mm.yyyy hh24:mi:ss''";


RUN

{

configure controlfile autobackup on;

set command id to 'ORCLOnlineBackupFull';

ALLOCATE CHANNEL c1 DEVICE TYPE disk;

ALLOCATE CHANNEL c2 DEVICE TYPE disk;

ALLOCATE CHANNEL c3 DEVICE TYPE disk;

ALLOCATE CHANNEL c4 DEVICE TYPE disk;

backup AS COMPRESSED BACKUPSET full database tag ORCL_FULL format '/backup/rman/data/%d_%T_%s_%p_FULL' ;

sql 'alter system archive log current';

backup tag ORCL_ARCHIVE format '/backup/rman/archive/%d_%T_%s_%p_ARCHIVE' archivelog all delete all input ;

backup tag ORCL_CONTROL current controlfile format '/backup/rman/control/%d_%T_%s_%p_CONTROL';

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}


crosscheck backup;

crosscheck backupset;

crosscheck copy;

crosscheck archivelog all;

delete noprompt expired backup;

delete noprompt obsolete;


list backup;

exit

EOF



블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,