miércoles, 12 de agosto de 2009

RMAN Script Backup Disk - Tape

backup_database_disk_TCOPGE.sh

BACKUP DISK

#/usr/bin/ksh
export ORACLE_HOME=/softw/app/oracle/product/10.2.0/db
export PATH=/softw/app/oracle/product/10.2.0/db/bin:/home/oracle/rman/scripts:/usr/local/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.
export RMAN_SCRIPTS=/home/oracle/rman/scripts

export ORACLE_SID=TCOPGE

export LOGS_RMAN=/altamira_bd/TCOPGE/arch/backup/TCOPGE/logs
cd $ORACLE_HOME/bin
rman target / LOG=$LOGS_RMAN/backup_database_disk_TCOPGE.log APPEND CMDFILE=$RMAN_SCRIPTS/backup_database_disk_TCOPGE.rcv


backup_database_disk_TCOPGE.rcv

run {
allocate channel ch01 device type disk format '/altamira_bd/TCOPGE/arch/backup/TCOPGE/database/%U' ;
backup as compressed backupset database ;
backup current controlfile;
crosscheck backup;
crosscheck backup archivelog all;
delete noprompt obsolete device type disk;
delete noprompt expired backup;
release channel ch01;
}

backup_archivelog_disk_TCOPGE.sh

#/usr/bin/ksh
export ORACLE_HOME=/softw/app/oracle/product/10.2.0/db
export PATH=/softw/app/oracle/product/10.2.0/db/bin:/home/oracle/rman/scripts:/usr/local/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.
export RMAN_SCRIPTS=/home/oracle/rman/scripts

export ORACLE_SID=TCOPGE

export LOGS_RMAN=/altamira_bd/TCOPGE/arch/backup/TCOPGE/logs

rman target / LOG=$LOGS_RMAN/backup_archivelog_disk_TCOPGE.log APPEND CMDFILE=$RMAN_SCRIPTS/backup_archivelog_disk_TCOPGE.rcv

backup_archivelog_disk_TCOPGE.rcv

run {
allocate channel ch01 device type disk format '/altamira_bd/TCOPGE/arch/backup/TCOPGE/archives/%U' ;
backup as COMPRESSED BACKUPSET archivelog all delete input ;
crosscheck archivelog all;
release channel ch01;
}

00 01 * * * /home/oracle/rman/scripts/backup_database_disk_TCOPGE.sh
00 14,20 * * * /home/oracle/rman/scripts/backup_archivelog_disk_TCOPGE.sh


BACKUP TAPE CLUSTER

connect rcvcat rman/rman@cat9i
connect target /

RUN {
ALLOCATE CHANNEL ch00
TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64";
SEND 'NB_ORA_CLIENT=telbebdsdp1,NB_ORA_POLICY=BD_Online_ALTAMIRA_SDPTE01';
BACKUP
INCREMENTAL LEVEL=0
FORMAT 'db_%s_%p_%t'
TAG 'BD_SDPTE01_ALTAMIRA'
DATABASE;

RELEASE CHANNEL ch00;

# Backup Archived Logs
sql 'alter system archive log current';

ALLOCATE CHANNEL ch00
TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64" connect rman/rman@RAC0;

ALLOCATE CHANNEL ch01
TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64" connect rman/oracle@RAC1;

ALLOCATE CHANNEL ch03
TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64" connect rman/oracle@RAC2;

ALLOCATE CHANNEL ch04
TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64" connect rman/oracle@RAC3;

BACKUP
FORMAT 'arch_%s_%p_%t'
ARCHIVELOG
ALL
DELETE INPUT;

RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;

# Control file backup

ALLOCATE CHANNEL ch00
TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64";
SEND 'NB_ORA_CLIENT=telbebdsdp1,NB_ORA_POLICY=BD_Online_ALTAMIRA_SDPTE01';
BACKUP
FORMAT 'ctrl_%s_%p_%t'
CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}