rman backup script(引用)

tolilong發表於2012-06-07
某Oracle真實RMAN備份指令碼和策略分享:

【自動作業 crontab 內容】
#* * * * * /oradata3/oracle/rman/rman1
#10 10 03 * * /oradata3/oracle/rman/rman0
#20 10 * * 6 /oradata3/oracle/rman/rman1
20 10 * * 6 /oradata3/oracle/rman/rman0bak
#00 01 * * 0,1,2,3,4,5 /oradata3/oracle/rman/rman2

【各指令碼】
more /oradata3/oracle/rman/rman1
rman target / log=/oradata4/oracle/rman/$(date +%y%m%d%H%M)backup1.log < delete noprompt obsolete;
run
{
allocate channel d1 device type disk;
backup incremental level 1
format '/oradata4/oracle/rman/%d_%s_%p.bak_1'
(database include current controlfile filesperset=2 );
sql 'alter system archive log current';
backup archivelog all format '/oradata4/oracle/rman/arc_%s_%p.bk_1' delete all input;
}
EOF

more /oradata3/oracle/rman/rman0
rman target / log=/oradata3/oracle/rman/$(date +%y%m%d%H%M)backup0.log < run
{
backup incremental level 0
format '/oradata3/oracle/rman/%d_%s_%p.bak_0'
(database include current controlfile filesperset=2 );
sql 'alter system archive log current';
backup archivelog all format '/oradata3/oracle/rman/arc_%s_%p.bk_0' delete all input;
}
delete noprompt obsolete;
EOF
exit

more /oradata3/oracle/rman/rman1
rman target / log=/oradata4/oracle/rman/$(date +%y%m%d%H%M)backup1.log < delete noprompt obsolete;
run
{
allocate channel d1 device type disk;
backup incremental level 1
format '/oradata4/oracle/rman/%d_%s_%p.bak_1'
(database include current controlfile filesperset=2 );
sql 'alter system archive log current';
backup archivelog all format '/oradata4/oracle/rman/arc_%s_%p.bk_1' delete all input;
}
EOF
exit

more /oradata3/oracle/rman/rman0bak
rman target / log=/oradata3/oracle/rman/$$(date +%y%m%d%H%M)backup0.log < run
{
backup incremental level 0 database filesperset=3;
sql 'alter system switch logfile';
backup archivelog all delete all input;
delete noprompt obsolete;
}
EOF
exit

more /oradata3/oracle/rman/rman2
rman target / log=/oradata3/oracle/rman/$(date +%y%m%d%H%M)backup2.log < delete noprompt obsolete;
run
{
allocate channel d1 device type disk;
backup incremental level 2 tag 'db_2'
format '/oradata3/oracle/rman/%d_%s_%p.bak_2'
(database include current controlfile filesperset=2 );
sql 'alter system archive log current';
backup archivelog all format '/oradata3/oracle/rman/arc_%s_%p.bk_2' delete all input;
}
EOF
exit


RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata3/orabak/rman/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/oradata3/orabak2/rman/%d_%T%t%p';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/oradata3/orabak1/rman/%d_%T%t%p';
CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/oradata5/oracle/rman1/%d_%T%t%p';
CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT '/oradata5/oracle/rman2/%d_%T%t%p';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/oracle/product/10.2.0/db_1/dbs/snapcf_bix.f'; # default

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-732102/,如需轉載,請註明出處,否則將追究法律責任。

相關文章