Query to check the status or progress of rman restore
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK, ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE" FROM V$SESSION_LONGOPS WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%' AND TOTALWORK != 0 AND SOFAR <> TOTALWORK ;
List archives older than 3 days and delete on confirmation
delete archivelog until time "SYSDATE-3";
delete noprompt archivelog until time "SYSDATE-2";
backup_loc="/pbp03/applptch/PFCPATCH_coldbkp"
rman target / log=${backup_loc}/rman_coldbkp.log << EOF
run {
shutdown immediate;
startup mount;
crosscheck backup;
crosscheck copy;
delete noprompt obsolete;
delete noprompt expired backup;
allocate channel c1 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c2 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c3 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c4 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c5 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c6 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c7 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c8 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
backup full filesperset 5 as compressed BACKUPSET tag 'WEEKLY_COLD_BKP' database include current controlfile;
copy current controlfile to "${backup_loc}/%d_control_file_%D_%T_%s";
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
release channel c8;
alter database open;
}
exit
EOF
delete noprompt archivelog until time "SYSDATE-2";
RMAN cold backup script
backup_loc="/pbp03/applptch/PFCPATCH_coldbkp"
rman target / log=${backup_loc}/rman_coldbkp.log << EOF
run {
shutdown immediate;
startup mount;
crosscheck backup;
crosscheck copy;
delete noprompt obsolete;
delete noprompt expired backup;
allocate channel c1 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c2 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c3 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c4 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c5 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c6 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c7 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
allocate channel c8 type disk format "${backup_loc}/%d_df_%D_%M_%Y_%s_%U.rman" maxpiecesize 2000 M;
backup full filesperset 5 as compressed BACKUPSET tag 'WEEKLY_COLD_BKP' database include current controlfile;
copy current controlfile to "${backup_loc}/%d_control_file_%D_%T_%s";
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
release channel c8;
alter database open;
}
exit
EOF
No comments:
Post a Comment