You cannot see this page without javascript.

진주성 블로그 방문하기

기술문서 Oracle begin end backup

2017.08.24 01:17

gupy1004 조회 수:1488

oracle_begin_end.txt.txt

 

스크립트 내용

 

cat orawork_backup.sh


#!/sbin/sh
######################################################
##
## Oracle Begin-End Backup Script By Guppy
##
#####################################################
ORACLE_SID=ORAWORK
ORACLE_USER=oracle
POLICE=workDB_oracle
SCHEDULE=full
NBU=/usr/openv/netbackup
WORK_PWD=${NBU}/scripts
TIME=`date +%Y%m%d_%H%M%S`
ARCHIVE_LOG=${WORK_PWD}/${ORACLE_SID}/ARCHIVE_DESTINATION
ARCHIVE_LOG_TMP=${WORK_PWD}/${ORACLE_SID}/ARCHIVE_DESTINATION_TMP
ARCHIVE_LOG_LIST=${WORK_PWD}/${ORACLE_SID}/ARCHIVE_LOG_LIST
DBF_LIST=${WORK_PWD}/${ORACLE_SID}/DBF_FILE
DBF_LIST_TMP=${WORK_PWD}/${ORACLE_SID}/DBF_FILE_TMP
LOG=${WORK_PWD}/${ORACLE_SID}/LOG_FILE_${TIME}
CNTL=${WORK_PWD}/${ORACLE_SID}/control.bak

su - $ORACLE_USER -c "sqlplus '/as sysdba' << EOF
select file_name from dba_data_files;
exit
EOF
" > $DBF_LIST_TMP
grep / $DBF_LIST_TMP  >$DBF_LIST

su - $ORACLE_USER -c "sqlplus '/as sysdba' << EOF
archive log list;
exit
EOF
" > $ARCHIVE_LOG_TMP
grep "Archive destination" $ARCHIVE_LOG_TMP | awk '{print $3}' > $ARCHIVE_LOG

###########################################################################
su - $ORACLE_USER -c "sqlplus '/as sysdba' << EOF
alter system switch logfile;
alter database begin backup;
exit
EOF
" >> $LOG

$NBU/bin/bpbackup -p $POLICE -s $SCHEDULE -L $LOG -w -f $DBF_LIST


if [  -d $CNTL ]
then
        rm -rf $CNTL
fi
su - $ORACLE_USER -c "sqlplus '/as sysdba' << EOF
alter database end backup;
alter database backup controlfile to trace;
alter database backup controlfile to '/usr/openv/netbackup/scripts/ORAWORK/control.bak' reuse;
alter system switch logfile;
select \* from v\$backup;
exit
EOF
" >> $LOG


$NBU/bin/bpbackup -p $POLICE -s $SCHEDULE -L $LOG -w $CNTL

/bin/find `cat $ARCHIVE_LOG` -mtime +25 > $ARCHIVE_LOG_LIST
$NBU/bin/bpbackup -p $POLICE -s $SCHEDULE -L $LOG -w -f $ARCHIVE_LOG_LIST
rm -rf `cat $ARCHIVE_LOG_LIST`


---------------------------------------------------------------------------
[workDB:/usr/openv/netbackup/scripts]crontab -l


# DB On-line backup
0 1 * * * /usr/openv/netbackup/scripts/orawork_backup.sh
 

번호 제목 날짜 조회 수
170 Restore Database And Rename Database Files Example 2019.03.26 63314
169 Dns 보안 file 2017.08.23 20211
168 Sun t2000 manual file 2017.08.24 19980
167 AD(Active Directory) 2017.11.01 18596
166 한글 putty file 2017.09.13 12000
165 Tear Drop / Tiny Fragment / Fragment Overlap(고전적인방법) file 2017.10.17 9019
164 Cain & Abel is a password recovery tool 2018.03.12 8071
163 win-sshfs for windows file 2017.09.13 7770
162 룰 기반의 IDS(침입탐지시스템) - snort file 2017.09.27 7689
161 HP-UX snmp 중지 설정 2017.09.07 6862
160 VPN 2017.11.01 5139
159 보안관제 file 2017.11.01 4767
158 아파치 2.2.29 버젼에서 SSLProtocol 중 TLSv1.2로 설정 2019.02.27 4427
157 tcpdump - dump traffic on a network [1] file 2017.10.13 4028
156 윈도우용 wget file 2017.09.28 4017
진주성 블로그 방문하기
CLOSE