Backup database shell-script with RMAN
A proper backup is the base for a well and relaxed administration of yout databases.What follows is a backup-script which I use for several customers. It’s backing up all in the same directory and I tested the restore frequently.
There’s however one drawback: I copied the script through word- or notepad apparently, so take care of the (double) quotes used in the script. You may have to re-type them.
#!/usr/bin/ksh
#
# file : /home/oracle/bin/backup.sh
# description : run rman backup to disk ……
#
# Author: Job Oprel
# Versie: 0.1
# ——-|————+——————-+———————————
# 0.1 | 11-06-2008 | Job Oprel | Initial
# 0.2 | 01-08-2008 | Job Oprel | An own oratab instead of /etc/oratab
#
#
##### Variables #######
##########################
LOGDIR=/home/oracle/log
RUNTIME=`date ‘+%H%M_%d%m%Y’`
RUNDATE=`date ‘+%d%m%Y’`
ORACLE_HOME=/software/oracle/product/10.2
ADDR='<mail-address>’
PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin
NLS_DATE_FORMAT=’DD-MM-YY HH24:MI:SS’
NODE_NAME=’node_x’
BACKUP_BASE=’/backup/oracle’
export ORACLE_HOME PATH NLS_DATE_FORMAT NODE_NAME BACKUP_BASE
# Which databases:
for ORACLE_SID in `cat /home/oracle/bin/oratab_backup | grep “:Y” | awk -F : ‘{ print $1 }’ `
do
export ORACLE_SID
# Specific settings #
#########################################
LOGFILE=${LOGDIR}/${ORACLE_SID}_${RUNDATE}_${RUNTIME}.log
BACKUPDIR=${BACKUP_BASE}/${ORACLE_SID}/rman
# Cleaning old files#
#############################
find ${LOGDIR}/${ORACLE_SID}_*.log -ctime +15 -exec rm -f {} \; > /dev/null 2>&1
find ${BACKUPDIR}/ctrlfile_${ORACLE_SID}_* -ctime +15 -exec rm -f {} \; > /dev/null 2>&1
#### Rman backup ##
##########################
exec >> ${LOGFILE} 2>&1
${ORACLE_HOME}/bin/rman msgno target / nocatalog <<EOF!
CONFIGURE RETENTION POLICY TO REDUNDANCY 2; # default 1
CONFIGURE BACKUP OPTIMIZATION OFF; # default OFF
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default OFF
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘${BACKUPDIR}/ora_cf%F’; # default ‘%F’
CONFIGURE DEVICE TYPE DISK PARALLELISM 2; # default 1
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘${BACKUPDIR}/ora_df%t_s%s_s%p’;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘${BACKUPDIR}/snapcf_${ORACLE_SID}.f’;
SHOW ALL;
sql “alter system archive log current”;
DELETE FORCE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE ‘sysdate-14’;
BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL=0 DATABASE INCLUDE CURRENT CONTROLFILE PLUS ARCHIVELOG;
sql “alter database backup controlfile to trace as ”${BACKUPDIR}/ctrlfile_${ORACLE_SID}_${RUNDATE}_${RUNTIME}””;
CROSSCHECK BACKUP;
REPORT OBSOLETE;
DELETE FORCE NOPROMPT OBSOLETE;
LIST BACKUP OF DATABASE;
LIST BACKUP OF ARCHIVELOG ALL;
LIST BACKUP;
EOF!
echo “############################”
echo “# Database: ${ORACLE_SID}” >> ${LOGDIR}/mailmessage
echo “############################”
cat ${LOGFILE} >> ${LOGDIR}/mailmessage
done
grep RMAN-06273 ${LOGDIR}/mailmessage >>/dev/null
if [ $? -eq 0 ]
then
SUBJECTHEADER=”ATTENTION!: 1 or more backups of the ${NODE_NAME} has failed”
else
grep -i error ${LOGFILE} >>/dev/null
if [ $? -eq 0 ]
then
SUBJECTHEADER=”ATTENTION!: 1 or more backups of the ${NODE_NAME} has failed”
else
SUBJECTHEADER=”backup ${NODE_NAME} is OK!”
fi
fi
## Mail het resultaat ##
########################
cat ${LOGDIR}/mailmessage | /usr/bin/mailx -s “${SUBJECTHEADER}” ${ADDR}
rm ${LOGDIR}/mailmessage
How do I set up HP LaserJet Pro MFP M223 wireless printer?
ReplyDeleteThe following enhancements can help you with the Setup HP LaserJet Pro MFP M223 Wireless Installation Printer:
First, cut the tape on the printer packaging using a utility knife or scissors. keep a styrofoam box.
Then place the HP Laserjet Pro MFP M227fdw on a flat surface. In addition, you need to confirm important details such as toner cartridges, power connectors, manuals, banner layouts, and so on.
Materials such as Styrofoam, protective cover from the HP Laserjet Pro printer. Also, don't forget to send them back for reuse.
In addition, you must control your HP Laserjet Pro printer, regardless of your interactions with the store.
Attach the connector to the back of the printer and plug the next connector into a power outlet.
Setup HP LaserJet Pro MFP M223