[ОТВЕТИТЬ]
Опции темы
22.03.2013 20:14  
OlegON
Код:
run {
crosscheck archivelog ALL;
crosscheck backup;
DELETE noprompt obsolete;
DELETE noprompt expired archivelog ALL;
DELETE noprompt expired backup;
DELETE noprompt archivelog ALL completed before 'sysdate -2';
backup DATABASE plus archivelog;
backup current controlfile format 'cntrl_%s_%p_%t';
backup VALIDATE CHECK logical DATABASE;
restore DATABASE VALIDATE;
blockrecover corruption list;
}
Код:
#!/bin/bash
export ORACLE_HOME=/opt/oracle/app/product/11.2.0/dbhome_1
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export ORACLE_SID=lkz1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH;
export LD_LIBRARY_PATH_64=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH_64;
export PATH
export date_format="%d%m%y-%H%M%S"
export begin_date=`date +$date_format`
export NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_DATE_FORMAT="HH24:MI:SS DD.MM.YYYY"
export BACKUP_HOME=/u02/lkz/
export BACKUP_PATH=$BACKUP_HOME$begin_date
export BACKUP_LOG=$BACKUP_PATH/backup_$begin_date.log

if [ ! -d $BACKUP_PATH ]; then
    mkdir -p $BACKUP_PATH;
fi

$ORACLE_HOME/bin/rman target/ nocatalog log=$BACKUP_LOG append >> $BACKUP_LOG 2>&1 <<EOF
configure snapshot controlfile name to '$BACKUP_PATHsnapshot_controlfile.f';
configure device type disk backup type to compressed backupset parallelism 10;
configure channel device type disk maxpiecesize=10G;
configure retention policy to recovery window of 3 days;
configure retention policy to redundancy 1;
configure backup optimization off;
configure controlfile autobackup off;
show all;
run {
 set command id to 'BACKUP';
 backup archivelog all format '$BACKUP_PATH/%d_%I_archlogs_%s_%p_%D.%M.%Y.bak' tag 'ARCHLOGS_BACKUP' delete input;
 backup database format '$BACKUP_PATH/%d_%I_database_%s_%p_%D.%M.%Y.bak' tag 'DATABASE_BACKUP' plus archivelog format '$BACKUP_PATH/%d_%I_archlogs_%s_%p_%D.%M.%Y.bak' tag 'ARCHLOGS_BACKUP' delete input;
}
host '
echo "#################################################" >> $BACKUP_LOG;
echo "# crosscheck backup                             #" >> $BACKUP_LOG;
echo "#################################################" >> $BACKUP_LOG';
crosscheck backup device type disk;
host '
echo "#################################################" >> $BACKUP_LOG;
echo "# crosscheck archivelog all                     #" >> $BACKUP_LOG;
echo "#################################################" >> $BACKUP_LOG';
crosscheck archivelog all device type disk;
host '
echo "###################################################################################" >> $BACKUP_LOG;
echo "# delete noprompt backup tag \"ARCHLOGS_BACKUP\" completed before \"sysdate-3\";  #" >> $BACKUP_LOG;
echo "###################################################################################" >> $BACKUP_LOG';
delete noprompt backup tag 'ARCHLOGS_BACKUP' completed before 'sysdate-3';
delete noprompt obsolete;
host '
echo "#################################################" >> $BACKUP_LOG;
echo "# list backup                                   #" >> $BACKUP_LOG;
echo "#################################################" >> $BACKUP_LOG';
list backup;
host '
echo "#################################################" >> $BACKUP_LOG;
echo "# report schema                                 #" >> $BACKUP_LOG;
echo "#################################################" >> $BACKUP_LOG';
report schema;
exit;
EOF
date >> $BACKUP_LOG;
#sqlplus / as sysdba @?/rdbms/admin/utlrp 2>/dev/null>/dev/null
find $BACKUP_HOME -name *.log -mtime +4 -delete
 
 
Опции темы



Часовой пояс GMT +3, время: 17:09.

Все в прочитанное - Календарь - RSS - - Карта - Вверх 👫 Яндекс.Метрика
Форум сделан на основе vBulletin®
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd. Перевод: zCarot и OlegON
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.