ORACLE 一个完整的rman备份脚本

xiaoxiao2021-02-28  138

#!/bin/bash . ~/.bash_profile export ORACLE_SID=prdrisk DATE1=`date '+%Y%m%d'_%H%M%S` mv /dbfile/scripts/log/*.log /dbfile/scripts/logs/. $ORACLE_HOME/bin/rman log=/dbfile/scripts/log/Rman_prdrisk_$DATE1.log << EOF connect target /; crosscheck archivelog all; run {     allocate channel ch1 device type disk ;     report schema;     crosscheck backup of database;     crosscheck backup of archivelog all;     crosscheck backup of controlfile;     crosscheck backup of spfile;     crosscheck archivelog all;     delete noprompt force expired backup;     delete noprompt force expired archivelog until time 'sysdate-0.5';     delete noprompt force expired copy;     delete noprompt force obsolete;     report need backup;     report unrecoverable;     release channel ch1; } run{ allocate channel ch1 device type disk maxpiecesize=4096M; allocate channel ch2 device type disk maxpiecesize=4096M; allocate channel ch3 device type disk maxpiecesize=4096M; allocate channel ch4 device type disk maxpiecesize=4096M; backup  as compressed backupset incremental level 0  format '/dbfile/rmanbak/prdrisk_%p_%s_%u.ful' (database); sql 'alter system archive log current'; backup as compressed backupset   format '/dbfile/rmanbak/prdrisk_%p_%s_%u.arb' (archivelog all); backup  format '/dbfile/rmanbak/prdrisk_%p_%s.ctb' (current controlfile); backup spfile format '/dbfile/rmanbak/%d_sp_%s_%p_%t.sbk' tag 'spfile_backup'; release channel ch1; release channel ch2; release channel ch3; release channel ch4; } exit; EOF
转载请注明原文地址: https://www.6miu.com/read-21801.html

最新回复(0)