CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
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
'/orabackup/rman/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO 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 CONNECT 'SYS/[email protected]';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT ' SYS/[email protected]';
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/orabackup/rman/snapcf_racdbtst1.f'; # default

configure controlfile autobackup format for device type disk to
'/orabackup/rman/ORA920/%F';

configure channel device type disk format
'/orabackup/rman/backup_db_%d_S_%s_P_%p_T_%t' ;

 #!/bin/csh -x
# rman_backup_as_copy_to_FS
# ----------------------------
# ----------------------------
# This script make a backup copy to file system
# This backup can be restored on File system as a regular hot backup
# Or can be restored to ASM by using rman
#
-------------------------------------------------------------------------------
# This script does: export ORACLE_SID=mars2
# 1) Administrative tasks:
# crosscheck
# delete obsolete
# 2) Archive log current on 1st Instance
# 3) Archive log current on 2nd Instance
# 4) Rman backup as copy to file system including controlfile and archivelogs
# 5) Archive log current on 1st Instance
# 6) Archive log current on 2nd Instance
# 7) Rman backup as copy archivelogs not backed up and print backupset
list to log
#
--------------------------------------------------------------------------------
# This script works with 2 nodes only, if you have more than 2 nodes you
need to customize it.
#
# This script use aliases and Environment variables set on .cshrc
# to setup the environment to point to the Database:
# setenv DBS_HOME /u01/app01/oracle/product/10gDB
# setenv BASE_PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
# alias 10db 'setenv $ORACLE_HOME $DBS_HOME; setenv PATH
$ORACLE_HOME/bin:$BASE_PATH'
# This script do require as parameters the 2 instance names
# It will use them to archive all required logs from instances 1 and 2
# --------------------------------------------------------------------
set v_inst1=mars2
set v_inst2=mars1
# Rman Backup Location variable
# -----------------------------
set v_rman_loc=/orabackup/rman
# Step 1: Administrative tasks, crosscheck and delete obsolete
# ------------------------------------------------------------
setenv ORACLE_SID $v_inst1
rman target / nocatalog <<EOF
crosscheck backupset;
crosscheck copy;
crosscheck archivelog all;
delete noprompt expired backup ;
delete noprompt obsolete;
exit
EOF
# This script run from 1st node. We use an external identified DBA user,
ops$oracle, to execute
# the archive log current. From the same session we connect as ops$oracle
into the 2nd instance
# You need remote_os_authent=TRUE on both instances to connect remotely
without password
# Step 2: Archive log current on 1st Instance
# Step 3: Archive log current on 2nd Instance
# -------------------------------------------
sqlplus -s sys/[email protected]$v_inst1 << EOF
select instance_name from v\$instance
/
alter system archive log current
/
connect sys/[email protected]$v_inst2;
select instance_name from v\$instance
/
alter system archive log current
/
exit
EOF
# On step 4 we use 4 channels. This needs to be customized according the
number of cpu's/IO
# channels available. Rman is invoked in nocatalog mode, we need to have
configured
# ORACLE_HOME, ORACLE_SID and PATH on the environment, as we did in the
previous steps.
# Step 4: Rman backup as copy to file system including controlfile and
archivelogs
#
--------------------------------------------------------------------------------
rman target / nocatalog <<EOF
run {
allocate channel backup_disk1 type disk format '$v_rman_loc/%U';
allocate channel backup_disk2 type disk format '$v_rman_loc/%U';
backup as COPY tag '%TAG' database include current controlfile;
release channel backup_disk1;
release channel backup_disk2;
}
exit
EOF
# Step 5 and 6: Archive log current on 1st and 2nd Instances
# ----------------------------------------------------------
sqlplus -s sys/[email protected]$v_inst1 << EOF
select instance_name from v\$instance
/
alter system archive log current
/
connect sys/[email protected]$v_inst2;
select instance_name from v\$instance
/
alter system archive log current
/
exit
EOF
# Step 7: Rman backup as copy archivelogs not backed up and print
backupset list to log
rman target / nocatalog <<EOF
backup as copy archivelog all format '$v_rman_loc/%d_AL_%T_%u_s%s_p%p' ;
list backupset;
exit
EOF
# Redirecting rman output to log will suppress standard output, because of
that
# running separately.
rman target / nocatalog log=$v_rman_loc/backupset_info.log <<EOF
list backup summary;
list backupset;
list backup of controlfile;
exit
EOF
# eof rman_backup_as_copy_to_FS

Leave a Reply