<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2876563497138343096</id><updated>2011-11-27T16:47:23.653-08:00</updated><category term='import'/><category term='Teradata'/><category term='DBA'/><category term='Developer'/><category term='rman logs'/><category term='rman scripts'/><category term='export'/><category term='Oracle'/><category term='rman scripts catalog'/><category term='sqlnet'/><category term='Ramakrishna Nemani'/><title type='text'>Database Tech Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7451555117493254600</id><published>2010-03-08T19:57:00.002-08:00</published><updated>2010-03-08T19:57:44.536-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>sample rman_unregister_db.ksh file</title><content type='html'>#!/bin/ksh&lt;br /&gt;##&lt;br /&gt;## Script Name: rman_unregister_db.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Unregister a given database with rman catalog&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;. ~/.profile&lt;br /&gt;. ./rmanids.sh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;echo&lt;br /&gt;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;echo&lt;br /&gt;echo Usage: $0 ORACLE_SID&lt;br /&gt;echo&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;rman &amp;lt;&amp;lt; EOF&lt;br /&gt;connect target ${rmanid}/${rmanpw} ;&lt;br /&gt;connect catalog ${catlid}/${catlpw}@${ORACLE_CATL} ;&lt;br /&gt;unregister database noprompt ;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;export rman_rtnval=$?&lt;br /&gt;echo $rman_rtnval&lt;br /&gt;if [[ $rman_rtnval = 0 ]]&lt;br /&gt;then&lt;br /&gt;echo $ORACLE_SID successfully registered with rman catalog&lt;br /&gt;else&lt;br /&gt;echo $ORACLE_SID could not be registered with rman catalog&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;## -------------------------------------------------------------------------------&lt;br /&gt;## End of &amp;nbsp;rman_unregister_db.ksh&lt;br /&gt;## -------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7451555117493254600?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7451555117493254600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanunregisterdbksh-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7451555117493254600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7451555117493254600'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanunregisterdbksh-file.html' title='sample rman_unregister_db.ksh file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-2181527638632433263</id><published>2010-03-08T19:57:00.000-08:00</published><updated>2010-03-08T19:57:01.026-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>sample rman_del.ksh file</title><content type='html'>#!/bin/ksh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## script name : rman_del.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;## This script deletes obsolete backups&lt;br /&gt;## for the specified ORACLE_SID&lt;br /&gt;##&lt;br /&gt;. ~/.profile&lt;br /&gt;. /apps/oracle/admin/rman/rmanids.sh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;echo&lt;br /&gt;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;echo&lt;br /&gt;echo Usage: $0 ORACLE_SID&lt;br /&gt;echo&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;&lt;br /&gt;LOG_DIR="/apps/oracle/admin/rman"&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;EMAIL_INFO_FILE="${LOG_DIR}/${ORACLE_SID}_email.cfg"&lt;br /&gt;SENDER="rman@`hostname"&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the logs&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The LOGARCFILE will have the cumulative log&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;## LOGFILE="${LOG_DIR}/rman_del_$CURR_DATE.log"&lt;br /&gt;&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_del.$ORACLE_SID.log"&lt;br /&gt;LOGARCFILE="${LOG_DIR}/rman_del.$ORACLE_SID.log.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the errors&lt;br /&gt;## The EMAILFILE will have errors if any from just the latest run&lt;br /&gt;## The EMAILARCFILE will have the cumulative errors&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;EMAILFILE="${LOG_DIR}/rman_del.$ORACLE_SID.email"&lt;br /&gt;EMAILARCFILE="${LOG_DIR}/rman_del.$ORACLE_SID.email.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;echo --------------------------------------------------------- &amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_del.ksh started ------------------ &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [ &amp;nbsp;-e &amp;nbsp;$LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;echo "$LOCKFILE exists. Will check again after 3 minutes" &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;nbsp;&amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;sleep 180&lt;br /&gt;&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create a lock file&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;break&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;rman &amp;lt;&amp;lt;EOF &amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;connect target ${rmanid}/${rmanpw} ;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt PARALLELISM 4 ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt&lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'&lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;&lt;br /&gt;SHOW ALL ;&lt;br /&gt;DELETE NOPROMPT OBSOLETE;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt clear ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt clear ;&lt;br /&gt;REPORT SCHEMA ;&lt;br /&gt;&lt;br /&gt;EXIT ;&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;rmanstatus=$?&lt;br /&gt;&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;if [ ! -e &amp;nbsp;$EMAIL_INFO_FILE ]&lt;br /&gt;then&lt;br /&gt;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script failed in the backup step for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;grep -i 'RMAN-' &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'ORA-' &amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'sbt' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'tsm' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;exit 12&lt;br /&gt;fi&lt;br /&gt;##&lt;br /&gt;## sync up the rman catalog&lt;br /&gt;##&lt;br /&gt;rman &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;CONNECT TARGET ${rmanid}/${rmanpw} ;&lt;br /&gt;CONNECT CATALOG ${catlid}/${catlpw}@${ORACLE_CATL} ;&lt;br /&gt;RESYNC CATALOG;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;rmanstatus=$?&lt;br /&gt;&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;if [ ! -e &amp;nbsp;$EMAIL_INFO_FILE ]&lt;br /&gt;then&lt;br /&gt;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script failed in the resync step for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;grep -i 'RMAN-' &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'ORA-' &amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'sbt' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'tsm' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;exit 12&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;echo -------------------------------------------------------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_del.ksh completed ---------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script completed successfully for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $LOGARCFILE&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for&lt;br /&gt;## this ORACLE_SID to run&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;&lt;br /&gt;## ---------------------------------------------------------------------&lt;br /&gt;## End of &amp;nbsp;rman_del.ksh&lt;br /&gt;## ---------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-2181527638632433263?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/2181527638632433263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmandelksh-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/2181527638632433263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/2181527638632433263'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmandelksh-file.html' title='sample rman_del.ksh file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7776324022650356403</id><published>2010-03-08T19:55:00.002-08:00</published><updated>2010-03-08T19:55:57.204-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>sample rman_bkup_arch.ksh file</title><content type='html'>#!/bin/ksh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## script name : rman_bkup_arch.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## This script backsup archived log files. It takes ORACLE_SID as an&lt;br /&gt;## argument and backs up the archived log files for the specified&lt;br /&gt;## ORACLE_SID&lt;br /&gt;##&lt;br /&gt;. ~/.profile&lt;br /&gt;. /apps/oracle/admin/rman/rmanids.sh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;echo&lt;br /&gt;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;echo&lt;br /&gt;echo Usage: $0 ORACLE_SID&lt;br /&gt;echo&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;&lt;br /&gt;LOG_DIR="/apps/oracle/admin/rman"&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;EMAIL_INFO_FILE="${LOG_DIR}/${ORACLE_SID}_email.cfg"&lt;br /&gt;SENDER="rman@`hostname"&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the logs&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The LOGARCFILE will have the cumulative log&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;## LOGFILE="${LOG_DIR}/rman_bkup_arch_$CURR_DATE.log"&lt;br /&gt;&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_bkup_arch.$ORACLE_SID.log"&lt;br /&gt;LOGARCFILE="${LOG_DIR}/rman_bkup_arch.$ORACLE_SID.log.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the errors&lt;br /&gt;## The EMAILFILE will have errors if any from just the latest run&lt;br /&gt;## The EMAILARCFILE will have the cumulative errors&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;EMAILFILE="${LOG_DIR}/rman_bkup_arch.$ORACLE_SID.email"&lt;br /&gt;EMAILARCFILE="${LOG_DIR}/rman_bkup_arch.$ORACLE_SID.email.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;echo --------------------------------------------------------- &amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_bkup_arch.ksh started ------------------ &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [ &amp;nbsp;-e &amp;nbsp;$LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;echo "$LOCKFILE exists. Will check again after 3 minutes" &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;nbsp;&amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;sleep 180&lt;br /&gt;&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create a lock file&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;break&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;rman &amp;lt;&amp;lt;EOF &amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;CONNECT TARGET ${rmanid}/${rmanpw} ;&lt;br /&gt;&lt;br /&gt;SHOW ALL ;&lt;br /&gt;&lt;br /&gt;BACKUP ARCHIVELOG ALL DELETE INPUT;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt PARALLELISM 4 ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt&lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'&lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT TO '%F';&lt;br /&gt;&lt;br /&gt;BACKUP DEVICE TYPE SBT BACKUPSET ALL ;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt clear ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt clear ;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT CLEAR ;&lt;br /&gt;&lt;br /&gt;REPORT SCHEMA ;&lt;br /&gt;REPORT UNRECOVERABLE;&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;rmanstatus=$?&lt;br /&gt;&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;if [ ! -e &amp;nbsp;$EMAIL_INFO_FILE ]&lt;br /&gt;then&lt;br /&gt;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script failed in the backup step for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;grep -i 'RMAN-' &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'ORA-' &amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'sbt' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'tsm' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;exit 12&lt;br /&gt;fi&lt;br /&gt;##&lt;br /&gt;## sync up the rman catalog&lt;br /&gt;##&lt;br /&gt;rman &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;CONNECT TARGET ${rmanid}/${rmanpw} ;&lt;br /&gt;CONNECT CATALOG ${catlid}/${catlpw}@${ORACLE_CATL} ;&lt;br /&gt;RESYNC CATALOG;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;rmanstatus=$?&lt;br /&gt;&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;if [ ! -e &amp;nbsp;$EMAIL_INFO_FILE ]&lt;br /&gt;then&lt;br /&gt;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script failed in the resync step for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;grep -i 'RMAN-' &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'ORA-' &amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'sbt' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'tsm' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;exit 12&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;echo -------------------------------------------------------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_bkup_arch.ksh completed ---------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script completed successfully for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $LOGARCFILE&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for&lt;br /&gt;## this ORACLE_SID to run&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;&lt;br /&gt;## ---------------------------------------------------------------------&lt;br /&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End of rman_bkup_arch.ksh&lt;br /&gt;## ---------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7776324022650356403?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7776324022650356403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanbkuparchksh-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7776324022650356403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7776324022650356403'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanbkuparchksh-file.html' title='sample rman_bkup_arch.ksh file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7716877213693568577</id><published>2010-03-08T19:55:00.000-08:00</published><updated>2010-03-08T19:55:07.274-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>Sample rman backup script that uses catalog</title><content type='html'>#!/bin/ksh&lt;br /&gt;&lt;br /&gt;## ---------------------------------------------------------------------&lt;br /&gt;## script name : rman_bkup.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## This script backsup the data files, archived log files and control&lt;br /&gt;## file and spfile. It takes ORACLE_SID as an argument and backs up the&lt;br /&gt;## files for the specified ORACLE_SID&lt;br /&gt;## This script uses rman catalog.&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## ---------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;. ~/.profile&lt;br /&gt;##&lt;br /&gt;## Source the rman user ids and passwords from rmanids.sh&lt;br /&gt;##&lt;br /&gt;. /apps/oracle/admin/rman/rmanids.sh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;echo&lt;br /&gt;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;echo&lt;br /&gt;echo Usage: $0 ORACLE_SID&lt;br /&gt;echo&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;&lt;br /&gt;LOG_DIR="/apps/oracle/admin/rman"&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;EMAIL_INFO_FILE="${LOG_DIR}/${ORACLE_SID}_email.cfg"&lt;br /&gt;SENDER="rman@`hostname"&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the logs&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The LOGARCFILE will have the cumulative log&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.log"&lt;br /&gt;LOGARCFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.log.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the errors&lt;br /&gt;## The EMAILFILE will have errors if any from just the latest run&lt;br /&gt;## The EMAILARCFILE will have the cumulative errors&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;EMAILFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.email"&lt;br /&gt;EMAILARCFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.email.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;echo --------------------------------------------------------- &amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_bkup.ksh started ------------------ &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [ &amp;nbsp;-e &amp;nbsp;$LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;echo "$LOCKFILE exists. Will check again after 3 minutes" &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;nbsp;&amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;sleep 180&lt;br /&gt;&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create a lock file&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;break&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;echo $ORACLE_SID &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;whoami &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;which rman &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Backup database and archive logs&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rman &amp;lt;&amp;lt;EOF &amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;CONNECT TARGET ${rmanid}/${rmanpw} ;&lt;br /&gt;&lt;br /&gt;SHOW ALL ;&lt;br /&gt;&lt;br /&gt;BACKUP DATABASE FILESPERSET 1 ;&lt;br /&gt;BACKUP ARCHIVELOG ALL DELETE INPUT;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt PARALLELISM 4 ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt&lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'&lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT TO '%F';&lt;br /&gt;&lt;br /&gt;BACKUP DEVICE TYPE SBT BACKUPSET ALL ;&lt;br /&gt;DELETE NOPROMPT OBSOLETE&lt;br /&gt;RECOVERY WINDOW OF 15 DAYS&lt;br /&gt;DEVICE TYPE &amp;nbsp;SBT ;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt clear ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt clear ;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT CLEAR ;&lt;br /&gt;&lt;br /&gt;DELETE NOPROMPT OBSOLETE REDUNDANCY = 3 DEVICE TYPE = DISK ;&lt;br /&gt;&lt;br /&gt;REPORT SCHEMA ;&lt;br /&gt;REPORT UNRECOVERABLE ;&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;rmanstatus=$?&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Check rman exit status and email incase of a failure&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;if [ ! -e &amp;nbsp;$EMAIL_INFO_FILE ]&lt;br /&gt;then&lt;br /&gt;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script failed in the backup step for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;grep -i 'RMAN-' &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'ORA-' &amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'sbt' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'tsm' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;exit 12&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## sync up the rman catalog&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rman &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;CONNECT TARGET ${rmanid}/${rmanpw} ;&lt;br /&gt;CONNECT CATALOG ${catlid}/${catlpw}@${ORACLE_CATL} ;&lt;br /&gt;RESYNC CATALOG;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;rmanstatus=$?&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Check rman exit status and email in case of a failure&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;if [ ! -e &amp;nbsp;$EMAIL_INFO_FILE ]&lt;br /&gt;then&lt;br /&gt;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script failed in the resync step for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;nbsp;"before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;grep -i 'RMAN-' &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'ORA-' &amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'sbt' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;grep -i 'tsm' &amp;nbsp; &amp;nbsp;$LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;exit 12&lt;br /&gt;fi&lt;br /&gt;echo --------------------------------------------------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_bkup.ksh completed ---------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script completed successfully for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $LOGARCFILE&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for&lt;br /&gt;## this ORACLE_SID to run&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;&lt;br /&gt;## --------------------------------------------------------------------&lt;br /&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End of &amp;nbsp;rman_bkup.ksh&lt;br /&gt;## --------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7716877213693568577?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7716877213693568577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rman-backup-script-that-uses.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7716877213693568577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7716877213693568577'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rman-backup-script-that-uses.html' title='Sample rman backup script that uses catalog'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6960413232937717968</id><published>2010-03-08T19:54:00.001-08:00</published><updated>2010-03-08T19:54:15.418-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>sample rmanids.sh file</title><content type='html'>#!/bin/ksh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Script Name: rmanids.sh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## This script is sourced from in other KSH scripts&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## set your rman id and password below&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;export rmanid=yourrmanid&lt;br /&gt;export rmanpw=yourrmanpassword&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## set your rman catalog id and password below&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;export catlid=yourcatalogid&lt;br /&gt;export catlpw=yourcatalogpassword&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## set your rman catalog database sid&lt;br /&gt;##&lt;br /&gt;export ORACLE_CATL=oem10gx.world&lt;br /&gt;export NLS_LANG="american_america.us7ascii"&lt;br /&gt;export NLS_DATE_FORMAT="Mon DD YYYY HH24:MI:SS"&lt;br /&gt;&lt;br /&gt;## ------------------------------------------------------------------------------&lt;br /&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; End of rmanids.sh&lt;br /&gt;## ------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6960413232937717968?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6960413232937717968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanidssh-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6960413232937717968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6960413232937717968'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanidssh-file.html' title='sample rmanids.sh file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-5499467924373870924</id><published>2010-03-08T19:53:00.000-08:00</published><updated>2010-03-08T19:53:25.270-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>sample rman_config.ksh file</title><content type='html'>#!/bin/ksh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Script Name: rman_config.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Set your rman &amp;amp; shell environment using this script&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;echo&lt;br /&gt;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;echo&lt;br /&gt;echo Usage: $0 ORACLE_SID&lt;br /&gt;echo&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;LOG_DIR="."&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [ &amp;nbsp;-e &amp;nbsp;$LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;sleep 80&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create the lock file&lt;br /&gt;##&lt;br /&gt;echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;break&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The ARCFILE will have cumulative log&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;## LOGFILE="${LOG_DIR}/rman_config_$CURR_DATE.$ORACLE_SID.log"&lt;br /&gt;&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_config.$ORACLE_SID.log"&lt;br /&gt;ARCFILE="${LOG_DIR}/rman_config.$ORACLE_SID.arc"&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Run rman config commands&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rman &amp;lt;&amp;lt;EOF &amp;nbsp;&amp;gt; $LOGFILE&lt;br /&gt;connect target / ;&lt;br /&gt;&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 7 ;&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP&lt;br /&gt;FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK ;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET ;&lt;br /&gt;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt PARALLELISM 4 BACKUP TYPE TO BACKUPSET ;&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $ARCFILE&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for&lt;br /&gt;## this ORACLE_SID to run&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;&lt;br /&gt;## -------------------------------------------------------------------------------&lt;br /&gt;## End of &amp;nbsp;rman_config.ksh&lt;br /&gt;## -------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-5499467924373870924?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/5499467924373870924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanconfigksh-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/5499467924373870924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/5499467924373870924'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanconfigksh-file.html' title='sample rman_config.ksh file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6123322610428739738</id><published>2010-03-08T19:51:00.000-08:00</published><updated>2010-03-08T19:51:57.432-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts catalog'/><title type='text'>sample rman_register_db.ksh file</title><content type='html'>#!/bin/ksh&lt;br /&gt;##&lt;br /&gt;## Script Name: rman_register_db.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Register a given database with rman catalog&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;. ~/.profile&lt;br /&gt;. ./rmanids.sh&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;echo&lt;br /&gt;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;echo&lt;br /&gt;echo Usage: $0 ORACLE_SID&lt;br /&gt;echo&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;rman &amp;lt;&amp;lt; EOF&lt;br /&gt;connect target ${rmanid}/${rmanpw} ;&lt;br /&gt;connect catalog ${catlid}/${catlpw}@${ORACLE_CATL} ;&lt;br /&gt;Register database;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;export rman_rtnval=$?&lt;br /&gt;echo $rman_rtnval&lt;br /&gt;if [[ $rman_rtnval = 0 ]]&lt;br /&gt;then&lt;br /&gt;echo $ORACLE_SID successfully registered with rman catalog&lt;br /&gt;else&lt;br /&gt;echo $ORACLE_SID could not be registered with rman catalog&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;## -------------------------------------------------------------------------------&lt;br /&gt;## End of &amp;nbsp;rman_register_db.ksh&lt;br /&gt;## -------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6123322610428739738?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6123322610428739738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanregisterdbksh-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6123322610428739738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6123322610428739738'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2010/03/sample-rmanregisterdbksh-file.html' title='sample rman_register_db.ksh file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-2921076523061873221</id><published>2007-11-04T15:25:00.000-08:00</published><updated>2008-10-25T15:33:07.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Teradata'/><title type='text'>Teradata Dignostics commands</title><content type='html'>&lt;div align="justify"&gt;Diagnostic commands are undocumented features of Teradata. These commands come in handy to DBAs when dignosing performance problems. I use a couple of the Diagnostic commands regularly in troubleshooting&amp;nbsp; performance issues. &lt;/div&gt;&lt;br /&gt;&lt;strong&gt;DIAGNOSTIC VERBOSEEXPLAIN ON FOR SESSION;&amp;nbsp; &lt;/strong&gt;&lt;br /&gt;The above command makes Teradata to include additional&amp;nbsp; info in the output of an &lt;strong&gt;explain&lt;/strong&gt; command.&amp;nbsp; The output from all subsequent &lt;strong&gt;explain&lt;/strong&gt; commands &lt;br /&gt;&lt;ul&gt;&lt;li&gt;qualify Spool File on join columns in the explain output&lt;/li&gt;&lt;li&gt;specify hash distribution column names for spool files.&lt;/li&gt;&lt;/ul&gt;To turn off additional information in the output of the explain command just issue the following command.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DIAGNOSTIC VERBOSEEXPLAIN NOT ON FOR SESSION;&amp;nbsp; &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Below is another command that is quite helpful&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DIAGNOSTIC HELPSTATS ON FOR SESSION;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The above command makes Teradata to include the collect statistics possibilities in the ouput of expplain command&lt;br /&gt;&lt;br /&gt;To turn off collect statistics possibilities in the output of the explain command just issue the following command.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DIAGNOSTIC HELPSTATS NOT ON FOR SESSION;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-2921076523061873221?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/2921076523061873221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/11/teradata-dignostics-commands.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/2921076523061873221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/2921076523061873221'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/11/teradata-dignostics-commands.html' title='Teradata Dignostics commands'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6192058856112632140</id><published>2007-11-04T14:19:00.000-08:00</published><updated>2008-10-25T15:35:48.433-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='Teradata'/><title type='text'>An Introduction to Teradata components</title><content type='html'>&lt;div align="justify"&gt;Teradata is a relational database management system. A Teradata system has many components (hardware and software). A Teradata system contains one or more nodes. A node is a term for a general-purpose processing unit under the control of a single operating system. The basic building block for a Teradata system, the node is where the processing occurs for the database. &lt;/div&gt;&lt;div align="justify"&gt;A node contains a large number of hardware and software components as explained below…&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;PDE&lt;br /&gt;&lt;/strong&gt;The PDE (Parallel Database Extensions) software layer runs the operating system on each node. It was created by NCR to support the parallel environment.&lt;br /&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;System Disks&lt;br /&gt;&lt;/strong&gt;System disks are contained on the node used for the following:&lt;br /&gt;•&amp;nbsp;Operating system software&lt;br /&gt;•&amp;nbsp;Teradata software &lt;br /&gt;•&amp;nbsp;Application software &lt;br /&gt;•&amp;nbsp;System dump space &lt;br /&gt;Teradata database tables are stored on disk arrays, not on the system disks.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Memory&lt;br /&gt;&lt;/strong&gt;Vprocs share a free memory pool within a node. A segment of memory is allocated to a vproc for its use, then returned to the memory pool for use by another vproc. The free memory pool is a collection of memory available to the node. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Application&lt;br /&gt;&lt;/strong&gt;An application is software that accesses the Teradata RDBMS. It can run on various platforms: &lt;br /&gt;•&amp;nbsp;Channel-attached client &lt;br /&gt;•&amp;nbsp;LAN-attached client &lt;br /&gt;•&amp;nbsp;Node &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Vproc&lt;br /&gt;&lt;/strong&gt;A virtual processor or a vproc is a group of one or more software processes running under the operating system's multi-tasking environment:&lt;br /&gt;•&amp;nbsp;On the UNIX operating system, a vproc is a collection of software processes.&lt;br /&gt;•&amp;nbsp;On the Windows operating systems, a vproc is a single software process.&lt;/div&gt;&lt;div align="justify"&gt;The two types of Teradata vprocs are:&lt;br /&gt;•&amp;nbsp;AMP (Access Module Processor) &lt;br /&gt;•&amp;nbsp;PE (Parsing Engine) &lt;/div&gt;&lt;div align="justify"&gt;When vprocs communicate, they use BYNET hardware (on MPP systems), BYNET software, and PDE. The BYNET hardware and software carry vproc messages to and from a particular node. Within a node, the BYNET and PDE software deliver messages to and from the participating vprocs. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;PE&lt;br /&gt;&lt;/strong&gt;PEs (Parsing Engines) are vprocs that receive SQL requests from the client and break the requests into steps. The PEs send the steps to the AMPs and subsequently return the answer to the client.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;AMP&lt;br /&gt;&lt;/strong&gt;AMPs (Access Module Processors) are virtual processors (vprocs) that receive steps from PEs (Parsing Engines) and perform database functions to retrieve or update data. Each AMP is associated with one virtual disk (vdisk), where the data is stored. An AMP manages only its own vdisk, not the vdisk of any other AMP. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Vdisk (Virtual Disk)&lt;br /&gt;&lt;/strong&gt;A vdisk&amp;nbsp; is the logical disk space that is managed by an AMP. Depending on the configuration, a vdisk may not be contained on the node; however, it is managed by an AMP, which is always a part of the node.&lt;br /&gt;The vdisk is made up of 1 to 64 pdisks (user slices in UNIX or partitions in Windows NT, whose size and configuration vary based on RAID level). The pdisks logically combine to comprise the AMP's vdisk. Although an AMP can manage up to 64 pdisks, it controls only one vdisk. An AMP manages only its own vdisk, not the vdisk of any other AMP. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Channel Driver &lt;br /&gt;&lt;/strong&gt;Channel driver software is the means of communication between the PEs and applications running on channel-attached (mainframe) clients.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Gateway &lt;br /&gt;&lt;/strong&gt;The Teradata Gateway software is the means of communication between the PEs and applications running on a LAN-attached clients&amp;nbsp; or A node in the system &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;BYNET&lt;br /&gt;&lt;/strong&gt;The BYNET (banyan network) is a combination of hardware and software that provides high performance networking between the nodes of a Teradata system. A dual-redundant, bi-directional, multi-staged network, the BYNET enables the nodes to communicate in a high speed, loosely-coupled fashion. It is based on banyan topology, a mathematically defined structure that has branches reminiscent of a banyan tree.&lt;br /&gt;The BYNET is a high-speed interconnect (network) that enables multiple nodes in the system to communicate.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The BYNET hardware and software handle the communication between the vprocs. &lt;br /&gt;•&amp;nbsp;Hardware: The nodes of an MPP system are connected with the BYNET hardware, consisting of BYNET boards and cables. &lt;br /&gt;•&amp;nbsp;Software: The BYNET software is installed on every node. This BYNET driver is an interface between the &lt;br /&gt;PDE software and the BYNET hardware. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;SMP systems do not contain BYNET hardware. The PDE and BYNET software emulates BYNET activity in a single-node environment. The SMP implementation is sometimes called "boardless BYNET." &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;Teradata uses different types of messages for the highest efficiency: &lt;br /&gt;•&amp;nbsp;Broadcast: BYNET hardware delivers a message to all nodes in an MPP system. This is simulated in SMP systems using BYNET software. A single broadcast message consumes more BYNET bandwidth than a single point-to-point message, but sometimes a broadcast may be the most efficient for processing.&lt;br /&gt;•&amp;nbsp;Point-to-Point: A single message to a single vproc is carried over BYNET hardware to the destination node, and relayed to or from a particular vproc using PDE software. Point-to-point messages enable the BYNET to be scalable because as the system grows, the capacity to handle point-to-point messages also grows.&lt;br /&gt;•&amp;nbsp;Multicast: A message can be sent to several vprocs (multicast). The BYNET hardware first sends a broadcast message to all nodes. The PDE software on the receiving nodes determines which vprocs should receive the message and delivers it to those vprocs. Multicast messages give the system yet another method to deliver messages for the best performance&lt;br /&gt;&lt;br /&gt;A Teradata node requires three distinct pieces of software.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Operating System :&amp;nbsp; &lt;br /&gt;&lt;/strong&gt;UNIX or Windows. Or Linux&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;The Parallel Database Extensions (PDE) :&lt;br /&gt;&lt;/strong&gt;The Parallel Database Extensions (PDE) software layer was added to the operating system by NCR to support the parallel software environment.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Teradata RDBMS aka Trusted Parallel Application (TPA)&lt;br /&gt;&lt;/strong&gt;A Trusted Parallel Application (TPA) uses PDE to implement virtual processors (vprocs). The Teradata RDBMS is classified as a TPA. The four components of the Teradata TPA are: &lt;br /&gt;•&amp;nbsp;AMP &lt;br /&gt;•&amp;nbsp;PE &lt;br /&gt;•&amp;nbsp;Channel Driver &lt;br /&gt;•&amp;nbsp;Teradata Gateway &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Access Module Processor (AMP)&lt;br /&gt;&lt;/strong&gt;AMPs (Access Module Processors) are virtual processors (vprocs) that receive steps from PEs (Parsing Engines) and perform database functions to retrieve or update data&lt;br /&gt;AMP Worker Task Functions&lt;br /&gt;The AWT functions in the AMP perform a number of operations, including: &lt;br /&gt;•&amp;nbsp;Locking tables to ensure data consistency. &lt;br /&gt;•&amp;nbsp;Executing AMP step operations such as select, insert, update, delete and sort. &lt;br /&gt;•&amp;nbsp;Joining tables as required. &lt;br /&gt;•&amp;nbsp;Executing end transaction steps as required to support multi-AMP operations. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;AMP File System&lt;br /&gt;&lt;/strong&gt;The file system software accesses the data on the virtual disks. Each AMP uses the file system software to read from and write to the virtual disks.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;AMP Console Utilities&lt;br /&gt;&lt;/strong&gt;The AMP software includes utilities to perform systems management functions such as:&lt;br /&gt;•&amp;nbsp;Configure and reconfigure the system &lt;br /&gt;•&amp;nbsp;Rebuild tables &lt;br /&gt;•&amp;nbsp;Reveal details about locks and space status &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Parsing Engine (PE)&lt;br /&gt;&lt;/strong&gt;PEs (Parsing Engines) are vprocs that receive SQL requests from the client and break the requests into steps. The PEs send the steps to the AMPs and subsequently return the answer to the client.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;PE Session Control&amp;nbsp; &lt;br /&gt;&lt;/strong&gt;When you log on to the Teradata RDBMS through your application, the session control software&lt;br /&gt;on the PE establishes that session. Session control also manages and terminates sessions on that PE. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;PE Parser/Optimizer&lt;br /&gt;&lt;/strong&gt;The Parser interprets an incoming Teradata SQL request and checks the syntax. The Parser decomposes the request into AMP steps, using the Optimizer to determine the most efficient way to access the data on the virtual disks (vdisks). &lt;br /&gt;The Optimizer develops the "least expensive" plan (in terms of time and system resources) to return the requested response set. Processing alternatives are evaluated, and the fastest alternative is chosen. The selected alternative is converted to executable steps that will performed by the AMPs. Then, the Parser sends the steps to the dispatcher. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;PE Dispatcher&lt;br /&gt;&lt;/strong&gt;The dispatcher is responsible for a number of tasks, depending on the operation it is performing: &lt;br /&gt;•&amp;nbsp;Processing Requests: Controls the sequence in which the steps are executed and passes the steps to the AMPs through the BYNET. &lt;br /&gt;•&amp;nbsp;Processing Responses: After the AMPs process the steps, the dispatcher builds a response message and sends the response back to the user.&amp;nbsp;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Channel Driver &lt;br /&gt;&lt;/strong&gt;Channel Driver software is the means of communication between an application and the PEs assigned to channel-attached clients. There is one Channel Driver per node. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Teradata Gateway&lt;br /&gt;&lt;/strong&gt;Teradata Gateway software is the means of communication between an application and the PEs assigned to network-attached clients. There is one Teradata Gateway per node.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;User Access&lt;br /&gt;&lt;/strong&gt;Clients communicate with the Teradata RDBMS in three ways: &lt;br /&gt;•&amp;nbsp;Channel &lt;br /&gt;•&amp;nbsp;Network&lt;br /&gt;•&amp;nbsp;Node&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Channel&lt;br /&gt;&lt;/strong&gt;Communication from applications on the mainframe goes through the Channel Driver.&lt;br /&gt;Traffic and communications between client applications on the mainframe and the Teradata database are managed by the Teradata Director Program (TDP) software.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Network&lt;br /&gt;&lt;/strong&gt;Communication from applications on a network-attached client goes through the Teradata Gateway.&lt;br /&gt;Traffic and communication between network-attached client applications and the Teradata database are managed by either: ODBC or CLIv2.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;Node &lt;br /&gt;&lt;/strong&gt;If you install application software on a node, it will be treated like an application on a network-attached client. In other words, communications from applications on the node go through the Teradata Gateway. &lt;/div&gt;&lt;div align="justify"&gt;To summarize, users can access data in the Teradata RDBMS through an application on both channel-attached and network-attached clients. Additionally, the node itself can act as a client. Teradata client software is installed on each client (channel-attached, network-attached, or node) and communicates with RDBMS software on the node. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Primary Indexes &lt;br /&gt;&lt;/strong&gt;The Teradata Database distributes the data in each table&amp;nbsp; across all AMPs on a system.&amp;nbsp; Since each amp is responsible for managing it’s own vdisk, it effectively means distributing data across disks automatically. This is one of the major differences between Teradata and other RDBMSs &lt;/div&gt;&lt;div align="justify"&gt;Teradata assigns rows to AMPs based on the value of their primary index. The determination of which hash bucket, and hence which AMP the row is to be stored on, is made solely on the row hash value of its primary index. Each Teradata Database table must have a primary index.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6192058856112632140?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6192058856112632140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/11/introduction-to-teradata-components.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6192058856112632140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6192058856112632140'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/11/introduction-to-teradata-components.html' title='An Introduction to Teradata components'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-2588337700439098065</id><published>2007-07-03T12:17:00.000-07:00</published><updated>2008-10-25T10:50:06.327-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>RMAN Disaster Recovery script (rman_dr.ksh)</title><content type='html'>This script is intended to provide a mechanism for disaster recovery. Output log of this script is given as another entry&amp;nbsp; which you can check&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;br /&gt;##&lt;br /&gt;## script name : rman_dr.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;## &lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring the complete database from tape. This could be used&lt;br /&gt;## after a disaster to do a disaster recovery. It assumes that a new unix box has &lt;br /&gt;## been set up and Oracle software has been installed and all the directory structures&lt;br /&gt;## have been restored by the UNIX admins. This script does not use rman recovery catalog.&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You have to replace the DBID value with the DBID that you are attempting to restore and recover&lt;br /&gt;## You need to login as a unix user id that belongs to the dba group and run this script&lt;br /&gt;## I have tested this script only on Oracle 10g on an IBM AIX platform. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;br /&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./cmad_dr.log&lt;br /&gt;CONNECT TARGET /&lt;br /&gt;STARTUP FORCE NOMOUNT;&lt;br /&gt;##&lt;br /&gt;## set dbid because we are not using an rman recovery catalog&lt;br /&gt;##&lt;br /&gt;SET DBID 1522268517 ;&lt;br /&gt;##&lt;br /&gt;## Specify AUTOBACKUP Format&lt;br /&gt;##&lt;br /&gt;SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';&lt;br /&gt;##&lt;br /&gt;## Restore spfile from autobackup first&lt;br /&gt;##&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt &lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' &lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;RESTORE SPFILE FROM AUTOBACKUP&amp;nbsp; ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Restart the database with newly restored SPFILE&lt;br /&gt;##&lt;br /&gt;SHUTDOWN IMMEDIATE;&lt;br /&gt;STARTUP NOMOUNT;&lt;br /&gt;##&lt;br /&gt;## Now restore controlfile from autobackup &lt;br /&gt;##&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt &lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' &lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;RESTORE CONTROLFILE FROM AUTOBACKUP ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Mount the database, restore and recover&lt;br /&gt;##&lt;br /&gt;ALTER DATABASE MOUNT ;&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt &lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' &lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;RESTORE DATABASE&amp;nbsp; ;&lt;br /&gt;RECOVER DATABASE&amp;nbsp; ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Open the database, if restore and recover are successful&lt;br /&gt;##&lt;br /&gt;EOF&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-2588337700439098065?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/2588337700439098065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/07/rman-disaster-recovery-script-rmandrksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/2588337700439098065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/2588337700439098065'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/07/rman-disaster-recovery-script-rmandrksh.html' title='RMAN Disaster Recovery script (rman_dr.ksh)'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-342375988038380988</id><published>2007-07-01T05:42:00.000-07:00</published><updated>2008-10-25T11:35:38.539-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Developer'/><title type='text'>SQL Tutorial for the beginners</title><content type='html'>This tutorial is aimed at giving a beginner a brief introduction to the Structured Query Language or SQL and get you started with using sqlplus to log on to Oracle and access and manipulate data.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Give below is what you learn and can expect to be able to do after attending this tutorial…&lt;br /&gt;•&amp;nbsp;Brief history and overview of SQL&lt;br /&gt;•&amp;nbsp;Set-up environment variables to invoke sqlplus and log on to a Oracle database from a reflection session&lt;br /&gt;•&amp;nbsp;Execute basic SQL queries&lt;br /&gt;•&amp;nbsp;Get all the data in a table&lt;br /&gt;•&amp;nbsp;Get named columns from a table &lt;br /&gt;•&amp;nbsp;Get named columns from a table and order them&lt;br /&gt;•&amp;nbsp;Perform arithmetic on column values&lt;br /&gt;•&amp;nbsp;Prevent duplicate row selection&lt;br /&gt;•&amp;nbsp;Selecting only data that meets a criteria with the WHERE clause&lt;br /&gt;•&amp;nbsp;SQL operators in WHERE clauses&lt;br /&gt;•&amp;nbsp;Multiple condition WHERE clauses&lt;br /&gt;•&amp;nbsp;Group Functions&lt;br /&gt;•&amp;nbsp;Sub-queries&lt;br /&gt;•&amp;nbsp;Select data from multiple tables&lt;br /&gt;•&amp;nbsp;Execute basic SQL DML commands&lt;br /&gt;•&amp;nbsp;Insert&lt;br /&gt;•&amp;nbsp;Update&lt;br /&gt;•&amp;nbsp;Delete&lt;br /&gt;•&amp;nbsp;Use basic DDL commands&lt;br /&gt;•&amp;nbsp;create table&lt;br /&gt;•&amp;nbsp;alter table&lt;br /&gt;•&amp;nbsp;create index&lt;br /&gt;•&amp;nbsp;truncate table&lt;br /&gt;•&amp;nbsp;drop table&lt;br /&gt;•&amp;nbsp;Use basic access control commands&lt;br /&gt;•&amp;nbsp;grant&lt;br /&gt;•&amp;nbsp;revoke&lt;br /&gt;•&amp;nbsp;Modify sqlplus environment&lt;br /&gt;•&amp;nbsp;Write and execute small SQL scripts&lt;br /&gt;&lt;br /&gt;Structured Query Language&lt;br /&gt;&lt;br /&gt;Structured Query Language or SQL was originally developed by IBM for its System/R Project. IBM later used it in its products SQL/Data System (SQL/DS) and Database 2 (DB2). SQL today became a language of choice to access the data and structures within a relational database and is implemented and supported by most commercially available Relational Database Management System vendors. &lt;br /&gt;SQL was designed to be an English like language using English phrases to manipulate the database. It is non procedural. You specify what you want done but not how to do it. The how part is taken care of by the RDBMS. Each RDBMS has an in-built query optimizer which parses your SQL statements and works out the best path to retrieve/manipulate the data. &lt;br /&gt;SQL is designed to be used by a wide spectrum of users- DBA's, application developers, operators&amp;nbsp; and end users.&lt;br /&gt;It provides commands to do the following …&lt;br /&gt;•&amp;nbsp;finding (querying) data&lt;br /&gt;•&amp;nbsp;inserting, updating and deleting data&lt;br /&gt;•&amp;nbsp;creating, modifying and deleting database objects&lt;br /&gt;•&amp;nbsp;controlling access to the database and database objects&lt;br /&gt;•&amp;nbsp;Transaction Control&lt;br /&gt;The different SQL statements could be&amp;nbsp; grouped into 4 different categories as explained below…&lt;br /&gt;DATA QUERY LANGUAGE (DQL) -&amp;nbsp; SQL statements&amp;nbsp; to retrieve data from the database and transform it.&amp;nbsp;&amp;nbsp; SELECT statement falls into this category.&lt;br /&gt;DATA MANIPULATION LANGUAGE (DML) - SQL statements to insert, change or delete data from the database. DELETE, INSERT, UPDATE&amp;nbsp;&amp;nbsp; statements&amp;nbsp; fall into this category.&lt;br /&gt;DATA DEFINITION LANGUAGE&amp;nbsp; (DDL) - SQL statements to define or alter database structures. DROP, TRUNCATE, CREATE, ALTER&amp;nbsp; statements&amp;nbsp; fall into this category.&lt;br /&gt;Access Control - SQL statements to either grant or revoke privileges to access and manipulate&amp;nbsp; database objects.&amp;nbsp; &lt;br /&gt;REVOKE, GRANT statements&amp;nbsp; fall into this category.&lt;br /&gt;Transaction Control - SQL statements that commit or rollback changes to data.&lt;br /&gt;COMMIT, ROLLBACK statements fall into this category.&lt;br /&gt;To connect to an oracle database and execute sql commands you can use an oracle supplied tool called sqlplus. &lt;br /&gt;&lt;br /&gt;Environment set-up for invoking sqlplus and connect to an Oracle&amp;nbsp; database&lt;br /&gt;Add the following lines to your .profile after you login to your unix environment. After adding the following lines log out and log back in to make sure that the .profile is run.&lt;br /&gt;# Replace with the path at your installation&lt;br /&gt;export ORACLE_HOME=/oracle/product/8.1.7&lt;br /&gt;# Replace with sid name at your installation&lt;br /&gt;ORACLE_SID=xyz&lt;br /&gt;export ORACLE_SID&lt;br /&gt;LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib&lt;br /&gt;export LD_LIBRARY_PATH&lt;br /&gt;LIBPATH=$LIBPATH:/usr/lib:$ORACLE_HOME/lib&lt;br /&gt;export LIBPATH&lt;br /&gt;PATH=$PATH:$ORACLE_HOME/bin&lt;br /&gt;export PATH&lt;br /&gt;The above lines set-up paths for oracle binaries and libraries.&lt;br /&gt;The ORACLE_SID environment variable identifies the database that you would connect to when you invoke sqlplus. In our case we would be connecting to a database named stgt.&lt;br /&gt;After setting up the environment you can invoke sqlplus by entering sqlplus at your unix prompt as shown below. Enter your username and password when prompted. You will get SQL prompt if you login successfully. You can then enter and execute all your sql commands at the SQL prompt.&lt;br /&gt;$ sqlplus&lt;br /&gt;SQL*Plus: Release 8.1.7.0.0 - Production on Mon Aug 26 11:33:41 2002&lt;br /&gt;(c) Copyright 2000 Oracle Corporation.&amp;nbsp; All rights reserved.&lt;br /&gt;Enter user-name: rnemani&lt;br /&gt;Enter password: &lt;br /&gt;Connected to:&lt;br /&gt;Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production&lt;br /&gt;With the Partitioning option&lt;br /&gt;JServer Release 8.1.7.4.0 - Production&lt;br /&gt;SQL&amp;gt;&lt;br /&gt;If you want to terminate your sqlplus session you simply enter exit at your SQL prompt as shown below…&lt;br /&gt;SQL&amp;gt; exit&lt;br /&gt;Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production&lt;br /&gt;With the Partitioning option&lt;br /&gt;JServer Release 8.1.7.4.0 – Production&lt;br /&gt;$ &lt;br /&gt;&lt;br /&gt;DATA QUERY LANGUAGE (DQL)&lt;br /&gt;The SELECT statement is the most widely used command of SQL. It allows you to retrieve the data from the database. Most SQL statements will need a semi-colon ";" to indicate the end of the statement.&lt;br /&gt;Get all the data&amp;nbsp; in a table&lt;br /&gt;Select * from price_list ;&lt;br /&gt;Gets all the columns and all the rows in the table.&lt;br /&gt;Get named columns from a table &lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price, price_list_price&lt;br /&gt;From price_list ;&lt;br /&gt;Get named columns from a table and order them&lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price&lt;br /&gt;From price_list &lt;br /&gt;Order by division_no, article_nbr ;&lt;br /&gt;Perform arithmetic on column values&lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price, price_list_price*0.05&lt;br /&gt;From price_list ;&lt;br /&gt;Preventing duplicate row selection&lt;br /&gt;Select&amp;nbsp; distinct division_no From price_list ;&lt;br /&gt;Selecting only data that meets a criteria&amp;nbsp; with the WHERE clause&lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price&lt;br /&gt;From price_list &lt;br /&gt;Where division_no = 72 ;&lt;br /&gt;SQL operators in WHERE clauses&lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price&lt;br /&gt;From price_list &lt;br /&gt;Where division_no in&amp;nbsp; (71, 72)&amp;nbsp; ;&lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price&lt;br /&gt;From price_list &lt;br /&gt;Where price_list_price &amp;gt; 100 ;&lt;br /&gt;Select&amp;nbsp; division_no, article_nbr, price_list_price&lt;br /&gt;From price_list &lt;br /&gt;Where division_no&amp;nbsp; not in&amp;nbsp; (71, 72)&amp;nbsp; ;&lt;br /&gt;select * from division&lt;br /&gt;where division_desc like 'T%' ;&lt;br /&gt;Multiple condition WHERE clauses&lt;br /&gt;Select * from price_list&lt;br /&gt;Where division_no = 93&lt;br /&gt;And basis_company_id = 66 ;&lt;br /&gt;Select * from price_list&lt;br /&gt;Where division_no = 93&lt;br /&gt;or price_list_price &amp;gt; 100 ;&lt;br /&gt;Group Functions&lt;br /&gt;Select count(*) from price_list ;&lt;br /&gt;Select max(price_list_price)&lt;br /&gt;From price_list ;&lt;br /&gt;Select avg(price_list_price)&lt;br /&gt;From price_list ;&lt;br /&gt;Select division_no, count(*) &lt;br /&gt;from price_list &lt;br /&gt;group by division_no ;&lt;br /&gt;Select division_no, max(price_list_price), min(price_list_price)&lt;br /&gt;from price_list &lt;br /&gt;group by division_no ;&lt;br /&gt;Select division_no, max(price_list_price), min(price_list_price)&lt;br /&gt;from price_list &lt;br /&gt;group by division_no &lt;br /&gt;having min(price_list_price) &amp;gt; 10 ;&lt;br /&gt;Select division_no, basis_company_id, count(*) &lt;br /&gt;from price_list &lt;br /&gt;group by division_no, basis_company_id ;&lt;br /&gt;Selecting data from multiple tables (Join)&lt;br /&gt;Select division_desc, outlet_name&lt;br /&gt;From division a , outlet b&lt;br /&gt;Where a.division_no = b.division_no ;&lt;br /&gt;Select division_desc, outlet_name&lt;br /&gt;From division a, outlet b&lt;br /&gt;Where a.division_no = b.division_no&lt;br /&gt;And a.division_no = 51 ;&lt;br /&gt;Sub-queries&lt;br /&gt;Select count(*) from price_list &lt;br /&gt;Where division_no in ( &lt;br /&gt;select division_no from division where price_group_user = 'Y'&lt;br /&gt;) ;&lt;br /&gt;Select count(*) from price_list &lt;br /&gt;Where division_no not in ( &lt;br /&gt;select division_no from division where price_group_user = 'Y'&lt;br /&gt;) &lt;br /&gt;;&lt;br /&gt;Select count(*) from price_list&amp;nbsp; a&lt;br /&gt;Where exists in ( &lt;br /&gt;select division_no &lt;br /&gt;from division b &lt;br /&gt;where b.price_group_user = 'Y'&lt;br /&gt;and b.division_no = a.division_no&lt;br /&gt;) &lt;br /&gt;;&lt;br /&gt;Select count(*) from price_list&amp;nbsp; a&lt;br /&gt;Where not exists in ( &lt;br /&gt;select division_no &lt;br /&gt;from division b &lt;br /&gt;where b.price_group_user = 'Y'&lt;br /&gt;and b.division_no = a.division_no&lt;br /&gt;) &lt;br /&gt;;&lt;br /&gt;DATA MANIPULATION LANGUAGE (DML)&lt;br /&gt;In order for us to be able to retrieve data from tables we need to first have them populated and properly maintained so that they contain the relevant data. This is exactly what the DML commands are used for.&lt;br /&gt;INSERT&lt;br /&gt;Insert command is used for inserting new data into a table.&lt;br /&gt;insert into division&lt;br /&gt;values (98, 'This is a New Dvsn','Y','Y','N')&lt;br /&gt;;&lt;br /&gt;The above statement will create a new row .&lt;br /&gt;insert into division&lt;br /&gt;(division_no,division_desc)&lt;br /&gt;values (98, 'This is a New Dvsn') ;&lt;br /&gt;The above statement will create a new row but with only division_no and division_desc columns populated with values and other columns set to NULL.&lt;br /&gt;Insert into new_division_table&lt;br /&gt;Select * from division ;&lt;br /&gt;The above statement Inserts rows from division table into new_division_table table (provided the structure of new_division_table table is identical to the structure of division table).&lt;br /&gt;You have to issue a commit statement if you want the data to be saved in the table permanently. Alternatively you can issue a rollback, if you do not want your changes to be saved to the database.&lt;br /&gt;A commit or a rollback command should always be issued to commit or rollback a transaction. A transaction could be made up of one or more DML commands.&lt;br /&gt;A commit statement looks as follows …&lt;br /&gt;Commit ;&lt;br /&gt;A rollback statement looks as follows …&lt;br /&gt;Rollback ;&lt;br /&gt;Make sure that you issue a commit or rollback before you exit your sqlplus session. Sqlplus will issue a commit by default when you exit.&lt;br /&gt;UPDATE&lt;br /&gt;The UPDATE command is used for updating the column values of an existing row in a table.&lt;br /&gt;Following are some examples …&lt;br /&gt;update division&lt;br /&gt;set division_desc = 'My new division'&lt;br /&gt;where division_no = 98 ;&lt;br /&gt;update price_list&lt;br /&gt;set price_list_price = price_list_price * 0.05&lt;br /&gt;where price_list_price &amp;lt; 1 ;&lt;br /&gt;You can use a sub-query to update a column as shown below …&lt;br /&gt;update new_division_table a&lt;br /&gt;set division_desc = (select division_desc from division b &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where b.division = a.division&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;;&lt;br /&gt;DELETE&lt;br /&gt;Delete command is used for removing data (rows) from a table.&lt;br /&gt;delete from&amp;nbsp; new_division_table ;&lt;br /&gt;The above statement will delete all rows from new_division_table table.&lt;br /&gt;delete from&amp;nbsp; new_division_table&lt;br /&gt;where division_no = 98 ;&lt;br /&gt;The above statement will delete the row corresponding to the division_no 98 from the new_division_table table.&lt;br /&gt;Some more examples …&lt;br /&gt;delete from&amp;nbsp; new_division_table&lt;br /&gt;where division_no &amp;gt;= 98 ;&lt;br /&gt;delete from&amp;nbsp; new_division_table&lt;br /&gt;where division_no in (98, 99) ;&lt;br /&gt;delete from&amp;nbsp; new_division_table&lt;br /&gt;where division_no != 98 ;&lt;br /&gt;delete from&amp;nbsp; new_division_table&lt;br /&gt;where division_no not in (98, 99) ;&lt;br /&gt;DATA DEFINITION LANGUAGE (DDL)&lt;br /&gt;In order for us to be able to store and retrieve data from tables we need to first have them created. This is exactly what the DDL commands are used for.&lt;br /&gt;Following is an example of "create table " command in its simplest form…&lt;br /&gt;create table new_division_table&lt;br /&gt;(&amp;nbsp;DIVISION_NO &amp;nbsp;NUMBER(2) NOT NULL, &lt;br /&gt;DIVISION_DESC &amp;nbsp;VARCHAR2(30), &lt;br /&gt;PRICE_GROUP_USER &amp;nbsp;VARCHAR2(1),&lt;br /&gt;TRADE_GROUP_USER &amp;nbsp;VARCHAR2(1), &lt;br /&gt;SALES_TYPE_USER &amp;nbsp;VARCHAR2(1)&lt;br /&gt;) ;&lt;br /&gt;The above command creates a table called new_division_table. It will be empty. The NOT NULL clause&amp;nbsp; for division_no column is to make sure that division_no column must always have a value whenever data is inserted into this table and it can not be updated to a NULL value.&lt;br /&gt;You can also create a table from an existing table as shown below…&lt;br /&gt;create table new_division_table as &lt;br /&gt;select * from division ;&lt;br /&gt;The above command creates a table called new_division_table and populates it with data from division table.&lt;br /&gt;create index x1_new_division_table&lt;br /&gt;on new_division_table (division_no) ;&lt;br /&gt;The above command creates an index called x1_new_division_table.&lt;br /&gt;Alter table&amp;nbsp; new_division_table&lt;br /&gt;modify&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIVISION_DESC &amp;nbsp;VARCHAR2(40) ;&lt;br /&gt;The above command alters the width of division_desc column to 40 from 30.&lt;br /&gt;truncate table new_division_table ;&lt;br /&gt;The above command deletes all data in the table&lt;br /&gt;drop table new_division_table ;&lt;br /&gt;The above command drops the table from the database. All the data within the table is permanently lost. So do exercise caution when using this command. I have one suggestion to avoid mistakes with DROP command – DO NOT USE IT in the first place.&lt;br /&gt;Note : DDL commands do not need a commit because they issue an implicit commit. This means that we can not rollback any DDL once it is executed.&lt;br /&gt;There are a number of other DDL commands which I think are the beyond the scope of this brief introduction to SQL.&lt;br /&gt;&lt;br /&gt;Access Control Commands&lt;br /&gt;When a user creates a database object such as a table, it gets created under the ownership (schema) of the user creating it. The user who created the table owns the table.&amp;nbsp; In order for others to be able to access or store data in this table the owner has to grant appropriate privileges to other users.&lt;br /&gt;Following are some examples but first the disclaimer…&lt;br /&gt;"Following examples are based on fictitious situations. Any resemblance to any names of any persons or projects or places is purely coincidental. " &lt;br /&gt;Example 1.&lt;br /&gt;Tom and Harry work in the IT department for a major bottling company and are working on a new project (actually cleaning up an old project) which requires them to work on an Oracle database and deal with tables etc...&lt;br /&gt;During the course working on this project, Tom creates a table called new_division_table and he wants Harry to be able to select data from this table. So he executes the following command…&lt;br /&gt;grant select on new_division_table to Harry ;&lt;br /&gt;Now Harry can access data from this table as follows..&lt;br /&gt;select *&amp;nbsp; from Tom.new_division_table ; &lt;br /&gt;Note that the username of the owner of the table has to be prepended to the table name, if the table is not owned by the user trying to access the table. &lt;br /&gt;Example 2.&lt;br /&gt;Harry tells Tom that he wants to be able to do more than mere selecting of data from the table.&lt;br /&gt;Tom then executes the following GRANT command to give Harry more privileges…&lt;br /&gt;grant insert, update, delete on new_division_table&amp;nbsp; to Harry ;&lt;br /&gt;Harry then tests his newly granted privileges on the table as follows…&lt;br /&gt;delete from&amp;nbsp; Tom.new_division_table ;&lt;br /&gt;commit ;&lt;br /&gt;&lt;br /&gt;Example 3.&lt;br /&gt;Now Tom is mad and wants to take away all but SELECT privilege from Harry on the new_division_table. He executes the following command …&lt;br /&gt;revoke&amp;nbsp;&amp;nbsp; insert,update, delete on new_division_table from Harry ;&lt;br /&gt;I Hope the above examples clarify the use of Access control commands.&lt;br /&gt;Changing sqlplus environment&lt;br /&gt;You can change the default behaviour of how the results are displayed within sqlplus. You can do this by using the set command of sqlplus.&lt;br /&gt;set pagesize 80&lt;br /&gt;The above command makes sure columns headings are repeated&amp;nbsp; after every 80 lines of the results.&lt;br /&gt;set pagesize 0&lt;br /&gt;The above command supresses printing of headings.&lt;br /&gt;set linesize&amp;nbsp; 70&lt;br /&gt;Above command sets the line size to 70.&lt;br /&gt;spool /home/rnemani/division.list&lt;br /&gt;select * from division ;&lt;br /&gt;spool off&lt;br /&gt;The above commands create a text file called division.lst in /home/patuser directory. This file would contain the output of division table.&lt;br /&gt;If you want see your current sqlplus environment settings give the following command &lt;br /&gt;show all&lt;br /&gt;There are a number of useful set commands that you could use and would use as you start using sqlplus regularly.&lt;br /&gt;Using SQL scripts&lt;br /&gt;You can save regularly used sql commands in a sql script using a text editor such as vi.&lt;br /&gt;For example you can save the following commands in a&amp;nbsp; script file called get_div.sql&amp;nbsp; using vi.&lt;br /&gt;spool /home/rnemani/division.list&lt;br /&gt;select * from division ;&lt;br /&gt;spool off&lt;br /&gt;You can then start up a sql session and execute the script at the sql prompt as shown below.&lt;br /&gt;SQL&amp;gt; @get_div.sql&lt;br /&gt;The above command would execute all the commands in the script as if they were entered at SQL prompt.&lt;br /&gt;You can know the structure (column names, data types etc…) of any table, by using the following command&lt;br /&gt;DESC table_name&lt;br /&gt;for example…&lt;br /&gt;SQL&amp;gt; desc division&lt;br /&gt;&amp;nbsp;Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Null?&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&lt;br /&gt;&amp;nbsp;----------------------------------- -------- --------------------&lt;br /&gt;&amp;nbsp;DIVISION_NO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT NULL NUMBER(2)&lt;br /&gt;&amp;nbsp;DIVISION_DESC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VARCHAR2(30)&lt;br /&gt;&amp;nbsp;PRICE_GROUP_USER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VARCHAR2(1)&lt;br /&gt;&amp;nbsp;TRADE_GROUP_USER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VARCHAR2(1)&lt;br /&gt;&amp;nbsp;SALES_TYPE_USER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VARCHAR2(1)&lt;br /&gt;SQL&amp;gt;&lt;br /&gt;Oracle returns errors when you execute your sql statements, if there is a syntax error(s) or if it is unable to find the objects that are referred to in the SQL statement. Given below is an example…&lt;br /&gt;SQL&amp;gt; select count(*) from rkn_branch_extension ;&lt;br /&gt;select count(*) from rkn_branch_extension&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-00942: table or view does not exist&lt;br /&gt;If you want know more about this error then you can issue the following command at your UNIX prompt.&lt;br /&gt;$ oerr ORA 942&lt;br /&gt;&lt;h5&gt;Conclusion&lt;/h5&gt;As you can see SQL is very easy to use and intuitive. One other good thing about SQL is that it is portable for the most part across databases that support it. I hope this tutorial gave you enough information to get started with SQL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-342375988038380988?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/342375988038380988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/07/sql-tutorial-for-beginners.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/342375988038380988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/342375988038380988'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/07/sql-tutorial-for-beginners.html' title='SQL Tutorial for the beginners'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-3527316723752456148</id><published>2007-06-30T21:55:00.000-07:00</published><updated>2008-10-25T11:35:38.540-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>RMAN tape backup script</title><content type='html'>This script&amp;nbsp;&amp;nbsp;does a backup of backupset to tape.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;br /&gt;##&lt;br /&gt;## script name : rman_tape_bkup.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;## &lt;br /&gt;## Purpose :&lt;br /&gt;## This script&amp;nbsp; takes database sid as a command line argument and does a backup of&lt;br /&gt;## backupset to tape. It backs up to the tape device using automatic channel &lt;br /&gt;## allocation. Make sure you have configured the default device and channels. You&lt;br /&gt;## can find the configuration that I have used in a script called rman_config.ksh&lt;br /&gt;##&lt;br /&gt;## Other Features :&lt;br /&gt;## This script emails the backup log to the email ids set up in the email configuration&lt;br /&gt;## file email configuration file is just a text file containing the email ids to where &lt;br /&gt;## the backup log will be emailed to.&lt;br /&gt;## This script creates a log file on the datbase server where this script is hosted.&lt;br /&gt;##&lt;br /&gt;## It also creates and uses a lockfile to make sure no other rman process is running for&lt;br /&gt;## the database sid that was supplied through the command line. Should this script fail&lt;br /&gt;## for any reason, it does not remove the lockfile so that no rman process can run for this&lt;br /&gt;## database until the error is fixed and the lock file is removed manually&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You need to login as a unix user id that belongs to the dba group and run this script&lt;br /&gt;## There are a bunch of modifiable parameters in this script that you should modify to &lt;br /&gt;## reflect your environment.&lt;br /&gt;## I have tested this script on only Oracle 10g on an IBM AIX platform. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Usage: $0 ORACLE_SID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit&lt;br /&gt;fi&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;## ----------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## -------------------- Start of modifiable parameters ------------------------------&lt;br /&gt;##&lt;br /&gt;## Change the values for the following parameters to reflect your environment&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;LOG_DIR="/u01/oracle/admin/rman"&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;EMAIL_INFO_FILE="${LOG_DIR}/${ORACLE_SID}_email.cfg"&lt;br /&gt;SENDER="&lt;a href="mailto:rman@%60hostname"&gt;mailto:rman@%60hostname&lt;/a&gt;"&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the logs&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The LOGARCFILE will have the cumulative log &lt;br /&gt;##&lt;br /&gt;## LOGFILE="${LOG_DIR}/rman_tape_bkup_$CURR_DATE.log"&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_tape_bkup.$ORACLE_SID.log" &lt;br /&gt;LOGARCFILE="${LOG_DIR}/rman_tape_bkup.$ORACLE_SID.log.arc"&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the errors&lt;br /&gt;## The EMAILFILE will have errors if any from just the latest run&lt;br /&gt;## The EMAILARCFILE will have the cumulative errors &lt;br /&gt;##&lt;br /&gt;EMAILFILE="${LOG_DIR}/rman_tape_bkup.$ORACLE_SID.email" &lt;br /&gt;EMAILARCFILE="${LOG_DIR}/rman_tape_bkup.$ORACLE_SID.email.arc" &lt;br /&gt;## --------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## -------------------- End of modifiable parameters ------------------------------&lt;br /&gt;##&lt;br /&gt;## --------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;echo -------------------------------------------------------------- &amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_tape_bkup.ksh started ------------------ &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [&amp;nbsp; -e&amp;nbsp; $LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;echo "$LOCKFILE exists. Will check again after 3 minutes" &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&amp;nbsp;echo&amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep 180&lt;br /&gt;else&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create a lock file&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;rman &amp;lt;&amp;lt;EOF&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;connect target / ;&lt;br /&gt;SHOW ALL ;&lt;br /&gt;## RUN &lt;br /&gt;## {&lt;br /&gt;&amp;nbsp;## ALLOCATE CHANNEL t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' format '%u_%p_%c';&lt;br /&gt;&amp;nbsp;## BACKUP BACKUPSET ALL ;&lt;br /&gt;## }&lt;br /&gt;BACKUP DEVICE TYPE SBT BACKUPSET ALL ;&lt;br /&gt;REPORT SCHEMA ;&lt;br /&gt;EXIT ;&lt;br /&gt;EOF&lt;br /&gt;rmanstatus=$?&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;if [ ! -e&amp;nbsp; $EMAIL_INFO_FILE ]&lt;br /&gt;&amp;nbsp;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;&amp;nbsp;fi&lt;br /&gt;&amp;nbsp;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;echo "Subject: The $0 script failed for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'RMAN-'&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'ORA-'&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'sbt'&amp;nbsp;&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'tsm'&amp;nbsp;&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&amp;nbsp;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 12&lt;br /&gt;fi&lt;br /&gt;echo -------------------------------------------------------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_tape_bkup.ksh completed ---------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script completed successfully for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $LOGARCFILE&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for this ORACLE_SID to run, if any&lt;br /&gt;##&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;## --------------------------------------------------------------------------------&lt;br /&gt;## End of&amp;nbsp; rman_tape_bkup.ksh&lt;br /&gt;## --------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-3527316723752456148?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/3527316723752456148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-tape-backup-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3527316723752456148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3527316723752456148'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-tape-backup-script.html' title='RMAN tape backup script'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-1322218734639204795</id><published>2007-06-30T21:19:00.000-07:00</published><updated>2008-10-25T11:35:38.541-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>RMAN configuration script</title><content type='html'>This script configures&amp;nbsp;persistent rman settings&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;br /&gt;##&lt;br /&gt;## script name : rman_config.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;## &lt;br /&gt;## Purpose :&lt;br /&gt;## This script&amp;nbsp; takes database sid as a command line argument and configures&lt;br /&gt;## persistent rman settings&lt;br /&gt;##&lt;br /&gt;## Other Features :&lt;br /&gt;## This script creates a log file on the datbase server where this script is hosted.&lt;br /&gt;##&lt;br /&gt;## It also creates and uses a lockfile to make sure no other rman process is running for&lt;br /&gt;## the database sid that was supplied through the command line. Should this script fail&lt;br /&gt;## for any reason, it does not remove the lockfile so that no rman process can run for this&lt;br /&gt;## database until the error is fixed and the lock file is removed manually.&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You need to login as a unix user id that belongs to dba group and run this script.&lt;br /&gt;## For device type sbt , the setting that I have here is for our TSM setup. Your setting may differ.&lt;br /&gt;## I have tested this script on only Oracle 10g on an IBM AIX platform. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;## &lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;echo&lt;br /&gt;&amp;nbsp;echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;&amp;nbsp;echo&lt;br /&gt;&amp;nbsp;echo Usage: $0 ORACLE_SID&lt;br /&gt;&amp;nbsp;echo&lt;br /&gt;&amp;nbsp;exit&lt;br /&gt;fi&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;LOG_DIR="."&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;if [&amp;nbsp; -e&amp;nbsp; $LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep 80&lt;br /&gt;else&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create the lock file&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one &lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The ARCFILE will have cumulative log &lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;## LOGFILE="${LOG_DIR}/rman_config_$CURR_DATE.$ORACLE_SID.log"&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_config.$ORACLE_SID.log"&lt;br /&gt;ARCFILE="${LOG_DIR}/rman_config.$ORACLE_SID.arc"&lt;br /&gt;##&lt;br /&gt;## Run rman config commands&lt;br /&gt;## &lt;br /&gt;rman &amp;lt;&amp;lt;EOF&amp;nbsp; &amp;gt; $LOGFILE&lt;br /&gt;connect target / ;&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1;&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP &lt;br /&gt;FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK ;&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET ;&lt;br /&gt;CONFIGURE DEVICE TYPE sbt PARALLELISM 4 BACKUP TYPE TO BACKUPSET ;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE sbt &lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' &lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;EOF&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $ARCFILE&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for this ORACLE_SID to run, if any&lt;br /&gt;##&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;## ---------------------------------------------------------------------------------&lt;br /&gt;## End of&amp;nbsp; rman_config.ksh&lt;br /&gt;## ---------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-1322218734639204795?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/1322218734639204795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-configuration-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/1322218734639204795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/1322218734639204795'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-configuration-script.html' title='RMAN configuration script'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7486202247959977014</id><published>2007-06-30T21:16:00.000-07:00</published><updated>2008-10-25T11:35:38.542-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>RMAN archive logs backup script</title><content type='html'>This script does&amp;nbsp; archive logs&amp;nbsp;backup using rman.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;br /&gt;##&lt;br /&gt;## script name : rman_arch_bkup.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;## &lt;br /&gt;## Purpose :&lt;br /&gt;## This script&amp;nbsp; takes database sid as a command line argument and does&amp;nbsp; archive logs&lt;br /&gt;## backup. It backs up to the default device using automatic channel allocation.&lt;br /&gt;## Make sure you have configured the default device and channels. You can find the &lt;br /&gt;## configuration that I have used in a script called rman_config.ksh&lt;br /&gt;##&lt;br /&gt;## Other Features :&lt;br /&gt;## This script emails the backup log to the email ids set up in the email configuration&lt;br /&gt;## file email configuration file is just a text file containing the email ids to where &lt;br /&gt;## the backup log will be emailed to.&lt;br /&gt;## This script creates a log file on the datbase server where this script is hosted.&lt;br /&gt;##&lt;br /&gt;## It also creates and uses a lockfile to make sure no other rman process is running for&lt;br /&gt;## the database sid that was supplied through the command line. Should this script fail&lt;br /&gt;## for any reason, it does not remove the lockfile so that no rman process can run for this&lt;br /&gt;## database until the error is fixed and the lock file is removed manually&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You need to login as a unix user id that belongs to the dba group and run this script&lt;br /&gt;## There are a bunch of modifiable parameters in this script that you should modify to &lt;br /&gt;## reflect your environment.&lt;br /&gt;## I have tested this script on only Oracle 10g on an IBM AIX platform. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Error Missing Arguement, Please supply Oracle Sid&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Usage: $0 ORACLE_SID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit&lt;br /&gt;fi&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;## ----------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## -------------------- Start of modifiable parameters ------------------------------&lt;br /&gt;##&lt;br /&gt;## Change the values for the following parameters to reflect your environment&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;LOG_DIR="/u01/oracle/admin/rman"&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;EMAIL_INFO_FILE="${LOG_DIR}/${ORACLE_SID}_email.cfg"&lt;br /&gt;SENDER="&lt;a href="mailto:rman@%60hostname"&gt;mailto:rman@%60hostname&lt;/a&gt;"&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the logs&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The LOGARCFILE will have the cumulative log &lt;br /&gt;##&lt;br /&gt;## LOGFILE="${LOG_DIR}/rman_arch_bkup_$CURR_DATE.log"&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_arch_bkup.$ORACLE_SID.log" &lt;br /&gt;LOGARCFILE="${LOG_DIR}/rman_arch_bkup.$ORACLE_SID.log.arc"&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the errors&lt;br /&gt;## The EMAILFILE will have errors if any from just the latest run&lt;br /&gt;## The EMAILARCFILE will have the cumulative errors &lt;br /&gt;##&lt;br /&gt;EMAILFILE="${LOG_DIR}/rman_arch_bkup.$ORACLE_SID.email" &lt;br /&gt;EMAILARCFILE="${LOG_DIR}/rman_arch_bkup.$ORACLE_SID.email.arc" &lt;br /&gt;## --------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## -------------------- End of modifiable parameters ------------------------------&lt;br /&gt;##&lt;br /&gt;## --------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;echo --------------------------------------------------------- &amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_arch_bkup.ksh started ------------------ &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [&amp;nbsp; -e&amp;nbsp; $LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;echo "$LOCKFILE exists. Will check again after 3 minutes" &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&amp;nbsp;echo&amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep 180&lt;br /&gt;else&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create a lock file&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;rman &amp;lt;&amp;lt;EOF&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;connect target / ;&lt;br /&gt;SHOW ALL ;&lt;br /&gt;## RUN &lt;br /&gt;## {&lt;br /&gt;&amp;nbsp;## ALLOCATE CHANNEL c1 DEVICE TYPE DISK;&lt;br /&gt;&amp;nbsp;## BACKUP DATABASE FILESPERSET 1 PLUS ARCHIVELOG DELETE INPUT;&lt;br /&gt;&amp;nbsp;## DELETE NOPROMPT OBSOLETE; &lt;br /&gt;## }&lt;br /&gt;BACKUP ARCHIVELOG ALL DELETE INPUT;&lt;br /&gt;DELETE NOPROMPT OBSOLETE; &lt;br /&gt;REPORT SCHEMA ;&lt;br /&gt;REPORT UNRECOVERABLE;&lt;br /&gt;EXIT ;&lt;br /&gt;EOF&lt;br /&gt;rmanstatus=$?&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;if [ ! -e&amp;nbsp; $EMAIL_INFO_FILE ]&lt;br /&gt;&amp;nbsp;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo "To:rnemani@na.cokecce.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;&amp;nbsp;fi&lt;br /&gt;&amp;nbsp;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;echo "Subject: The $0 script failed for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'RMAN-'&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'ORA-'&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'sbt'&amp;nbsp;&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'tsm'&amp;nbsp;&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&amp;nbsp;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 12&lt;br /&gt;fi&lt;br /&gt;echo --------------------------------------------------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_arch_bkup.ksh completed ---------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script completed successfully for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $LOGARCFILE&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for this ORACLE_SID to run, if any&lt;br /&gt;##&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;## ----------------------------------------------------------------------------------&lt;br /&gt;## End of&amp;nbsp; rman_arch_bkup.ksh&lt;br /&gt;## ----------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7486202247959977014?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7486202247959977014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-archive-logs-backup-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7486202247959977014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7486202247959977014'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-archive-logs-backup-script.html' title='RMAN archive logs backup script'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-4654304720908745282</id><published>2007-06-30T21:11:00.000-07:00</published><updated>2008-10-25T11:35:38.543-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>RMAN complete database backup script</title><content type='html'>This script does a full database&amp;nbsp;backup including the archive logs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;br /&gt;##&lt;br /&gt;## script name : rman_bkup.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;## &lt;br /&gt;## Purpose :&lt;br /&gt;## This script&amp;nbsp; takes database sid as a command line argument and does a full database &lt;br /&gt;## backup including the archive logs. It backs up to the default device using automatic &lt;br /&gt;## channel allocation. Make sure you have configured the default device and channels. &lt;br /&gt;## You can find the configuration that I have used in a script called rman_config.ksh&lt;br /&gt;##&lt;br /&gt;## Other Features :&lt;br /&gt;## This script emails the backup log to the email ids set up in the email configuration&lt;br /&gt;## file email configuration file is just a text file containing the email ids to where &lt;br /&gt;## the backup log will be emailed to.&lt;br /&gt;## This script creates a log file on the datbase server where this script is hosted.&lt;br /&gt;##&lt;br /&gt;## It also creates and uses a lockfile to make sure no other rman process is running for&lt;br /&gt;## the database sid that was supplied through the command line. Should this script fail&lt;br /&gt;## for any reason, it does not remove the lockfile so that no rman process can run for this&lt;br /&gt;## database until the error is fixed and the lock file is removed manually&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You need to login as a unix user id that belongs to the dba group and run this script&lt;br /&gt;## There are a bunch of modifiable parameters in this script that you should modify to &lt;br /&gt;## reflect your environment.&lt;br /&gt;## I have tested this script on only Oracle 10g on an IBM AIX platform. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure ORACLE_SID is passed as an argument&lt;br /&gt;##&lt;br /&gt;if (( $# &amp;lt; 1 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Error Missing Arguement, Please supply database sid (Oracle Sid)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Usage: $0 ORACLE_SID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit&lt;br /&gt;fi&lt;br /&gt;export ORACLE_SID=$1&lt;br /&gt;## ----------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## -------------------- Start of modifiable parameters ------------------------------&lt;br /&gt;##&lt;br /&gt;## Change the values for the following parameters to reflect your environment&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;LOG_DIR="/u01/oracle/admin/rman"&lt;br /&gt;LOCKFILE="${LOG_DIR}/$ORACLE_SID.lock"&lt;br /&gt;EMAIL_INFO_FILE="${LOG_DIR}/${ORACLE_SID}_email.cfg"&lt;br /&gt;SENDER="&lt;a href="mailto:rman@%60hostname"&gt;mailto:rman@%60hostname&lt;/a&gt;"&lt;br /&gt;CURR_DATE=`date +"%Y%m%d_%H%M%S"`&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the logs&lt;br /&gt;## The LOGFILE will have log from just the latest run&lt;br /&gt;## The LOGARCFILE will have the cumulative log &lt;br /&gt;##&lt;br /&gt;LOGFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.log" &lt;br /&gt;LOGARCFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.log.arc"&lt;br /&gt;##&lt;br /&gt;## using two seperate files instead of one for keeping the errors&lt;br /&gt;## The EMAILFILE will have errors if any from just the latest run&lt;br /&gt;## The EMAILARCFILE will have the cumulative errors &lt;br /&gt;##&lt;br /&gt;EMAILFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.email" &lt;br /&gt;EMAILARCFILE="${LOG_DIR}/rman_bkup.$ORACLE_SID.email.arc" &lt;br /&gt;## -----------------------------------------------------------------------------------&lt;br /&gt;##&lt;br /&gt;## -------------------- End of modifiable parameters -----------------------------&lt;br /&gt;##&lt;br /&gt;## ------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;## Make sure no other rman process is running for this ORACLE_SID&lt;br /&gt;##&lt;br /&gt;echo --------------------------------------------------------- &amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_bkup.ksh started ------------------ &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;if [&amp;nbsp; -e&amp;nbsp; $LOCKFILE ]&lt;br /&gt;then&lt;br /&gt;##&lt;br /&gt;## Some rman process is running. Check again after 3 minutes&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;echo "$LOCKFILE exists. Will check again after 3 minutes" &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&amp;nbsp;echo&amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep 180&lt;br /&gt;else&lt;br /&gt;##&lt;br /&gt;## No rman process is running. Create a lock file&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Do not remove this file. This is a lock file for $ORACLE_SID &amp;gt; $LOCKFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;echo $ORACLE_SID &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;whoami &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;which rman &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;rman &amp;lt;&amp;lt;EOF&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;CONNECT TARGET /&amp;nbsp; ;&lt;br /&gt;SHOW ALL ;&lt;br /&gt;BACKUP DATABASE FILESPERSET 1 PLUS ARCHIVELOG DELETE INPUT;&lt;br /&gt;DELETE NOPROMPT OBSOLETE; &lt;br /&gt;REPORT SCHEMA ;&lt;br /&gt;REPORT UNRECOVERABLE ;&lt;br /&gt;EXIT ;&lt;br /&gt;EOF&lt;br /&gt;rmanstatus=$?&lt;br /&gt;if (( $rmanstatus &amp;gt; 0 ))&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;if [ ! -e&amp;nbsp; $EMAIL_INFO_FILE ]&lt;br /&gt;&amp;nbsp;then&lt;br /&gt;##&lt;br /&gt;## The following line is executed if the Email config file is not set up.&lt;br /&gt;## Replace &lt;a href="mailto:emailid@defaultemail.com"&gt;emailid@defaultemail.com&lt;/a&gt; with the email id to where the email&lt;br /&gt;## needs to be sent.&lt;br /&gt;##&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo "To:emailid@defaultemail.com" &amp;gt; $EMAIL_INFO_FILE&lt;br /&gt;&amp;nbsp;fi&lt;br /&gt;&amp;nbsp;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;echo "Subject: The $0 script failed for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "rman error!!! ..." &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "Not removed the lock file : $LOCKFILE " &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "Please fix the error and remove the lock file" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp; "before re-running the script again!!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'RMAN-'&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'ORA-'&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'sbt'&amp;nbsp;&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;grep -i 'tsm'&amp;nbsp;&amp;nbsp;&amp;nbsp; $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;&amp;nbsp;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;&amp;nbsp;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 12&lt;br /&gt;fi&lt;br /&gt;echo --------------------------------------------------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;date &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo ---------------- rman_bkup.ksh completed ---------------- &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;echo &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;cat $EMAIL_INFO_FILE &amp;gt; $EMAILFILE&lt;br /&gt;echo "Subject: The $0 script completed successfully for $ORACLE_SID !!!" &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $EMAILFILE&lt;br /&gt;sendmail -F "$SENDER" -t &amp;lt; $EMAILFILE&lt;br /&gt;cat $EMAILFILE &amp;gt;&amp;gt; $EMAILARCFILE&lt;br /&gt;cat $LOGFILE &amp;gt;&amp;gt; $LOGARCFILE&lt;br /&gt;##&lt;br /&gt;## Remove lock file to allow other rman processs for this ORACLE_SID to run, if any&lt;br /&gt;##&lt;br /&gt;rm $LOCKFILE&lt;br /&gt;## ---------------------------------------------------------------------------------&lt;br /&gt;## End of&amp;nbsp; rman_bkup.ksh&lt;br /&gt;## ---------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-4654304720908745282?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/4654304720908745282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-complete-database-backup-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4654304720908745282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4654304720908745282'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/rman-complete-database-backup-script.html' title='RMAN complete database backup script'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-803615896057875229</id><published>2007-06-30T17:52:00.000-07:00</published><updated>2008-10-25T11:35:38.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Developer'/><title type='text'>Writing Efficient SQL Code for Oracle - Part 2</title><content type='html'>Introduction &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In part 2 of this article I cover writing Efficient SQL Code for the OLTP environment.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Following topics are covered &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Correlated Queries &lt;/li&gt;&lt;li&gt;Implicit data type conversions &lt;/li&gt;&lt;li&gt;Making sure indexes are considered by the Optimizer &lt;/li&gt;&lt;li&gt;Reduce the network traffic&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;strong&gt;Correlated Queries&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Exercise caution while writing SQL statements using correlated queries. If you use lot of correlated queries in your code and if they get executed frequently then you might want to re-examine them. Correlated queries could get very expensive in terms of resources as explained in the next few slides with the help of an example. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The query shown next lists employees that have been hired between Jan 2002 and March 2002 and have been employed the longest in each division. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SQL&amp;gt; select emp_no, emp_division, (emp_term_dt - emp_hire_dt) emp_span&lt;br /&gt;&lt;br /&gt;&lt;div&gt;2 from emp o&lt;/div&gt;&lt;br /&gt;&lt;div&gt;3 where emp_hire_dt &amp;gt;= '01-JAN-2002'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;4 and emp_hire_dt &amp;lt; '31-MAR-2002'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;5 and (o.emp_term_dt - o.emp_hire_dt)&lt;/div&gt;&lt;br /&gt;&lt;div&gt;6 in&lt;/div&gt;&lt;br /&gt;&lt;div&gt;7 ( select max(i.emp_term_dt - i.emp_hire_dt)&lt;/div&gt;&lt;br /&gt;&lt;div&gt;8 from emp i&lt;/div&gt;&lt;br /&gt;&lt;div&gt;9 where i.emp_division = o.emp_division&lt;/div&gt;&lt;br /&gt;&lt;div&gt;10 and emp_hire_dt &amp;gt;= '01-JAN-2002'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;11 and emp_hire_dt &amp;lt; '31-MAR-2002' ) ;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;62 rows selected.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Elapsed: 00:00:43.58&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Statistics&lt;/div&gt;&lt;br /&gt;&lt;div&gt;-------------------------------------------&lt;/div&gt;&lt;br /&gt;&lt;div&gt;977818 physical reads&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The above sql is a correlated query. The output from the query is not shown here. Notice the execution time and physical reads.Next slide will show this query re-written without using the correlated sub query&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The same sql re-written as shown below and it does not use correlated sub query. Output from the query is not shown here. Notice the drastic reduction in the execution time and the physical reads&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SQL&amp;gt; select a.emp_division, a.emp_no, b.emp_span&lt;/div&gt;&lt;br /&gt;&lt;div&gt;2 from emp a&lt;/div&gt;&lt;br /&gt;&lt;div&gt;3 , ( select emp_division, max(i.emp_term_dt - i.emp_hire_dt) emp_span&lt;/div&gt;&lt;br /&gt;&lt;div&gt;4 from emp i&lt;/div&gt;&lt;br /&gt;&lt;div&gt;5 where emp_hire_dt &amp;gt;= '01-JAN-2002'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;6 and emp_hire_dt &amp;lt; '31-MAR-2002'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;7 group by emp_division ) b&lt;/div&gt;&lt;br /&gt;&lt;div&gt;8 where a.emp_division = b.emp_division&lt;/div&gt;&lt;br /&gt;&lt;div&gt;9 and (a.emp_term_dt - a.emp_hire_dt) = b.emp_span&lt;/div&gt;&lt;br /&gt;&lt;div&gt;10 and a.emp_hire_dt &amp;gt;= '01-JAN-2002'&lt;/div&gt;&lt;br /&gt;&lt;div&gt;11 and a.emp_hire_dt &amp;lt; '31-MAR-2002' ;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;62 rows selected.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;Elapsed: 00:00:01.82&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;Statistics&lt;/div&gt;&lt;br /&gt;&lt;div&gt;----------------------------------&lt;/div&gt;&lt;br /&gt;&lt;div&gt;28725 physical reads&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Let us modify the query to consider the whole emp table. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Select statement with a correlated subquery&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SQL&amp;gt; select a.emp_division, a.emp_no, (a.emp_term_dt - a.emp_hire_dt) emp_span&lt;br /&gt;2 from emp a&lt;br /&gt;3 , ( select emp_division, max(i.emp_term_dt - i.emp_hire_dt) max_span&lt;br /&gt;4 from emp i&lt;br /&gt;5 group by emp_division ) b&lt;br /&gt;6 where a.emp_division = b. emp_division&lt;br /&gt;7 and (a.emp_term_dt - a.emp_hire_dt) = b.max_span&lt;br /&gt;8 order by emp_span ;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;305 rows selected.&lt;br /&gt;Elapsed: 00:29:08.75&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;39094846 physical reads&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;As can be seen above, the resource intensive nature of Correlated queries becomes very evident as the size of the driving table in the outer query increases. Now the above correlated sub query took more than 29 minutes and a huge number of physical reads.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The above query is re-written as shown below and does not use the correlated sub query and notice that the execution time and physical reads still are very low although now we are considering the entire emp table&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SQL&amp;gt; select a.emp_division, a.emp_no, b.emp_span&lt;br /&gt;2 from emp a&lt;br /&gt;3 , ( select emp_division&lt;br /&gt;4 , max(i.emp_term_dt - i.emp_hire_dt) emp_span&lt;br /&gt;5 from emp i&lt;br /&gt;6 group by emp_division ) b&lt;br /&gt;7 where a.emp_division = b.emp_division&lt;br /&gt;8 and (a.emp_term_dt - a.emp_hire_dt) = b.emp_span ;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;305 rows selected.&lt;br /&gt;Elapsed: 00:00:02.84&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Statistics&lt;br /&gt;-----------------------------------&lt;br /&gt;28726 physical reads &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;Making sure indexes are considered by the Optimizer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Oracle optimizer may not consider the indexes when evaluating query plans if the columns in the where clause have any kind of transformation done on them.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;For example in the following select statement notice how the ename column is transformed.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Select * from emp&lt;br /&gt;Where upper(ename) = ‘&amp;amp;ename’&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;If an index exists on ename column Oracle optimizer will not consider it when evaluating the access paths for executing the above statement.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Next I explain with an example how we can make sure that indexes are considered by the Optimizer.&lt;br /&gt;Consider the emp table that we used in the previous examples. This table has an index on hiredate column. &lt;br /&gt;Some of the columns of emp table are shown below…&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Name Type&lt;br /&gt;-------------- ------------&lt;br /&gt;EMPNO NUMBER(6)&lt;br /&gt;ENAME VARCHAR2(10)&lt;br /&gt;HIREDATE DATE&lt;br /&gt;DEPTNO NUMBER(2)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Following select statement retrieves the data for all employees hired yesterday.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Select * from emp&lt;br /&gt;where hiredate + 1 = sysdate ; *&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;When evaluating the access paths optimizer does not consider the hiredate index, instead it looks for an index on hiredate+10 and does not find one. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;* Actually Oracle date columns have time component also, but I am ignoring that to keep this example simple.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;If you want the optimizer to use the index then you have to rewrite the above select statement as shown below …&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Select * from emp&lt;br /&gt;where hiredate = sysdate -1 ;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Now the optimizer looks for an index on hiredate and finds one and uses it, if that gives a better access path.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;To summarize, if you do any transformations on columns in the where clause of your SQL statement, then indexes (if any) on those columns would not be considered by Oracle optimizer while evaluating access paths.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;Avoid implicit data type conversions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;What is implicit data type conversion? &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Implicit data type conversion occurs when the database converts the data types while applying a condition in the where clause during the execution of a query.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Consider the following table&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SQL&amp;gt; describe SALESCENTER_CHANNEL_SUMMARY&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Name Null? Type&lt;br /&gt;----------------------------------- -------- -----------&lt;br /&gt;SALES_CENTER_NUM&amp;nbsp; NOT NULL VARCHAR2(6)&lt;br /&gt;CHANNEL_NBR&amp;nbsp; NOT NULL NUMBER(3)&lt;br /&gt;DIVISION_NO&amp;nbsp; NOT NULL NUMBER(2)&lt;br /&gt;SALES&amp;nbsp; NOT&amp;nbsp;NULL NUMBER&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SALES_CENTER_NUM column is defined as datatype VARCHAR2(6) in the above table.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;select count(*)&lt;br /&gt;from SALESCENTER_CHANNEL_SUMMARY&lt;br /&gt;where SALES_CENTER_NUM = 213502 ;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;COUNT(*)&lt;br /&gt;----------&lt;br /&gt;37&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The above select statement worked because Oracle did the data type conversion for us when it executed the query. And because the sales_center_num data in the table happened to contain only numeric values.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;If you looked at what Oracle did behind the scenes for this query, it would be&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;1. For each row of SALESCENTER_CHANNEL_SUMMARY &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;apply the where clause condition SALES_CENTER_NUM = 213502&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;by first converting the SALES_CENTER_NUM&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;into a number and then comparing against the value 213502&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;2. Return the filtered result set from step 1&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In effect, it is as if your query is rewritten as follows…&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;select count(*)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;from SALESCENTER_CHANNEL_SUMMARY&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;where to_number(SALES_CENTER_NUM) = 213502 ;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Now let us add another row to the table that has a non numeric values for sales_center num column as shown below.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SALES_ CHANNEL_NBR DIVISION_NO BASIS_COMPANY_ID BA&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;------ ----------- ----------- ---------------- --&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;4070ZP 14 40 70 ZP&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Now when we execute the same query again we get the following error&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;SQL&amp;gt; select count(*)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;2 from SALESCENTER_CHANNEL_SUMMARY&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;3 where SALES_CENTER_NUM = 213502 ;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;where SALES_CENTER_NUM = 213502&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;*&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;ERROR at line 3:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;ORA-01722: invalid number&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;We got an error because now there is a sales center 4070ZP in the data that could not be converted into a number. The query worked as long as the data values could be implicitly converted but failed when there is a data value that could not be converted.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Moral of the story : Do not depend on implicit data conversions.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;There is a side effect to implicit conversions that needs to be mentioned also. Implicit conversions prevent the optimizer from choosing the index even if there is an index existing for that column. Implicit data conversions almost always result in full table scans. That is another reason why we should not depend on implicit data conversions. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;Reduce the network traffic&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;High network traffic saturates the available network bandwidth in a WAN causing severe performance problems.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;So we need to minimize the network traffic between &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;- the client application and database server if it is a two tier architecture&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;- the App server and the database server if it is a three tier architecture&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Network traffic consists of&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;1. Sql statements sent from the application to the database server&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;2. Results sent from the database server to the application&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Minimizing traffic from the application to the database server&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;To do this we need to minimize the amount of data going from from the application to the database server. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;This can be done by moving the sql statements from the application to the database stored procedures. This means instead of sending lengthy sql statements across the network, application just invokes database stored procedures with appropriate parameters. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;This results is far less traffic being generated from the application to the database server. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;This approach has another benefit as well, it reduces the parsing activity to a minimum – because stored procedures are pre-parsed and can be pinned in the memory. Since parsing is a very CPU intensive activity, less parsing means less load on the CPU.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Minimizing traffic from the database server to the application&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In this case, we can not minimize the amount of data sent from the database server to the application. But we can still reduce the traffic by packing more data in each of the tcp/ip packets which results in less number of packets going across the network. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;This can be done by tweaking the sqlnet ARRAYSIZE. I am not going into details here but just know that it is possible to tweak it and take the help of your DBA to do that.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Many applications fail to scale because of the SQL code that is not efficient. Writing SQL code that works alone is not enough. It is important to make sure that your SQL code does what it does very efficiently. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;I have used the techniques described here very successfully to solve many tuning problems over the last several years. I hope you find the information presented here useful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-803615896057875229?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/803615896057875229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/writing-efficient-sql-code-for-oracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/803615896057875229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/803615896057875229'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/writing-efficient-sql-code-for-oracle.html' title='Writing Efficient SQL Code for Oracle - Part 2'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6022245326423942997</id><published>2007-06-30T15:22:00.000-07:00</published><updated>2008-10-25T11:35:38.545-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Developer'/><title type='text'>Writing Efficient SQL Code for Oracle - Part 1</title><content type='html'>&lt;h5&gt;&lt;font size="0"&gt;Introduction&lt;br /&gt;&lt;/font&gt;&lt;/h5&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="0"&gt;This article aims to provide you with information and tips that will help you write efficient SQL code for Oracle databases. Part 1 covers batch environment.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="0"&gt;&lt;strong&gt;&lt;em&gt;Why is writing efficient SQL code important?&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font size="0"&gt;If you would like your application to scale well, then you would need to have SQL code that executes efficiently.&lt;font size="0"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="0"&gt;&lt;strong&gt;&lt;em&gt;How do you define efficient SQL code?&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font size="0"&gt;Any SQL code that does what it does, using minimum resources and in minimum possible time.&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In part 1 of this article I cover the following areas where one can achieve big efficiency gains by writing efficient sql for batch environment.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Huge Inserts&lt;br /&gt;Huge Updates&lt;br /&gt;Huge Deletes&lt;br /&gt;Efficient elimination of duplicates&lt;br /&gt;Efficient verification of foreign keys&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Oracle does the following when you issue a DML&lt;br /&gt;After the normal syntax, semantics and security checking etc...&lt;br /&gt;it would...&lt;br /&gt;1. Insert/modify the data into database buffers&lt;br /&gt;- This is the actual data that would subsequently be written to data files on the disks&lt;br /&gt;2. Create redo log records&lt;br /&gt;- These records are written to redo log files&lt;br /&gt;- These are used to recover from an instance failure or crash&lt;br /&gt;3. Create undo records (Rollback info)&lt;br /&gt;- These records are written to rollback segments&lt;br /&gt;- These records are used in case you decide to rollback&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So, as you can see each DML, results in a flurry of activity which means batch jobs that deal with huge amounts of data would have unacceptable performance unless special measures are taken as described next.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Handling huge inserts&lt;br /&gt;&lt;/strong&gt;Normal insert&lt;br /&gt;SQL&amp;gt; insert&lt;br /&gt;2 into abc&lt;br /&gt;3 select * from xyz ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;978816 rows created. &lt;/p&gt;&lt;br /&gt;&lt;p&gt;Elapsed: 00:08:18.08&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Statistics&lt;br /&gt;-------------------------------------------------&lt;br /&gt;106586580 redo size&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Obviously the above insert is not very efficient. It took about 8+ minutes to insert just under a million rows.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Now let us look at a turbo charged version of insert command called &lt;strong&gt;Direct Load Insert&lt;/strong&gt; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;SQL&amp;gt; insert /*+ append */&lt;br /&gt;2 into abc&lt;br /&gt;3 select * from xyz&lt;br /&gt;4 nologging ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;978816 rows created.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Elapsed: 00:00:12.30&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Statistics&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;241716 redo size&lt;/p&gt;&lt;br /&gt;&lt;p&gt;“&lt;strong&gt;Direct load insert&lt;/strong&gt;” works differently than a Normal insert. It completely by passes the 3 steps (mentioned previously) that occur for a normal DML and directly writes to the data files of the oracle database.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;You should use “&lt;strong&gt;Direct load insert&lt;/strong&gt;” whenever you do huge inserts.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Handling large Updates&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Say you have a 30 million row table and your update affects 5 Millions rows - How would you do it ?&lt;br /&gt;The normal approach would be to execute an update statement similar to the one shown in the example below&lt;/p&gt;&lt;br /&gt;&lt;p&gt;update aBigTable&lt;br /&gt;set column1 = column1 + column1 * 0.10&lt;br /&gt;where column3 = 'Y'&lt;br /&gt;;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;What do you think will happen if you executed the previous update? &lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Best case scenario&lt;br /&gt;&lt;/strong&gt;1. Your update finishes after running zillion hours without actually running out of rollback segment space&lt;br /&gt;2. Because your update brought everything else to a grinding halt - Help desk gets inundated by calls from other users of the database wanting to know if the database has left the building!!!.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Worst case scenario&lt;br /&gt;&lt;/strong&gt;1. Your update takes zillion hours and then fails after running out of rollback segment space&lt;br /&gt;2. Because your update brought everything else to a grinding halt - Help desk gets inundated by calls from other users of the database .&lt;br /&gt;3. Your access privileges to the database may get revoked&lt;br /&gt;As you can see even the best case scenario is not particularly good…&lt;br /&gt;let us look at a better way of doing large updates&lt;br /&gt;--&lt;br /&gt;-- Create an empty table&lt;br /&gt;--&lt;br /&gt;create table aBigTable_temp&lt;br /&gt;nologging&lt;br /&gt;as select * from aBigTable where rownum &amp;lt; 1 ;&lt;br /&gt;insert /*+ append */&lt;br /&gt;into aBigTable_temp (column1,column2,column3)&lt;br /&gt;select decode (column3, 'Y', (column1 + column1 * 0.10), column1)&lt;br /&gt;, column2&lt;br /&gt;, column3&lt;br /&gt;from aBigTable ;&lt;br /&gt;commit ;&lt;br /&gt;rename aBigTable to aBigTable_old ;&lt;br /&gt;rename aBigTable_temp to aBigTable ;&lt;br /&gt;--&lt;br /&gt;-- Notice how column1 is handled in the select clause of the insert ..select .. statement&lt;br /&gt;--&lt;br /&gt;--&lt;br /&gt;-- create any needed indices on aBigTable&lt;br /&gt;--&lt;br /&gt;Your index creation statements go here.&lt;br /&gt;--&lt;br /&gt;-- Check if data in table aBigTable is OK and drop aBigTable_old&lt;br /&gt;--&lt;br /&gt;drop table aBigTable_old ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The above steps would complete in far less time than it takes the normal update&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Handling large Deletes&lt;br /&gt;&lt;/strong&gt;Say you have a 30 million row table and you need to delete 5 Millions rows - How would you do it&lt;br /&gt;The normal approach would be to execute the following sql statement&lt;br /&gt;&lt;br /&gt;Delete from xyz&lt;br /&gt;where column3 = 'Y‘ ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;What do you think will happen ?&lt;br /&gt;The best and worst case scenarios would be more or less the same as that for an update described previously.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Recommended approach&lt;br /&gt;--&lt;br /&gt;-- Create an empty table&lt;br /&gt;--&lt;br /&gt;create table temp_table&lt;br /&gt;nologging&lt;br /&gt;as select * from xyz where rownum &amp;lt; 1 ;&lt;br /&gt;--&lt;br /&gt;-- Load the rows that you want to keep in the temp table&lt;br /&gt;--&lt;br /&gt;insert /*+ append */&lt;br /&gt;into temp_table (column1,column2,column3)&lt;br /&gt;select column1 , column2 , column3&lt;br /&gt;from xyz&lt;br /&gt;where column3 != 'Y‘ ;&lt;br /&gt;commit ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;rename xyz xyz_old ;&lt;br /&gt;rename xyz_temp xyz ;&lt;br /&gt;--&lt;br /&gt;-- create any needed indices on xyz&lt;br /&gt;--&lt;br /&gt;Your index creation code goes here.&lt;br /&gt;--&lt;br /&gt;-- Check if data in table xyz is OK and drop xyz_old&lt;br /&gt;--&lt;br /&gt;drop table xyz_old ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Efficient Duplicates elimination&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Many times we are faced with situations that require us to design a load script that loads data with duplicates.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Normal method of eliminating duplicates&lt;br /&gt;&lt;/strong&gt;1.Define a unique index on the table and load data.&lt;br /&gt;2.Load the data using sqlldr conventional path (direct path load can not be used because of the index)&lt;br /&gt;sqlldr rejects Duplicate rows and writes them to badfile. But this unique key checking incurs a very big performance penalty. For example in my testing sqlldr took 28 minutes to load little over a million rows with one duplicate row. Using the normal method, the time it takes to eliminate duplicates grows exponentially with the size of data. So this method is not practical for bulk data loading.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Method to eliminate duplicates efficiently&lt;br /&gt;&lt;/strong&gt;Oracle assigns a unique rowid to each row in a table. So each row in a table has unique rowid even if the data within the row is duplicated.&lt;br /&gt;In oracle the fastest path to data is the path that uses rowids. So if we can identify the rowids of duplicates then we can use those rowids to delete them from the table very fast.&lt;br /&gt;The sample delete statement given next , identifies the duplicates and deletes them. &lt;/p&gt;&lt;br /&gt;&lt;p&gt;This sample delete statement is explained using an example in subsequent slides &lt;/p&gt;&lt;br /&gt;&lt;p&gt;delete from xyz&lt;br /&gt;where rowid in&lt;br /&gt;(&lt;br /&gt;--&lt;br /&gt;-- This select gets all the rowids&lt;br /&gt;--&lt;br /&gt;select a.rowid&lt;br /&gt;from xyz&lt;br /&gt;minus&lt;br /&gt;--&lt;br /&gt;-- This select gets rowids of the first row for each duplicated value for the&lt;br /&gt;-- column in the group by clause&lt;br /&gt;--&lt;br /&gt;select min(rowid)&lt;br /&gt;from xyz&lt;br /&gt;group by unique_key_col&lt;br /&gt;) ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The minus operation gives us the row ids of all the duplicates that can be deleted from the table. Thus, we will have only one row for each set of duplicates in the table after the deletion th&lt;br /&gt;us ridding the table of duplicates.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;I use a table called emp_sal to explain the above delete statement whose contents are shown below&lt;br /&gt;EMPID DEPTID SAL&lt;br /&gt;---------- ---------- ----------&lt;br /&gt;1 SALES 36000&lt;br /&gt;2 SALES 38000&lt;br /&gt;3 SALES 42000&lt;br /&gt;4 ACCTS 36000&lt;br /&gt;5 ACCTS 38000&lt;br /&gt;5 ACCTS 42000&lt;br /&gt;5 ACCTS 42000&lt;br /&gt;5 ACCTS 38000&lt;br /&gt;7 SALES 42000&lt;br /&gt;7 SALES 35000&lt;br /&gt;9 IT 42000&lt;br /&gt;10 IT 45000&lt;br /&gt;11 IT 52000&lt;br /&gt;12 IT 55000&lt;br /&gt;13 SALES 35000&lt;br /&gt;15 rows selected.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;This gives all rows including duplicates&lt;/p&gt;&lt;br /&gt;&lt;p&gt;SQL&amp;gt; select a.rowid , a.empid from emp_sal a&lt;br /&gt;2 order by empid ;&lt;br /&gt;ROWID EMPID&lt;br /&gt;------------------ ----------&lt;br /&gt;AAAYPOAAJAABio4AAA 1&lt;br /&gt;AAAYPOAAJAABio4AAB 2&lt;br /&gt;AAAYPOAAJAABio4AAC 3&lt;br /&gt;AAAYPOAAJAABio4AAD 4&lt;br /&gt;AAAYPOAAJAABio4AAE 5&lt;br /&gt;AAAYPOAAJAABio4AAF 5&lt;br /&gt;AAAYPOAAJAABio4AAO 5&lt;br /&gt;AAAYPOAAJAABio4AAN 5&lt;br /&gt;AAAYPOAAJAABio4AAG 7&lt;br /&gt;AAAYPOAAJAABio4AAH 7&lt;br /&gt;AAAYPOAAJAABio4AAI 9&lt;br /&gt;AAAYPOAAJAABio4AAJ 10&lt;br /&gt;AAAYPOAAJAABio4AAK 11&lt;br /&gt;AAAYPOAAJAABio4AAL 12&lt;br /&gt;AAAYPOAAJAABio4AAM 13&lt;br /&gt;15 rows selected.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The following select statement gives all rows but with only one row per duplicated data&lt;/p&gt;&lt;br /&gt;&lt;p&gt;SQL&amp;gt; select min(a.rowid) min_rowid, a.empid&lt;br /&gt;2 from emp_sal a&lt;br /&gt;3 group by empid ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;MIN_ROWID EMPID&lt;br /&gt;------------------ ----------&lt;br /&gt;AAAYPOAAJAABio4AAA 1&lt;br /&gt;AAAYPOAAJAABio4AAB 2&lt;br /&gt;AAAYPOAAJAABio4AAC 3&lt;br /&gt;AAAYPOAAJAABio4AAD 4&lt;br /&gt;AAAYPOAAJAABio4AAE 5&lt;br /&gt;AAAYPOAAJAABio4AAG 7&lt;br /&gt;AAAYPOAAJAABio4AAI 9&lt;br /&gt;AAAYPOAAJAABio4AAJ 10&lt;br /&gt;AAAYPOAAJAABio4AAK 11&lt;br /&gt;AAAYPOAAJAABio4AAL 12&lt;br /&gt;AAAYPOAAJAABio4AAM 13&lt;br /&gt;11 rows selected.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;If we do a diff (minus operation) on the above two sets of data then we get the rowids of the duplicates which we use for deleting.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;SQL&amp;gt; select a.rowid , a.empid from emp_sal a&lt;br /&gt;2 minus&lt;br /&gt;3 select min(a.rowid) , a.empid&lt;br /&gt;4 from emp_sal a&lt;br /&gt;5 group by empid&lt;br /&gt;6 order by empid ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;ROWID EMPID&lt;br /&gt;------------------ ----------&lt;br /&gt;AAAYPOAAJAABio4AAF 5&lt;br /&gt;AAAYPOAAJAABio4AAN 5&lt;br /&gt;AAAYPOAAJAABio4AAO 5&lt;br /&gt;AAAYPOAAJAABio4AAH 7&lt;br /&gt;4 rows selected.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Here is the delete (With all components combined) …&lt;/p&gt;&lt;br /&gt;&lt;p&gt;SQL&amp;gt; delete from emp_sal&lt;br /&gt;2 where rowid in&lt;br /&gt;3 (&lt;br /&gt;4 select a.rowid&lt;br /&gt;5 from emp_sal a&lt;br /&gt;6 minus&lt;br /&gt;7 select min(a.rowid)&lt;br /&gt;8 from emp_sal a&lt;br /&gt;9 group by empid&lt;br /&gt;10 ) ;&lt;br /&gt;4 rows deleted.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So in this method you &lt;/p&gt;&lt;br /&gt;&lt;p&gt;1. Load the table using sqlldr direct path&lt;br /&gt;2. Use a delete statement similar to the one shown on the previous slide to eliminate duplicates&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Using this method I repeated the test of loading a little over million rows with one duplicate row&lt;/p&gt;&lt;br /&gt;&lt;p&gt;1.sqlldr took 58 seconds to load 1065393 rows&lt;br /&gt;2.delete statement took 46 seconds.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So it took less than 2 minutes to load the table and eliminate the duplicates&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Efficient Verification of Foreign Key&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;This is another area that causes performance problems in batch environment.&lt;br /&gt;If you have a foreign key constraint defined for a column in a table, then all the inserts and updates cause Oracle to do a foreign Key checking to make sure that referential integrity is maintained. This means for each insert, Oracle would query the referenced table (parent table) to make sure FK constraint is satisfied. This does not pose a problem if you are dealing with low volumes of data. But this becomes a big issue if you do huge data loads.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So how do you load millions of rows into a table that has foreign keys defined ?&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Following two methods are the most widely used but inefficient methods.&lt;br /&gt;Do the load with foreign keys enabled and only rows that satisfy fk constraints get loaded&lt;br /&gt;or&lt;br /&gt;Do the load with foreign keys disabled.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Then try enabling the fk with a stat&lt;br /&gt;ement similar to the one below&lt;/p&gt;&lt;br /&gt;&lt;p&gt;ALTER TABLE emp&lt;br /&gt;ENABLE VALIDATE CONSTRAINT fk_deptno&lt;br /&gt;EXCEPTIONS INTO exceptions_table&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Both of the above methods are very inefficient and would require big batch windows.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The following method is very efficient for loading tables with FK constraints. It involves 3 steps…&lt;br /&gt;1. Load the table with FK disabled (This will be quick since no FK checking is done)&lt;br /&gt;2. Identify the rows that do not satisfy the FK constraint and delete them&lt;br /&gt;3. Enable foreign key without validating (This will be quick since no FK checking is done)&lt;br /&gt;Following example illustrates the use of the above method.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Desc emp&lt;br /&gt;Name Type&lt;br /&gt;-------------- ------------&lt;br /&gt;EMPNO NUMBER(6)&lt;br /&gt;ENAME VARCHAR2(10)&lt;br /&gt;JOB VARCHAR2(9)&lt;br /&gt;MGR NUMBER(6)&lt;br /&gt;HIREDATE DATE&lt;br /&gt;SAL NUMBER(7,2)&lt;br /&gt;COMM NUMBER(7,2)&lt;br /&gt;DEPTNO NUMBER(2)&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Desc dept&lt;br /&gt;&lt;br /&gt;Name Type&lt;br /&gt;-------------- -------------&lt;br /&gt;DEPTNO NUMBER(2)&lt;br /&gt;DNAME VARCHAR2(14)&lt;br /&gt;LOC VARCHAR2(13)&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Deptno in EMP table references Deptno in DEPT table.&lt;br /&gt;So any new rows inserted into EMP table should have a DEPTNO value that exists in DEPT table.&lt;br /&gt;Now to do a huge data load into EMP table&lt;br /&gt;First Load the data into EMP table with FK disabled.&lt;br /&gt;Then Delete from EMP table deptno values that do not exist in DEPT table as shown next&lt;br /&gt;delete from emp&lt;br /&gt;where rowid in&lt;br /&gt;(-- This gets us the rowids that need to be deleted&lt;br /&gt;select rowid&lt;br /&gt;from emp&lt;br /&gt;where dept_no in&lt;br /&gt;( -- This identifes deptno values that do not exist in DEPT table&lt;br /&gt;select distinct deptno&lt;br /&gt;from emp&lt;br /&gt;minus&lt;br /&gt;select deptno&lt;br /&gt;from dept&lt;br /&gt;)&lt;br /&gt;) ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;After the above step, You can re-enable the foreign key constraint on EMP table without validating. This is because we know that EMP table will have only valid deptno values after the above delete&lt;/p&gt;&lt;br /&gt;&lt;p&gt;ALTER TABLE emp&lt;br /&gt;ENABLE NOVALIDATE CONSTRAINT fk_deptno ;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;This concludes part 1. I have used all the techniques that were described here to make Oracle batch environment perform optimally. I hope you find these techniques useful.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6022245326423942997?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6022245326423942997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/writing-efficient-sql-code-for-oracle_30.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6022245326423942997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6022245326423942997'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/writing-efficient-sql-code-for-oracle_30.html' title='Writing Efficient SQL Code for Oracle - Part 1'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7377207829526078436</id><published>2007-06-17T15:19:00.000-07:00</published><updated>2008-10-25T13:56:23.023-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of restore_datafile_new.ksh</title><content type='html'>Output log of restore_datafile_new.ksh. read this along with restore_datafile_new.ksh script&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jul 17 16:15:13 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database: slsd (DBID=3183102432)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt; 8&amp;gt; 9&amp;gt; 10&amp;gt; 11&amp;gt; 12&amp;gt; 13&amp;gt; 14&amp;gt; 15&amp;gt;&lt;br /&gt;using target database control file instead of recovery catalog&lt;br /&gt;allocated channel: disk_1&lt;br /&gt;channel disk_1: sid=41 devtype=DISK&lt;/p&gt;&lt;p&gt;sql statement: alter database datafile 6 offline&lt;/p&gt;&lt;p&gt;executing command: SET NEWNAME&lt;/p&gt;&lt;p&gt;Starting restore at 17-JUL-07&lt;/p&gt;&lt;p&gt;channel disk_1: starting datafile backupset restore&lt;br /&gt;channel disk_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00006 to /u02/oradata/slsd/new_users01.dbf&lt;br /&gt;channel disk_1: reading from backup piece /u06/flash_recovery_area/slsd/backupset/2007_07_13/o1_mf_nnndf_TAG20070713T142343_39hjzqbh_.bkp&lt;br /&gt;channel disk_1: restored backup piece 1&lt;br /&gt;piece handle=/u06/flash_recovery_area/slsd/backupset/2007_07_13/o1_mf_nnndf_TAG20070713T142343_39hjzqbh_.bkp tag=TAG20070713T142343&lt;br /&gt;channel disk_1: restore complete, elapsed time: 00:00:08&lt;br /&gt;Finished restore at 17-JUL-07&lt;/p&gt;&lt;p&gt;datafile 6 switched to datafile copy&lt;br /&gt;input datafile copy recid=10 stamp=628186526 filename=/u02/oradata/slsd/new_users01.dbf&lt;/p&gt;&lt;p&gt;Starting recover at 17-JUL-07&lt;/p&gt;&lt;p&gt;starting media recovery&lt;/p&gt;&lt;p&gt;archive log thread 1 sequence 3 is already on disk as file /u06/flash_recovery_area/slsd/archivelog/2007_07_14/o1_mf_1_3_39kwb3tf_.arc&lt;br /&gt;archive log thread 1 sequence 4 is already on disk as file /u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_4_39ogg8pf_.arc&lt;br /&gt;archive log thread 1 sequence 5 is already on disk as file /u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_5_39ogtt12_.arc&lt;br /&gt;archive log thread 1 sequence 6 is already on disk as file /u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_6_39ogtvj5_.arc&lt;br /&gt;archive log thread 1 sequence 7 is already on disk as file /u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_7_39ogtxon_.arc&lt;br /&gt;archive log thread 1 sequence 8 is already on disk as file /u06/flash_recovery_area/slsd/archivelog/2007_07_16/o1_mf_1_8_39rb0ylf_.arc&lt;br /&gt;channel disk_1: starting archive log restore to default destination&lt;br /&gt;channel disk_1: restoring archive log&lt;br /&gt;archive log thread=1 sequence=2&lt;br /&gt;channel disk_1: reading from backup piece /u06/flash_recovery_area/slsd/backupset/2007_07_13/o1_mf_annnn_TAG20070713T143007_39hk5kjq_.bkp&lt;br /&gt;channel disk_1: restored backup piece 1&lt;br /&gt;piece handle=/u06/flash_recovery_area/slsd/backupset/2007_07_13/o1_mf_annnn_TAG20070713T143007_39hk5kjq_.bkp tag=TAG20070713T143007&lt;br /&gt;channel disk_1: restore complete, elapsed time: 00:00:02&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_17/o1_mf_1_2_39t8v19h_.arc thread=1 sequence=2&lt;br /&gt;channel default: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_17/o1_mf_1_2_39t8v19h_.arc recid=60 stamp=628186529&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_14/o1_mf_1_3_39kwb3tf_.arc thread=1 sequence=3&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_4_39ogg8pf_.arc thread=1 sequence=4&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_5_39ogtt12_.arc thread=1 sequence=5&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1_6_39ogtvj5_.arc thread=1 sequence=6&lt;br /&gt;media recovery complete, elapsed time: 00:00:04&lt;br /&gt;Finished recover at 17-JUL-07&lt;/p&gt;&lt;p&gt;sql statement: alter database datafile 6 online&lt;br /&gt;released channel: disk_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7377207829526078436?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7377207829526078436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restoredatafilenewksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7377207829526078436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7377207829526078436'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restoredatafilenewksh.html' title='Output log of restore_datafile_new.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-8299315386962355609</id><published>2007-06-17T14:58:00.000-07:00</published><updated>2008-10-25T13:56:23.024-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>restore_datafile_new.ksh</title><content type='html'>This script is for restoring datafile to a new location/name and recovering it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : restore_datafile_new.ksh&lt;br /&gt;## Author      : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring datafile to a new location/name&lt;br /&gt;## and recovering it.&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## To execute this script You need login as a unix id that belongs to DBA group.&lt;br /&gt;## Make sure you have configured the rman automatic channels etc..&lt;br /&gt;## I have tested this script on UNIX/LINUX platform using Oracle 10g.&lt;br /&gt;## Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=slsd&lt;/p&gt;&lt;p&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./rstr_datafile_new.log&lt;/p&gt;&lt;p&gt;connect target /&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Specify the datafile# to be restored and recovered&lt;br /&gt;## Specify new location/name&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;run&lt;br /&gt;{&lt;br /&gt;allocate channel disk_1 device type disk ;&lt;br /&gt;sql "alter database datafile 6 offline" ;&lt;br /&gt;set newname for datafile '/u02/oradata/slsd/users01.dbf' TO '/u02/oradata/slsd/new_users01.dbf' ;&lt;br /&gt;restore datafile 6 ;&lt;br /&gt;switch datafile 6 ;&lt;br /&gt;recover datafile 6 ;&lt;br /&gt;sql "alter database datafile 6 online" ;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;EOF&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-8299315386962355609?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/8299315386962355609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restoredatafilenewksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8299315386962355609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8299315386962355609'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restoredatafilenewksh.html' title='restore_datafile_new.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-5831168087780648110</id><published>2007-06-16T19:00:00.000-07:00</published><updated>2008-10-25T13:56:23.024-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of restore_datafile.ksh</title><content type='html'>This is the output log of restore_datafile.ksh. Read this along with restore_datafile.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jul 16 15:58:15 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database: slsd (DBID=3183102432)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;using target database control file instead of recovery catalog&lt;br /&gt;sql statement: alter database datafile 6 offline&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;Starting restore at 16-JUL-07&lt;br /&gt;allocated channel: ORA_DISK_1&lt;br /&gt;channel ORA_DISK_1: sid=39 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_2&lt;br /&gt;channel ORA_DISK_2: sid=58 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_3&lt;br /&gt;channel ORA_DISK_3: sid=40 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_4&lt;br /&gt;channel ORA_DISK_4: sid=41 devtype=DISK&lt;br /&gt;allocated channel: ORA_SBT_TAPE_1&lt;br /&gt;channel ORA_SBT_TAPE_1: sid=55 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_2&lt;br /&gt;channel ORA_SBT_TAPE_2: sid=42 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_2: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_3&lt;br /&gt;channel ORA_SBT_TAPE_3: sid=63 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_3: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_4&lt;br /&gt;channel ORA_SBT_TAPE_4: sid=56 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_4: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;channel ORA_DISK_1: starting datafile backupset restore&lt;br /&gt;channel ORA_DISK_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00006 to /u02/oradata/slsd/users01.dbf&lt;br /&gt;channel ORA_DISK_1: reading from backup piece /u06/flash_recovery_area/slsd/back&lt;br /&gt;upset/2007_07_13/o1_mf_nnndf_TAG20070713T142343_39hjzqbh_.bkp&lt;br /&gt;channel ORA_DISK_1: restored backup piece 1&lt;br /&gt;piece handle=/u06/flash_recovery_area/slsd/backupset/2007_07_13/o1_mf_nnndf_TAG2&lt;br /&gt;0070713T142343_39hjzqbh_.bkp tag=TAG20070713T142343&lt;br /&gt;channel ORA_DISK_1: restore complete, elapsed time: 00:00:08&lt;br /&gt;Finished restore at 16-JUL-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;Starting recover at 16-JUL-07&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;using channel ORA_SBT_TAPE_1&lt;br /&gt;using channel ORA_SBT_TAPE_2&lt;br /&gt;using channel ORA_SBT_TAPE_3&lt;br /&gt;using channel ORA_SBT_TAPE_4&lt;/p&gt;&lt;p&gt;starting media recovery&lt;/p&gt;&lt;p&gt;archive log thread 1 sequence 3 is already on disk as file /u06/flash_recovery_a&lt;br /&gt;rea/slsd/archivelog/2007_07_14/o1_mf_1_3_39kwb3tf_.arc&lt;br /&gt;archive log thread 1 sequence 4 is already on disk as file /u06/flash_recovery_a&lt;br /&gt;rea/slsd/archivelog/2007_07_15/o1_mf_1_4_39ogg8pf_.arc&lt;br /&gt;archive log thread 1 sequence 5 is already on disk as file /u06/flash_recovery_a&lt;br /&gt;rea/slsd/archivelog/2007_07_15/o1_mf_1_5_39ogtt12_.arc&lt;br /&gt;archive log thread 1 sequence 6 is already on disk as file /u06/flash_recovery_a&lt;br /&gt;rea/slsd/archivelog/2007_07_15/o1_mf_1_6_39ogtvj5_.arc&lt;br /&gt;archive log thread 1 sequence 7 is already on disk as file /u06/flash_recovery_a&lt;br /&gt;rea/slsd/archivelog/2007_07_15/o1_mf_1_7_39ogtxon_.arc&lt;br /&gt;channel ORA_DISK_1: starting archive log restore to default destination&lt;br /&gt;channel ORA_DISK_1: restoring archive log&lt;br /&gt;archive log thread=1 sequence=2&lt;br /&gt;channel ORA_DISK_1: reading from backup piece /u06/flash_recovery_area/slsd/back&lt;br /&gt;upset/2007_07_13/o1_mf_annnn_TAG20070713T143007_39hk5kjq_.bkp&lt;br /&gt;channel ORA_DISK_1: restored backup piece 1&lt;br /&gt;piece handle=/u06/flash_recovery_area/slsd/backupset/2007_07_13/o1_mf_annnn_TAG2&lt;br /&gt;0070713T143007_39hk5kjq_.bkp tag=TAG20070713T143007&lt;br /&gt;channel ORA_DISK_1: restore complete, elapsed time: 00:00:02&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_16/o1_mf_1&lt;br /&gt;_2_39qmhxq7_.arc thread=1 sequence=2&lt;br /&gt;channel default: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_16/o1_mf_1&lt;br /&gt;_2_39qmhxq7_.arc recid=57 stamp=628099133&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_14/o1_mf_1&lt;br /&gt;_3_39kwb3tf_.arc thread=1 sequence=3&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1&lt;br /&gt;_4_39ogg8pf_.arc thread=1 sequence=4&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_15/o1_mf_1&lt;br /&gt;_5_39ogtt12_.arc thread=1 sequence=5&lt;br /&gt;media recovery complete, elapsed time: 00:00:06&lt;br /&gt;Finished recover at 16-JUL-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;sql statement: alter database datafile 6 online&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-5831168087780648110?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/5831168087780648110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restoredatafileksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/5831168087780648110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/5831168087780648110'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restoredatafileksh.html' title='Output log of restore_datafile.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6786063104685820170</id><published>2007-06-16T18:56:00.000-07:00</published><updated>2008-10-25T13:56:23.024-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Restore datafile from disk (restore_datafile.ksh)</title><content type='html'>This script restores datafile from disk to the original location.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : restore_datafile.ksh&lt;br /&gt;## Author      : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring and recovering a datafile from disk.&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## To execute this script You need login as a unix id that belongs to DBA group.&lt;br /&gt;## Make sure you have configured the rman automatic channels etc..&lt;br /&gt;## I have tested this script on UNIX/LINUX platform using Oracle 10g.&lt;br /&gt;## Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=stgd&lt;/p&gt;&lt;p&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./rstr_datafile.log&lt;/p&gt;&lt;p&gt;connect target /&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Specify the datafile# to be restored and recovered&lt;br /&gt;##&lt;br /&gt;sql "alter database datafile 6 offline" ;&lt;br /&gt;restore datafile 6 ;&lt;br /&gt;recover datafile 6 ;&lt;br /&gt;sql "alter database datafile 6 online" ;&lt;/p&gt;&lt;p&gt;EOF&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6786063104685820170?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6786063104685820170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restore-datafile-from-disk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6786063104685820170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6786063104685820170'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restore-datafile-from-disk.html' title='Restore datafile from disk (restore_datafile.ksh)'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6323989041734829050</id><published>2007-06-14T02:38:00.000-07:00</published><updated>2008-10-25T13:56:23.024-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of restore_controlfile_from_tape.ksh</title><content type='html'>Output log of restore_controlfile_from_tape.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jul 13 14:21:58 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database (not started)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;Oracle instance started&lt;/p&gt;&lt;p&gt;Total System Global Area     402653184 bytes&lt;/p&gt;&lt;p&gt;Fixed Size                     2021192 bytes&lt;br /&gt;Variable Size                146802872 bytes&lt;br /&gt;Database Buffers             247463936 bytes&lt;br /&gt;Redo Buffers                   6365184 bytes&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET DBID&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET CONTROLFILE AUTOBACKUP FORMAT&lt;br /&gt;using target database control file instead of recovery catalog&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt; 8&amp;gt; 9&amp;gt;&lt;br /&gt;allocated channel: tape_1&lt;br /&gt;channel tape_1: sid=62 devtype=SBT_TAPE&lt;br /&gt;channel tape_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;Starting restore at 13-JUL-07&lt;/p&gt;&lt;p&gt;channel tape_1: looking for autobackup on day: 20070713&lt;br /&gt;channel tape_1: autobackup found: c-3183102432-20070713-06&lt;br /&gt;channel tape_1: control file restore from autobackup complete&lt;br /&gt;output filename=/u01/oradata/slsd/control01.ctl&lt;br /&gt;output filename=/u05/oradata/slsd/control02.ctl&lt;br /&gt;output filename=/u07/oradata/slsd/control03.ctl&lt;br /&gt;Finished restore at 13-JUL-07&lt;br /&gt;released channel: tape_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;database mounted&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt;&lt;br /&gt;Starting recover at 13-JUL-07&lt;br /&gt;Starting implicit crosscheck backup at 13-JUL-07&lt;br /&gt;allocated channel: ORA_DISK_1&lt;br /&gt;channel ORA_DISK_1: sid=62 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_2&lt;br /&gt;channel ORA_DISK_2: sid=60 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_3&lt;br /&gt;channel ORA_DISK_3: sid=59 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_4&lt;br /&gt;channel ORA_DISK_4: sid=58 devtype=DISK&lt;br /&gt;Crosschecked 8 objects&lt;br /&gt;Finished implicit crosscheck backup at 13-JUL-07&lt;/p&gt;&lt;p&gt;Starting implicit crosscheck copy at 13-JUL-07&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;Finished implicit crosscheck copy at 13-JUL-07&lt;/p&gt;&lt;p&gt;searching for all files in the recovery area&lt;br /&gt;cataloging files...&lt;br /&gt;no files cataloged&lt;/p&gt;&lt;p&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;allocated channel: ORA_SBT_TAPE_1&lt;br /&gt;channel ORA_SBT_TAPE_1: sid=57 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_2&lt;br /&gt;channel ORA_SBT_TAPE_2: sid=56 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_2: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_3&lt;br /&gt;channel ORA_SBT_TAPE_3: sid=55 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_3: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_4&lt;br /&gt;channel ORA_SBT_TAPE_4: sid=54 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_4: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;starting media recovery&lt;/p&gt;&lt;p&gt;archive log thread 1 sequence 3 is already on disk as file /u02/oradata/slsd/red&lt;br /&gt;o3b.rdo&lt;br /&gt;archive log filename=/u02/oradata/slsd/redo3b.rdo thread=1 sequence=3&lt;br /&gt;media recovery complete, elapsed time: 00:00:01&lt;br /&gt;Finished recover at 13-JUL-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;database opened&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6323989041734829050?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6323989041734829050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restorecontrolfilefromtap.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6323989041734829050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6323989041734829050'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restorecontrolfilefromtap.html' title='Output log of restore_controlfile_from_tape.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-8314982243371163805</id><published>2007-06-14T02:19:00.000-07:00</published><updated>2008-10-25T13:56:23.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>restore_controlfile_from_tape.ksh</title><content type='html'>If you have lost all copies of the controlfile then use this script to restore controlfile from your rman tape backup&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : restore_controlfile_from_tape.ksh&lt;br /&gt;## Author      : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring the controlfile from tape (if you have lost all copies of control&lt;br /&gt;## file). It assumes you have an rman backup (that was done with controlfile autobackup)&lt;br /&gt;## availabale on tape&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You have to replace DBID value with the DBID that you are attempting to restore the controlfile&lt;br /&gt;## for. To execute this script You need login as a unix id that belongs to DBA group.&lt;br /&gt;## You have to modify the tape or sbt settings to suit your environment&lt;br /&gt;## Make sure you have configured the rman automatic channels etc..&lt;br /&gt;## I have tested this script on UNIX/LINUX platform using Oracle 10g. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=slsd&lt;/p&gt;&lt;p&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./rstr_controlfile_from_tape.log&lt;/p&gt;&lt;p&gt;CONNECT TARGET /&lt;/p&gt;&lt;p&gt;STARTUP NOMOUNT;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## set dbid because we are not using an rman catalog&lt;br /&gt;##&lt;br /&gt;SET DBID 3183102432 ;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Specify AUTOBACKUP Format&lt;br /&gt;##&lt;br /&gt;SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';&lt;br /&gt;##&lt;br /&gt;## Restore controlfile from autobackup first&lt;br /&gt;##&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt&lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'&lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;RESTORE CONTROLFILE FROM AUTOBACKUP  ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Mount the database with newly restored controlfile&lt;br /&gt;##&lt;br /&gt;alter database mount ;&lt;br /&gt;##&lt;br /&gt;## Issue a "recover database ;" command to make sure that we don't run into&lt;br /&gt;## any "ORA-01152: file 1 was not restored from a sufficiently old backup"&lt;br /&gt;## kind of errors.&lt;br /&gt;## Open the database with "alter database open resetlogs ;"&lt;br /&gt;##&lt;br /&gt;recover database ;&lt;br /&gt;alter database open resetlogs ;&lt;br /&gt;##&lt;br /&gt;## Make sure that you do a complete database backup after opening&lt;br /&gt;## the database with resetlogs option&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;EOF&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-8314982243371163805?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/8314982243371163805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorecontrolfilefromtapeksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8314982243371163805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8314982243371163805'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorecontrolfilefromtapeksh.html' title='restore_controlfile_from_tape.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-4586001260643804882</id><published>2007-06-14T02:16:00.000-07:00</published><updated>2008-10-25T13:56:23.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Outputlog of restore_controlfile.ksh</title><content type='html'>This shows the screen output  that gets produced when restore_controlfile.ksh is run&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jul 13 13:38:13 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database (not started)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;Oracle instance started&lt;/p&gt;&lt;p&gt;Total System Global Area     402653184 bytes&lt;/p&gt;&lt;p&gt;Fixed Size                     2021192 bytes&lt;br /&gt;Variable Size                142608568 bytes&lt;br /&gt;Database Buffers             251658240 bytes&lt;br /&gt;Redo Buffers                   6365184 bytes&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET DBID&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET CONTROLFILE AUTOBACKUP FORMAT&lt;br /&gt;using target database control file instead of recovery catalog&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt;&lt;br /&gt;allocated channel: disk_1&lt;br /&gt;channel disk_1: sid=62 devtype=DISK&lt;/p&gt;&lt;p&gt;Starting restore at 13-JUL-07&lt;/p&gt;&lt;p&gt;recovery area destination: /u06/flash_recovery_area&lt;br /&gt;database name (or database unique name) used for search: slsd&lt;br /&gt;channel disk_1: no autobackups found in the recovery area&lt;br /&gt;channel disk_1: looking for autobackup on day: 20070713&lt;br /&gt;channel disk_1: autobackup found: controlfile_c-3183102432-20070713-03&lt;br /&gt;channel disk_1: control file restore from autobackup complete&lt;br /&gt;output filename=/u01/oradata/slsd/control01.ctl&lt;br /&gt;output filename=/u05/oradata/slsd/control02.ctl&lt;br /&gt;output filename=/u07/oradata/slsd/control03.ctl&lt;br /&gt;Finished restore at 13-JUL-07&lt;br /&gt;released channel: disk_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;database mounted&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt;&lt;br /&gt;Starting recover at 13-JUL-07&lt;br /&gt;Starting implicit crosscheck backup at 13-JUL-07&lt;br /&gt;allocated channel: ORA_DISK_1&lt;br /&gt;channel ORA_DISK_1: sid=62 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_2&lt;br /&gt;channel ORA_DISK_2: sid=60 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_3&lt;br /&gt;channel ORA_DISK_3: sid=59 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_4&lt;br /&gt;channel ORA_DISK_4: sid=58 devtype=DISK&lt;br /&gt;Crosschecked 7 objects&lt;br /&gt;Crosschecked 13 objects&lt;br /&gt;Finished implicit crosscheck backup at 13-JUL-07&lt;/p&gt;&lt;p&gt;Starting implicit crosscheck copy at 13-JUL-07&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;Finished implicit crosscheck copy at 13-JUL-07&lt;/p&gt;&lt;p&gt;searching for all files in the recovery area&lt;br /&gt;cataloging files...&lt;br /&gt;no files cataloged&lt;/p&gt;&lt;p&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;allocated channel: ORA_SBT_TAPE_1&lt;br /&gt;channel ORA_SBT_TAPE_1: sid=57 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_2&lt;br /&gt;channel ORA_SBT_TAPE_2: sid=56 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_2: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_3&lt;br /&gt;channel ORA_SBT_TAPE_3: sid=55 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_3: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_4&lt;br /&gt;channel ORA_SBT_TAPE_4: sid=54 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_4: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;starting media recovery&lt;/p&gt;&lt;p&gt;archive log thread 1 sequence 3 is already on disk as file /u04/oradata/slsd/red&lt;br /&gt;o2a.rdo&lt;br /&gt;archive log filename=/u04/oradata/slsd/redo2a.rdo thread=1 sequence=3&lt;br /&gt;media recovery complete, elapsed time: 00:00:00&lt;br /&gt;Finished recover at 13-JUL-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;database opened&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-4586001260643804882?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/4586001260643804882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/outputlog-of-restorecontrolfileksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4586001260643804882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4586001260643804882'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/outputlog-of-restorecontrolfileksh.html' title='Outputlog of restore_controlfile.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-5140562304576845944</id><published>2007-06-14T02:09:00.000-07:00</published><updated>2008-10-25T13:56:23.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>restore_controlfile.ksh</title><content type='html'>If you have lost all copies of the controlfile then use this script to restore the controlfile from rman disk backup&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : restore_controlfile.ksh&lt;br /&gt;## Author      : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring the controlfile from disk (if you have lost all copies of&lt;br /&gt;## the controlfile). It assumes you have an rman backup (that was done with controlfile&lt;br /&gt;## autobackup option)&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You have to replace DBID value with the DBID that you are attempting to restore the spfile&lt;br /&gt;## for. To execute this script You need login as a unix id that belongs to DBA group.&lt;br /&gt;## Make sure you have configured the rman automatic channels etc..&lt;br /&gt;## I have tested this script on UNIX/LINUX platform using Oracle 10g. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=slsd&lt;/p&gt;&lt;p&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./rstr_controlfile.log&lt;/p&gt;&lt;p&gt;CONNECT TARGET /&lt;/p&gt;&lt;p&gt;STARTUP NOMOUNT;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## set dbid because we are not using an rman catalog&lt;br /&gt;##&lt;br /&gt;SET DBID 3183102432 ;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Specify AUTOBACKUP Format&lt;br /&gt;##&lt;br /&gt;SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F' ;&lt;br /&gt;##&lt;br /&gt;## Restore controlfile from autobackup&lt;br /&gt;##&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL disk_1 DEVICE TYPE disk  ;&lt;br /&gt;RESTORE CONTROLFILE FROM AUTOBACKUP  ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Mount the database with newly restored controlfile&lt;br /&gt;##&lt;br /&gt;alter database mount ;&lt;br /&gt;##&lt;br /&gt;## Issue a "recover database ;" command to make sure that we don't run into&lt;br /&gt;## any "ORA-01152: file 1 was not restored from a sufficiently old backup"&lt;br /&gt;## kind of errors.&lt;br /&gt;## Open the database with "alter database open resetlogs ;"&lt;br /&gt;##&lt;br /&gt;recover database ;&lt;br /&gt;alter database open resetlogs ;&lt;br /&gt;##&lt;br /&gt;## Make sure that you do a complete database backup after opening&lt;br /&gt;## the database with resetlogs option&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;EOF&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-5140562304576845944?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/5140562304576845944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorecontrolfileksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/5140562304576845944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/5140562304576845944'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorecontrolfileksh.html' title='restore_controlfile.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-3165634135691532077</id><published>2007-06-13T04:08:00.000-07:00</published><updated>2008-10-25T13:56:23.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of restore_spfile_from_tape.ksh</title><content type='html'>Output log of restore_spfile_from_tape.ksh,  See restore_spfile_from_tape.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 12 16:12:16 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database (not started)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;startup failed: ORA-01078: failure in processing system parameters&lt;br /&gt;ORA-01565: error in identifying file '/u01/oracle/product/10.2.0/dbs/spfilestgd.&lt;br /&gt;ora'&lt;br /&gt;ORA-27037: unable to obtain file status&lt;br /&gt;IBM AIX RISC System/6000 Error: 2: No such file or directory&lt;br /&gt;Additional information: 3&lt;/p&gt;&lt;p&gt;starting Oracle instance without parameter file for retrival of spfile&lt;br /&gt;Oracle instance started&lt;/p&gt;&lt;p&gt;Total System Global Area     159383552 bytes&lt;/p&gt;&lt;p&gt;Fixed Size                     2019328 bytes&lt;br /&gt;Variable Size                 67108864 bytes&lt;br /&gt;Database Buffers              83886080 bytes&lt;br /&gt;Redo Buffers                   6369280 bytes&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET DBID&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET CONTROLFILE AUTOBACKUP FORMAT&lt;br /&gt;using target database control file instead of recovery catalog&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt; 8&amp;gt; 9&amp;gt;&lt;br /&gt;allocated channel: tape_1&lt;br /&gt;channel tape_1: sid=37 devtype=SBT_TAPE&lt;br /&gt;channel tape_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;Starting restore at 12-JUL-07&lt;/p&gt;&lt;p&gt;channel tape_1: looking for autobackup on day: 20070712&lt;br /&gt;channel tape_1: autobackup found: c-3183102432-20070712-02&lt;br /&gt;channel tape_1: SPFILE restore from autobackup complete&lt;br /&gt;Finished restore at 12-JUL-07&lt;br /&gt;released channel: tape_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;Oracle instance shut down&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database (not started)&lt;br /&gt;Oracle instance started&lt;br /&gt;database mounted&lt;br /&gt;database opened&lt;/p&gt;&lt;p&gt;Total System Global Area     402653184 bytes&lt;/p&gt;&lt;p&gt;Fixed Size                     2021192 bytes&lt;br /&gt;Variable Size                130025656 bytes&lt;br /&gt;Database Buffers             264241152 bytes&lt;br /&gt;Redo Buffers                   6365184 bytes&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-3165634135691532077?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/3165634135691532077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restorespfilefromtapeksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3165634135691532077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3165634135691532077'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restorespfilefromtapeksh.html' title='Output log of restore_spfile_from_tape.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-3594567684752888059</id><published>2007-06-13T04:05:00.000-07:00</published><updated>2008-10-25T13:56:23.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>restore_spfile_from_tape.ksh</title><content type='html'>This script is for restoring the spfile from tape to default location.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : restore_spfile_from_tape.ksh&lt;br /&gt;## Author      : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring the spfile from tape to default location.&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You have to replace DBID value with the DBID that you are attempting to restore the spfile for.&lt;br /&gt;## You have to modify sbt settings to suit your environment.&lt;br /&gt;## To execute this script You need login as a unix id that belongs to DBA group.&lt;br /&gt;## I have tested this script on UNIX/LINUX platform using Oracle 10g. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=slsd&lt;/p&gt;&lt;p&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./rstr_spfile_from_tape.log&lt;/p&gt;&lt;p&gt;CONNECT TARGET /&lt;/p&gt;&lt;p&gt;STARTUP FORCE NOMOUNT;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## set dbid because we are not using an rman catalog&lt;br /&gt;##&lt;br /&gt;SET DBID 3183102432 ;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Specify AUTOBACKUP Format&lt;br /&gt;##&lt;br /&gt;SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';&lt;br /&gt;##&lt;br /&gt;## Restore spfile from autobackup first&lt;br /&gt;##&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL tape_1 DEVICE TYPE sbt&lt;br /&gt;PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'&lt;br /&gt;FORMAT '%u_%p_%c' ;&lt;br /&gt;RESTORE SPFILE FROM AUTOBACKUP  ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Restart the database with newly restored SPFILE&lt;br /&gt;##&lt;br /&gt;SHUTDOWN IMMEDIATE;&lt;br /&gt;STARTUP ;&lt;/p&gt;&lt;p&gt;EOF&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-3594567684752888059?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/3594567684752888059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorespfilefromtapeksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3594567684752888059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3594567684752888059'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorespfilefromtapeksh.html' title='restore_spfile_from_tape.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-4156670579877100692</id><published>2007-06-13T04:01:00.000-07:00</published><updated>2008-10-25T13:56:23.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of restore_spfile.ksh</title><content type='html'>&lt;p&gt;Output log of restore_spfile.ksh, see restore_spfile.ksh to make sense of this log&lt;/p&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://dbtechblog.blogspot.com/2007/06/output-log-of-restorespfileksh.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-4156670579877100692?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/4156670579877100692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restorespfileksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4156670579877100692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4156670579877100692'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-restorespfileksh.html' title='Output log of restore_spfile.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-8094588658650677764</id><published>2007-06-13T03:57:00.000-07:00</published><updated>2008-10-25T13:56:23.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='rman scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>restore_spfile.ksh</title><content type='html'>This script is for restoring the spfile from disk to default location&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : restore_spfile.ksh&lt;br /&gt;## Author      : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script is for restoring the spfile from disk to default location.&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## You have to replace DBID value with the DBID that you are attempting to restore the spfile for.&lt;br /&gt;## To execute this script You need login as a unix id that belongs to DBA group.&lt;br /&gt;## I have tested this script on UNIX/LINUX platform using Oracle 10g. Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=stgd&lt;/p&gt;&lt;p&gt;rman &amp;lt;&amp;lt; EOF &amp;gt; ./rstr_spfile.log&lt;/p&gt;&lt;p&gt;CONNECT TARGET /&lt;/p&gt;&lt;p&gt;STARTUP FORCE NOMOUNT;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## set dbid because we are not using an rman catalog&lt;br /&gt;##&lt;br /&gt;SET DBID 3183102432 ;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Specify AUTOBACKUP Format&lt;br /&gt;##&lt;br /&gt;SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F' ;&lt;br /&gt;##&lt;br /&gt;## Restore spfile from autobackup first&lt;br /&gt;##&lt;br /&gt;RUN {&lt;br /&gt;ALLOCATE CHANNEL disk_1 DEVICE TYPE disk  ;&lt;br /&gt;RESTORE SPFILE FROM AUTOBACKUP  ;&lt;br /&gt;}&lt;br /&gt;##&lt;br /&gt;## Restart the database with newly restored SPFILE&lt;br /&gt;##&lt;br /&gt;SHUTDOWN IMMEDIATE;&lt;br /&gt;STARTUP ;&lt;/p&gt;&lt;p&gt;EOF&lt;br /&gt;##&lt;br /&gt;## End of restore_spfile.ksh&lt;br /&gt;##&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-8094588658650677764?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/8094588658650677764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorespfileksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8094588658650677764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8094588658650677764'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/restorespfileksh.html' title='restore_spfile.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-8541033731807410953</id><published>2007-06-07T15:01:00.000-07:00</published><updated>2008-10-25T13:56:23.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Developer'/><title type='text'>Normalization process explained</title><content type='html'>I will attempt to explain the normalization process by taking you through the process step by step using an example.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The purpose of normalization process , to state in layman's terms -  is to eliminate data redundancy, data maintenance (insert, update and delete) anomalies and to establish relationships  between the tables that make logical sense&lt;br /&gt;Generally speaking, normalization process involves splitting of a non normalized table (or a lump of data) into multiple normalized tables.&lt;/p&gt;&lt;p&gt;Let us start by looking at the following fictitious invoices and try to design tables that are in 3rd normal form and that can capture the data in the fictitious invoices.&lt;/p&gt;&lt;p&gt;---------------------------------------------------------------------------------------&lt;/p&gt;&lt;p&gt;Inv No : 345987&lt;br /&gt;Inv  Dt : 08/08/2005&lt;/p&gt;&lt;p&gt;Customer Type : R     Customer Type Desc : Retail &lt;/p&gt;&lt;p&gt;Custome Id : 621&lt;br /&gt;PC Center Inc&lt;br /&gt;Address    : 123, Peach street, Atlanta, GA 30035&lt;/p&gt;&lt;p&gt;Item no   Description                             Quantity         Amount (USD)&lt;br /&gt;123       Keyboard                                      50              500.00&lt;br /&gt;987       IDE hard disk  80 GB                          30             1200.00&lt;br /&gt;                                                                ---------------&lt;br /&gt;                                             Total                     1700.00&lt;/p&gt;&lt;p&gt;---------------------------------------------------------------------------------------&lt;/p&gt;&lt;p&gt;Inv No : 355987&lt;br /&gt;Inv  Dt : 08/10/2006&lt;/p&gt;&lt;p&gt;Customer Type : W     Customer Type Desc : Wholesale&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Custome Id : 525&lt;br /&gt;PC  Mart Inc&lt;br /&gt;Address    : 56, Carrington Cove, Atlanta, GA 30029&lt;/p&gt;&lt;p&gt;Item no   Description                             Quantity        Amount (USD)&lt;br /&gt;481       Optical Mouse                               500             2500.00&lt;br /&gt;987       IDE hard disk  80 GB                        300            10000.00&lt;br /&gt;                                                              ----------------&lt;br /&gt;                                             Total                   12500.00&lt;br /&gt;---------------------------------------------------------------------------------------&lt;/p&gt;&lt;p&gt;As a first cut, we create a table that will capture the above data. Each invoice will be a record in this table.&lt;br /&gt;Let us call this table invoice_lump and choose inv_no as the primary key.&lt;/p&gt;&lt;p&gt;shown below is this invoice_lump table  with the above invoice data. Click on the table name if you want to see an unwrapped version of this table&lt;/p&gt;&lt;p&gt;Table_Name : &lt;a title="invoice_lump table" href="http://www.somberi.com/invoice_lump.html" target="_blank"&gt;invoice_lump&lt;/a&gt;    Primary key : inv_no&lt;/p&gt;&lt;p&gt;Inv_no Inv_date   CustId CustName       CustAddr           CustCity  CustState CustZip CustType CustTypeDesc Item_1_No Item_1_Desc      Item_1_Qty Item_1_Amt Item_2_No Item_2_Desc          Item_2_Qty Item_2_Amt&lt;br /&gt;345987 08/08/2005    621 PC Center Inc  123, Peach street   Atlanta  GA        30035   R        Retail             123 Keyboard                 50     500.00       987 IDE hard disk(80 GB)         30    1200.00&lt;br /&gt;355987 08/10/2006    525 PC Mart Inc    56, Carrington Cove Atlanta  GA        30029   W        Wholesale          481 Optical Mouse           500    2500.00       987 IDE hard disk(80 GB)        300   10000.00&lt;/p&gt;&lt;p&gt;You can see straight away the problems with the above table as listed below...&lt;br /&gt;If an invoce contains more than 2 items then we will need to add more columns to accomadate those items.&lt;br /&gt;The customer and item information is redundently repeated in the table. &lt;br /&gt;If we need to update a customer address or item desc then we will have to do a full table scan which is ineffecient.&lt;br /&gt;You can not add a new customer that never placed an order or add a new item information that does not have sales.&lt;/p&gt;&lt;p&gt;The process of normalization is aimed at resolving the above issues by designing tables in such a way that the above&lt;br /&gt;problems are eliminated. So let us start normalizing the invoice_lump table.&lt;/p&gt;&lt;p&gt;First Normal Form &lt;/p&gt;&lt;p&gt;A table is said to be in  First Normal Form if it has no repeating elements or groups of elements.&lt;br /&gt;The repeating groups should be moved into their own tables to conform to First Normal Form.&lt;/p&gt;&lt;p&gt;We can immediately see that Item information is  repeating  since each invoice  can have multiple items. So we split the invoice_lump table into 2 tables as shown below.&lt;/p&gt;&lt;p&gt;Table : INV_HDR, Primary Key ; Inv_No         &lt;/p&gt;&lt;p&gt;Inv_no Inv_date   CustId CustName       CustAddr           CustCity  CustState CustZi&lt;br /&gt;p CustType CustTypeDesc&lt;br /&gt;345987 08/08/2005    621 PC Center Inc  123, Peach street   Atlanta  GA        30035   R        Retail      &lt;br /&gt;355987 08/10/2006    525 PC Mart Inc    56, Carrington Cove Atlanta  GA        30029   W        Wholesale   &lt;/p&gt;&lt;p&gt;Table : INV_LINES, Primary Key ; Inv_No ,Item_No      &lt;/p&gt;&lt;p&gt;Inv_no Item_No Item_Desc             Item_Qty Item_Amt&lt;br /&gt;345987     123 Keyboard                    50   500.00&lt;br /&gt;345987     987 IDE hard disk(80 GB)        30  1200.00&lt;br /&gt;355987     481 Optical Mouse              500  2500.00      &lt;br /&gt;355987     987 IDE hard disk(80 GB)       300  10000.00&lt;/p&gt;&lt;p&gt;The above tables have no repeating elements or groups of elements. So they are in First Normal Form.&lt;/p&gt;&lt;p&gt;The above table still have the problem of data redundancy. To address this we will need to further normalize the tables.&lt;/p&gt;&lt;p&gt;Second Normal Form &lt;/p&gt;&lt;p&gt;A table is said to be in  Second Normal Form if it meets the First Normal Form requirement and  &lt;br /&gt;if  every non-key field in that table is functionally dependent on the entire PK. There should be no partial dependencies.&lt;/p&gt;&lt;p&gt;Now let us examine the above two tables (inv_hdr and inv_lines)  and see if they conform to Second Normal Form.&lt;/p&gt;&lt;p&gt;These tables already conform to First Normal Form so they partially meet Second Normal Form requirement already.&lt;/p&gt;&lt;p&gt;We can see that in the inv_hdr table the Customer attributes are not functionally dependent on  inv_no (which is the PK ).&lt;br /&gt;Hence the Customer attributes need to be separated into their own table.&lt;/p&gt;&lt;p&gt;In the inv_lines table, the item attributes  are only dependent on Item_no column of the PK which constitutes partially dependency.&lt;br /&gt;Hence the item attributes need to be separated into their own table.&lt;/p&gt;&lt;p&gt;So We split inv_hdr table into inv_hdr and Customer_mstr tables and we split inv_lines into inv_lines and  Item_mstr tables. &lt;/p&gt;&lt;p&gt;Table : INV_HDR, Primary Key : Inv_No         &lt;/p&gt;&lt;p&gt;Inv_no Inv_date   CustId&lt;br /&gt;345987 08/08/2005    621&lt;br /&gt;355987 08/10/2006    525 &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Table : CUSTOMER_MSTR, Primary Key ; CustId&lt;/p&gt;&lt;p&gt;CustId CustName       CustAddr            CustCity  CustState CustZip CustType CustTypeDesc&lt;br /&gt;   621 PC Center Inc  123, Peach street   Atlanta   GA        30035   R        Retail      &lt;br /&gt;   525 PC Mart Inc    56, Carrington Cove Atlanta   GA        30029   W        Wholesale   &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Table : INV_LINES, Primary Key : Inv_No ,Item_No      &lt;/p&gt;&lt;p&gt;Inv_no Item_No Item_Qty Item_Amt&lt;br /&gt;345987     123      50    500.00&lt;br /&gt;345987     987      30   1200.00&lt;br /&gt;355987     481     500   2500.00      &lt;br /&gt;355987     987     300  10000.00&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Table : ITEM_MSTR, Primary Key : Item_No      &lt;/p&gt;&lt;p&gt;Item_No Item_Desc           &lt;br /&gt;    123 Keyboard            &lt;br /&gt;    481 Optical Mouse       &lt;br /&gt;    987 IDE hard disk(80 GB) &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The above tables are in Second Normal Form because&lt;br /&gt;- they meet the requirement for First Normal Form&lt;br /&gt;- all non-key fields are functionally dependent on the PK in each of these tables   &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Third Normal Form &lt;/p&gt;&lt;p&gt;A table is said to be in  Third Normal Form  if it meets the Second Normal Form requirement  &lt;br /&gt;and there are no transitive dependencies   &lt;br /&gt; &lt;br /&gt;If a non-key field is functionally dependent on another non-key field and is indirectly dependent on  the primary key through that non-key field then that constitutes a transitive dependency .&lt;/p&gt;&lt;p&gt;Of the above 4 tables we can only see the transitive dependency in the customer_mstr table.&lt;br /&gt;The rest of the tables have no transitive dependencies, hence they already conform to TNF.&lt;/p&gt;&lt;p&gt;The Customer_mstr table has a field called CustTypeDesc which is dependent on a non-key field called CustType.&lt;br /&gt;The field CustTypeDesc is dependent on the CustId field (which is the PK)  through the CustType field.&lt;br /&gt;This constitutes transitive dependency.     &lt;br /&gt;Hence we have to split that relationship into another table in order to bring the Customer_Mstr table into TNF &lt;/p&gt;&lt;p&gt;Table : CUSTOMER_MSTR, Primary Key ; CustId&lt;/p&gt;&lt;p&gt;CustId CustName       CustAddr            CustCity  CustState CustZip CustType&lt;br /&gt;   621 PC Center Inc  123, Peach street   Atlanta   GA        30035   R      &lt;br /&gt;   525 PC Mart Inc    56, Carrington Cove Atlanta   GA        30029   W       &lt;/p&gt;&lt;p&gt;Table : CUSTTYPE_LKUP, Primary Key ; CustId&lt;/p&gt;&lt;p&gt;CustType CustTypeDesc&lt;br /&gt;R        Retail      &lt;br /&gt;W        Wholesale   &lt;/p&gt;&lt;p&gt;&lt;br /&gt;The above tables are in Third Normal Form because&lt;br /&gt;- they meet the requirement for Second Normal Form&lt;br /&gt;- there are no transitive dependencies    &lt;/p&gt;&lt;p&gt;This completes the normalization process of the INVOICE_LUMP table.&lt;/p&gt;&lt;p&gt;We started with a single non normalized table and ended up with 5 separate tables that are in third normal form.&lt;br /&gt;You can see  that in each of the above normalized tables, every non-key field depends on the primary key, the complete primary key and nothing but the primary key.&lt;/p&gt;&lt;p&gt;I hope this article helps you understand the process of normalization.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-8541033731807410953?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/8541033731807410953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/normalization-process-explained.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8541033731807410953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/8541033731807410953'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/normalization-process-explained.html' title='Normalization process explained'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-4493106641839607407</id><published>2007-06-03T13:19:00.000-07:00</published><updated>2008-10-25T13:56:23.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of rman_bkup.ksh</title><content type='html'>This shows the output log of rman_bkup.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;---------------------------------------------------------&lt;br /&gt;Tue Jun 26 14:26:50 EDT 2007&lt;br /&gt;---------------- rman_bkup.ksh started ------------------&lt;br /&gt;sls1&lt;br /&gt;oracle&lt;br /&gt;/u01/oracle/product/agent10g/bin/rman&lt;/p&gt;&lt;p&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 26 14:26:50 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database: sls1 (DBID=1522268517)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;using target database control file instead of recovery catalog&lt;br /&gt;RMAN configuration parameters are:&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1;&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br /&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default&lt;br /&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br /&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' FORMAT   '%u_%p_%c';&lt;br /&gt;CONFIGURE MAXSETSIZE TO UNLIMITED; # default&lt;br /&gt;CONFIGURE ENCRYPTION FOR DATABASE OFF; # default&lt;br /&gt;CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default&lt;br /&gt;CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default&lt;br /&gt;CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/product/10.2.0/dbs/snapcf_sls1.f'; # default&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt; &lt;/p&gt;&lt;p&gt;Starting backup at 26-JUN-07&lt;br /&gt;current log archived&lt;br /&gt;allocated channel: ORA_DISK_1&lt;br /&gt;channel ORA_DISK_1: sid=134 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_2&lt;br /&gt;channel ORA_DISK_2: sid=133 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_3&lt;br /&gt;channel ORA_DISK_3: sid=132 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_4&lt;br /&gt;channel ORA_DISK_4: sid=141 devtype=DISK&lt;br /&gt;channel ORA_DISK_1: starting archive log backupset&lt;br /&gt;channel ORA_DISK_1: specifying archive log(s) in backup set&lt;br /&gt;input archive log thread=1 sequence=16 recid=417 stamp=626279214&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142658_382pmmo0_.bkp tag=TAG20070626T142658 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02&lt;br /&gt;channel ORA_DISK_1: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/sls1/archivelog/2007_06_26/o1_mf_1_16_382pmgt9_.arc recid=417 stamp=626279214&lt;br /&gt;Finished backup at 26-JUN-07&lt;/p&gt;&lt;p&gt;Starting backup at 26-JUN-07&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;channel ORA_DISK_1: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_1: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00004 name=/u03/oradata/sls1/sls1_data_01.dbf&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_2: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_2: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00005 name=/u03/oradata/sls1/sls1_data_02.dbf&lt;br /&gt;channel ORA_DISK_2: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_3: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_3: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00007 name=/u04/oradata/sls1/sls1_index_01.dbf&lt;br /&gt;channel ORA_DISK_3: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_4: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_4: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00009 name=/u05/oradata/sls1/sls1aud_arch_01.dbf&lt;br /&gt;channel ORA_DISK_4: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_4: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382pms0g_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_4: backup set complete, elapsed time: 00:05:56&lt;br /&gt;channel ORA_DISK_4: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_4: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00012 name=/u05/oradata/sls1/sls1hist_arch_01.dbf&lt;br /&gt;channel ORA_DISK_4: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_3: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382pmpqw_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_3: backup set complete, elapsed time: 00:06:33&lt;br /&gt;channel ORA_DISK_3: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_3: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00001 name=/u02/oradata/sls1/system01.dbf&lt;br /&gt;channel ORA_DISK_3: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_3: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382q019s_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_3: backup set complete, elapsed time: 00:03:35&lt;br /&gt;channel ORA_DISK_3: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_3: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00006 name=/u03/oradata/sls1/sls1_data_03.dbf&lt;br /&gt;channel ORA_DISK_3: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382pmpov_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:11:46&lt;br /&gt;channel ORA_DISK_1: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_1: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00008 name=/u04/oradata/sls1/sls1_index_02.dbf&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_2: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382pmppv_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_2: backup set complete, elapsed time: 00:12:14&lt;br /&gt;channel ORA_DISK_2: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_2: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00010 name=/u05/oradata/sls1/sls1aud_arch_02.dbf&lt;br /&gt;channel ORA_DISK_2: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_3: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382q6z41_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_3: backup set complete, elapsed time: 00:04:02&lt;br /&gt;channel ORA_DISK_3: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_3: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00002 name=/u05/oradata/sls1/undotbs01.dbf&lt;br /&gt;channel ORA_DISK_3: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_2: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382qbwdp_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_2: backup set complete, elapsed time: 00:02:14&lt;br /&gt;channel ORA_DISK_2: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_2: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00003 name=/u02/oradata/sls1/sysaux01.dbf&lt;br /&gt;channel ORA_DISK_2: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382q9wwh_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:03:38&lt;br /&gt;channel ORA_DISK_1: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_1:&lt;br /&gt;specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00011 name=/u02/oradata/sls1/users01.dbf&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382qjqpj_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35&lt;br /&gt;channel ORA_DISK_1: starting full datafile backupset&lt;br /&gt;channel ORA_DISK_1: specifying datafile(s) in backupset&lt;br /&gt;input datafile fno=00013 name=/u05/oradata/sls1/FLOW_1.dbf&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_2: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382qh399_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_2: backup set complete, elapsed time: 00:01:58&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382qkxlw_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:04:01&lt;br /&gt;channel ORA_DISK_4: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382pyyjy_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_4: backup set complete, elapsed time: 00:29:02&lt;br /&gt;channel ORA_DISK_3: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_nnndf_TAG20070626T142701_382qgsmc_.bkp tag=TAG20070626T142701 comment=NONE&lt;br /&gt;channel ORA_DISK_3: backup set complete, elapsed time: 00:22:51&lt;br /&gt;Finished backup at 26-JUN-07&lt;/p&gt;&lt;p&gt;Starting backup at 26-JUN-07&lt;br /&gt;current log archived&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;channel ORA_DISK_1: starting archive log backupset&lt;br /&gt;channel ORA_DISK_1: specifying archive log(s) in backup set&lt;br /&gt;input archive log thread=1 sequence=17 recid=418 stamp=626281450&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T150411_382rsf32_.bkp tag=TAG20070626T150411 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02&lt;br /&gt;channel ORA_DISK_1: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/sls1/archivelog/2007_06_26/o1_mf_1_17_382rsb9f_.arc recid=418 stamp=626281450&lt;br /&gt;Finished backup at 26-JUN-07&lt;/p&gt;&lt;p&gt;Starting Control File and SPFILE Autobackup at 26-JUN-07&lt;br /&gt;piece handle=/u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070626-03 comment=NONE&lt;br /&gt;Finished Control File and SPFILE Autobackup at 26-JUN-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN retention policy will be applied to the command&lt;br /&gt;RMAN retention policy is set to redundancy 1&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;allocated channel: ORA_SBT_TAPE_1&lt;br /&gt;channel ORA_SBT_TAPE_1: sid=136 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_2&lt;br /&gt;channel ORA_SBT_TAPE_2: sid=139 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_2: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_3&lt;br /&gt;channel ORA_SBT_TAPE_3: sid=140 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_3: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_4&lt;br /&gt;channel ORA_SBT_TAPE_4: sid=138 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_4: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;Deleting the following obsolete backups and copies:&lt;br /&gt;Type                 Key    Completion Time    Filename/Handle&lt;br /&gt;-------------------- ------ ------------------ --------------------&lt;br /&gt;Backup Set           164    14-JUN-07        &lt;br /&gt;  Backup Piece       230    14-JUN-07          54ik8t17_1_2&lt;br /&gt;Backup Set           164    14-JUN-07        &lt;br /&gt;  Backup Piece       205    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v7rf_.bkp&lt;br /&gt;Backup Set           165    14-JUN-07        &lt;br /&gt;  Backup Piece       231    14-JUN-07          55ik8t17_1_2&lt;br /&gt;Backup Set           165    14-JUN-07        &lt;br /&gt;  Backup Piece       206    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v7tr_.bkp&lt;br /&gt;Backup Set           162    14-JUN-07        &lt;br /&gt;  Backup Piece       229    14-JUN-07          56ik8t17_1_2&lt;br /&gt;Backup Set           162    14-JUN-07        &lt;br /&gt;  Backup Piece       203    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v7vs_.bkp&lt;br /&gt;Backup Set           161    14-JUN-07        &lt;br /&gt;  Backup Piece       202    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v9vs_.bkp&lt;br /&gt;Backup Set           161    14-JUN-07        &lt;br /&gt;  Backup Piece       217    14-JUN-07          57ik8t17_1_2&lt;br /&gt;Backup Set           172    14-JUN-07        &lt;br /&gt;  Backup Piece       225    14-JUN-07          58ik8tcl_1_2&lt;br /&gt;Backup Set           172    14-JUN-07        &lt;br /&gt;  Backup Piece       213    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_37336ohr_.bkp&lt;br /&gt;Backup Set           163    14-JUN-07        &lt;br /&gt;  Backup Piece       218    14-JUN-07          59ik8tdo_1_2&lt;br /&gt;Backup Set           163    14-JUN-07&amp;amp;nb&lt;br /&gt;sp;       &lt;br /&gt;  Backup Piece       204    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_37337snk_.bkp&lt;br /&gt;Backup Set           166    14-JUN-07        &lt;br /&gt;  Backup Piece       219    14-JUN-07          5aik8tjs_1_2&lt;br /&gt;Backup Set           166    14-JUN-07        &lt;br /&gt;  Backup Piece       207    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733g0j5_.bkp&lt;br /&gt;Backup Set           168    14-JUN-07        &lt;br /&gt;  Backup Piece       209    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733kmdh_.bkp&lt;br /&gt;Backup Set           168    14-JUN-07        &lt;br /&gt;  Backup Piece       221    14-JUN-07          5bik8tng_1_2&lt;br /&gt;Backup Set           167    14-JUN-07        &lt;br /&gt;  Backup Piece       220    14-JUN-07          5cik8tol_1_2&lt;br /&gt;Backup Set           167    14-JUN-07        &lt;br /&gt;  Backup Piece       208    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733lswb_.bkp&lt;br /&gt;Backup Set           173    14-JUN-07        &lt;br /&gt;  Backup Piece       214    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733p33c_.bkp&lt;br /&gt;Backup Set           173    14-JUN-07        &lt;br /&gt;  Backup Piece       226    14-JUN-07          5dik8trv_1_2&lt;br /&gt;Backup Set           170    14-JUN-07        &lt;br /&gt;  Backup Piece       223    14-JUN-07          5eik8tsq_1_2&lt;br /&gt;Backup Set           170    14-JUN-07        &lt;br /&gt;  Backup Piece       211    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733pwvf_.bkp&lt;br /&gt;Backup Set           169    14-JUN-07        &lt;br /&gt;  Backup Piece       210    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733rlpk_.bkp&lt;br /&gt;Backup Set           169    14-JUN-07        &lt;br /&gt;  Backup Piece       222    14-JUN-07          5fik8tui_1_2&lt;br /&gt;Backup Set           171    14-JUN-07        &lt;br /&gt;  Backup Piece       224    14-JUN-07          5gik8tvm_1_2&lt;br /&gt;Backup Set           171    14-JUN-07        &lt;br /&gt;  Backup Piece       212    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733srm3_.bkp&lt;br /&gt;Backup Set           174    14-JUN-07        &lt;br /&gt;  Backup Piece       227    14-JUN-07          5hik8v8l_1_2&lt;br /&gt;Backup Set           174    14-JUN-07        &lt;br /&gt;  Backup Piece       215    14-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_annnn_TAG20070614T151741_37352pv5_.bkp&lt;br /&gt;Backup Set           177    15-JUN-07        &lt;br /&gt;  Backup Piece       236    15-JUN-07          5kikb9l5_1_2&lt;br /&gt;Backup Set           177    15-JUN-07        &lt;br /&gt;  Backup Piece       233    15-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_15/o1_mf_annnn_TAG20070615T122717_375hh73n_.bkp&lt;br /&gt;Backup Set           182    26-JUN-07        &lt;br /&gt;  Backup Piece       240    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbd8_.bkp&lt;br /&gt;Backup Set           183    26-JUN-07        &lt;br /&gt;  Backup Piece       241    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbgc_.bkp&lt;br /&gt;Backup Set           184    26-JUN-07        &lt;br /&gt;  Backup Piece       242    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbhd_.bkp&lt;br /&gt;Backup Set           180    26-JUN-07        &lt;br /&gt;  Backup Piece       238    26-JUN-0&lt;br /&gt;7          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbf8_.bkp&lt;br /&gt;Backup Set           181    26-JUN-07        &lt;br /&gt;  Backup Piece       239    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382ofrxg_.bkp&lt;br /&gt;Backup Set           186    26-JUN-07        &lt;br /&gt;  Backup Piece       244    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142413_382pggv5_.bkp&lt;br /&gt;Backup Set           188    26-JUN-07        &lt;br /&gt;  Backup Piece       246    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142533_382pjytc_.bkp&lt;br /&gt;Backup Set           189    26-JUN-07        &lt;br /&gt;  Backup Piece       247    26-JUN-07          /u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070626-02&lt;br /&gt;Backup Set           190    26-JUN-07        &lt;br /&gt;  Backup Piece       248    26-JUN-07          /u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142658_382pmmo0_.bkp&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v7rf_.bkp recid=205 stamp=625243175&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v7tr_.bkp recid=206 stamp=625243175&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v7vs_.bkp recid=203 stamp=625243175&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3732v9vs_.bkp recid=202 stamp=625243177&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_37336ohr_.bkp recid=213 stamp=625243541&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_37337snk_.bkp recid=204 stamp=625243577&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733g0j5_.bkp recid=207 stamp=625243774&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733kmdh_.bkp recid=209 stamp=625243890&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733lswb_.bkp recid=208 stamp=625243928&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733p33c_.bkp recid=214 stamp=625244034&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733pwvf_.bkp recid=211 stamp=625244058&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733rlpk_.bkp recid=210 stamp=625244114&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_nnndf_TAG20070614T143933_3733srm3_.bkp recid=212 stamp=625244151&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_14/o1_mf_annnn_TAG20070614T151741_37352pv5_.bkp recid=215 stamp=625245462&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_15/o1_mf_annnn_TAG20070615T122717_375hh73n_.bkp recid=233 stamp=625321639&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbd8_.bkp recid=240 stamp=626277962&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbgc_.bkp recid=241 stamp=626277962&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbhd_.bkp recid=242 stamp=626277962&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382odbf8_.bkp recid=238 stamp=626277962&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T140558_382ofrxg_.bkp recid=239 stamp=626278008&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142413_382pggv5_.bkp recid=244 stamp=626279054&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142533_382pjytc_.bkp recid=246 stamp=626279134&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070626-02 recid=247 stamp=626279136&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142658_382pmmo0_.bkp recid=248 stamp=626279219&lt;br /&gt;Deleted 24 objects&lt;/p&gt;&lt;p&gt;deleted backup piece&lt;br /&gt;backup piece handle=54ik8t17_1_2 recid=230 stamp=625248833&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=55ik8t17_1_2 recid=231 stamp=625249002&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=56ik8t17_1_2 recid=229 stamp=625248832&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=57ik8t17_1_2 recid=217 stamp=625248832&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=58ik8tcl_1_2 recid=225 stamp=625249429&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=59ik8tdo_1_2 recid=218 stamp=625248849&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5aik8tjs_1_2 recid=219 stamp=625249055&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5bik8tng_1_2 recid=221 stamp=625249186&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5cik8tol_1_2 recid=220 stamp=625249144&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5dik8trv_1_2 recid=226 stamp=625249433&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5eik8tsq_1_2 recid=223 stamp=625249316&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5fik8tui_1_2 recid=222 stamp=625249313&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5gik8tvm_1_2 recid=224 stamp=625249413&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5hik8v8l_1_2 recid=227 stamp=625249481&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=5kikb9l5_1_2 recid=236 stamp=625330580&lt;br /&gt;Deleted 15 objects&lt;/p&gt;&lt;p&gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;Report of database schema&lt;/p&gt;&lt;p&gt;List of Permanent Datafiles&lt;br /&gt;===========================&lt;br /&gt;File Size(MB) Tablespace           RB segs Datafile Name&lt;br /&gt;---- -------- -------------------- ------- ------------------------&lt;br /&gt;1    1024     SYSTEM               ***     /u02/oradata/sls1/system01.dbf&lt;br /&gt;2  &amp;amp;n&lt;br /&gt;bsp; 512      UNDOTBS1             ***     /u05/oradata/sls1/undotbs01.dbf&lt;br /&gt;3    512      SYSAUX               ***     /u02/oradata/sls1/sysaux01.dbf&lt;br /&gt;4    2040     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_01.dbf&lt;br /&gt;5    2040     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_02.dbf&lt;br /&gt;6    1024     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_03.dbf&lt;br /&gt;7    2040     SLS1_INDEX           ***     /u04/oradata/sls1/sls1_index_01.dbf&lt;br /&gt;8    1024     SLS1_INDEX           ***     /u04/oradata/sls1/sls1_index_02.dbf&lt;br /&gt;9    2036     SLS1AUD_ARCH         ***     /u05/oradata/sls1/sls1aud_arch_01.dbf&lt;br /&gt;10   1024     SLS1AUD_ARCH         ***     /u05/oradata/sls1/sls1aud_arch_02.dbf&lt;br /&gt;11   128      USERS                ***     /u02/oradata/sls1/users01.dbf&lt;br /&gt;12   1972     SLS1HIST_ARCH        ***     /u05/oradata/sls1/sls1hist_arch_01.dbf&lt;br /&gt;13   100      FLOW_1               ***     /u05/oradata/sls1/FLOW_1.dbf&lt;/p&gt;&lt;p&gt;List of Temporary Files&lt;br /&gt;=======================&lt;br /&gt;File Size(MB) Tablespace           Maxsize(MB) Tempfile Name&lt;br /&gt;---- -------- -------------------- ----------- --------------------&lt;br /&gt;1    528      TEMP                 1024        /u07/oradata/sls1/temp01.dbf&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;Report of files that need backup due to unrecoverable operations&lt;br /&gt;File Type of Backup Required Name&lt;br /&gt;---- ----------------------- -----------------------------------&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;br /&gt;---------------------------------------------------------&lt;br /&gt;Tue Jun 26 15:05:36 EDT 2007&lt;br /&gt;---------------- rman_bkup.ksh completed ----------------&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-4493106641839607407?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/4493106641839607407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmanbkupksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4493106641839607407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/4493106641839607407'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmanbkupksh.html' title='Output log of rman_bkup.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-643037415761337379</id><published>2007-06-03T12:15:00.000-07:00</published><updated>2008-10-25T13:56:23.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of rman_dr.ksh</title><content type='html'>This is the output log of rman_dr.ksh. Please see rman_dr.ksh also to make sense of this log&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 12 16:33:59 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database (not started)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;startup failed: ORA-01078: failure in processing system parameters&lt;br /&gt;ORA-01565: error in identifying file '/u01/oracle/product/10.2.0/dbs/spfileslsd.&lt;br /&gt;ora'&lt;br /&gt;ORA-27037: unable to obtain file status&lt;br /&gt;IBM AIX RISC System/6000 Error: 2: No such file or directory&lt;br /&gt;Additional information: 3&lt;/p&gt;&lt;p&gt;starting Oracle instance without parameter file for retrival of spfile&lt;br /&gt;Oracle instance started&lt;/p&gt;&lt;p&gt;Total System Global Area     159383552 bytes&lt;/p&gt;&lt;p&gt;Fixed Size                     2019328 bytes&lt;br /&gt;Variable Size                 67108864 bytes&lt;br /&gt;Database Buffers              83886080 bytes&lt;br /&gt;Redo Buffers                   6369280 bytes&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET DBID&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;executing command: SET CONTROLFILE AUTOBACKUP FORMAT&lt;br /&gt;using target database control file instead of recovery catalog&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt; 8&amp;gt; 9&amp;gt;&lt;br /&gt;allocated channel: tape_1&lt;br /&gt;channel tape_1: sid=37 devtype=SBT_TAPE&lt;br /&gt;channel tape_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;Starting restore at 12-JUL-07&lt;/p&gt;&lt;p&gt;channel tape_1: looking for autobackup on day: 20070712&lt;br /&gt;channel tape_1: autobackup found: c-3183102432-20070712-02&lt;br /&gt;channel tape_1: SPFILE restore from autobackup complete&lt;br /&gt;Finished restore at 12-JUL-07&lt;br /&gt;released channel: tape_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;Oracle instance shut down&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database (not started)&lt;br /&gt;Oracle instance started&lt;/p&gt;&lt;p&gt;Total System Global Area     402653184 bytes&lt;/p&gt;&lt;p&gt;Fixed Size                     2021192 bytes&lt;br /&gt;Variable Size                130025656 bytes&lt;br /&gt;Database Buffers             264241152 bytes&lt;br /&gt;Redo Buffers                   6365184 bytes&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt; 8&amp;gt; 9&amp;gt;&lt;br /&gt;allocated channel: tape_1&lt;br /&gt;channel tape_1: sid=62 devtype=SBT_TAPE&lt;br /&gt;channel tape_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;Starting restore at 12-JUL-07&lt;/p&gt;&lt;p&gt;channel tape_1: looking for autobackup on day: 20070712&lt;br /&gt;channel tape_1: autobackup found: c-3183102432-20070712-02&lt;br /&gt;channel tape_1: control file restore from autobackup complete&lt;br /&gt;output filename=/u01/oradata/slsd/control01.ctl&lt;br /&gt;output filename=/u05/oradata/slsd/control02.ctl&lt;br /&gt;output filename=/u07/oradata/slsd/control03.ctl&lt;br /&gt;Finished restore at 12-JUL-07&lt;br /&gt;released channel: tape_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt;&lt;br /&gt;database mounted&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt;&lt;br /&gt;allocated channel: tape_1&lt;br /&gt;channel tape_1: sid=62 devtype=SBT_TAPE&lt;br /&gt;channel tape_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;/p&gt;&lt;p&gt;Starting restore at 12-JUL-07&lt;br /&gt;Starting implicit crosscheck backup at 12-JUL-07&lt;br /&gt;Crosschecked 11 objects&lt;br /&gt;Finished implicit crosscheck backup at 12-JUL-07&lt;/p&gt;&lt;p&gt;Starting implicit crosscheck copy at 12-JUL-07&lt;br /&gt;Finished implicit crosscheck copy at 12-JUL-07&lt;/p&gt;&lt;p&gt;searching for all files in the recovery area&lt;br /&gt;cataloging files...&lt;br /&gt;no files cataloged&lt;/p&gt;&lt;p&gt;&lt;br /&gt;channel tape_1: starting datafile backupset restore&lt;br /&gt;channel tape_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00001 to /u02/oradata/slsd/system01.dbf&lt;br /&gt;channel tape_1: reading from backup piece 08imku8o_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=08imku8o_1_2 tag=TAG20070712T104647&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:01:26&lt;br /&gt;channel tape_1: starting datafile backupset restore&lt;br /&gt;channel tape_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00004 to /u03/oradata/slsd/sa_data_01.dbf&lt;br /&gt;channel tape_1: reading from backup piece 09imku8o_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=09imku8o_1_2 tag=TAG20070712T104647&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:01:25&lt;br /&gt;channel tape_1: starting datafile backupset restore&lt;br /&gt;channel tape_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00005 to /u04/oradata/slsd/sa_index_01.dbf&lt;br /&gt;channel tape_1: reading from backup piece 0aimku8o_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=0aimku8o_1_2 tag=TAG20070712T104647&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:01:15&lt;br /&gt;channel tape_1: starting datafile backupset restore&lt;br /&gt;channel tape_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00006 to /u02/oradata/slsd/users01.dbf&lt;br /&gt;channel tape_1: reading from backup piece 0dimkuem_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=0dimkuem_1_2 tag=TAG20070712T104647&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:00:07&lt;br /&gt;channel tape_1: starting datafile backupset restore&lt;br /&gt;channel tape_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00003 to /u02/oradata/slsd/sysaux01.dbf&lt;br /&gt;channel tape_1: reading from backup piece 0cimkuej_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=0cimkuej_1_2 tag=TAG20070712T104647&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:00:35&lt;br /&gt;channel tape_1: starting datafile backupset restore&lt;br /&gt;channel tape_1: specifying datafile(s) to restore from backup set&lt;br /&gt;restoring datafile 00002 to /u05/oradata/slsd/undotbs01.dbf&lt;br /&gt;channel tape_1: reading from backup piece 0bimku8o_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=0bimku8o_1_2 tag=TAG20070712T104647&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:00:45&lt;br /&gt;Finished restore at 12-JUL-07&lt;/p&gt;&lt;p&gt;Starting recover at 12-JUL-07&lt;/p&gt;&lt;p&gt;starting media recovery&lt;/p&gt;&lt;p&gt;archive log thread 1 sequence 44 is already on disk as file /u04/oradata/slsd/re&lt;br /&gt;do2a.rdo&lt;br /&gt;archive log thread 1 sequence 45 is already on disk as file /u02/oradata/slsd/re&lt;br /&gt;do3b.rdo&lt;br /&gt;archive log thread 1 sequence 46 is already on disk as file /u02/oradata/slsd/re&lt;br /&gt;do1a.rdo&lt;br /&gt;channel tape_1: starting archive log restore to default destination&lt;br /&gt;channel tape_1: restoring archive log&lt;br /&gt;archive log thread=1 sequence=42&lt;br /&gt;channel tape_1: reading from backup piece 0eimkul0_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=0eimkul0_1_2 tag=TAG20070712T105320&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:00:04&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_12/o1_mf_1&lt;br /&gt;_42_39f4gskr_.arc thread=1 sequence=42&lt;br /&gt;channel default: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_12/o1_mf_1&lt;br /&gt;_42_39f4gskr_.arc recid=12 stamp=627756057&lt;br /&gt;channel tape_1: starting archive log restore to default destination&lt;br /&gt;channel tape_1: restoring archive log&lt;br /&gt;archive log thread=1 sequence=43&lt;br /&gt;channel tape_1: reading from backup piece 0gimldma_1_2&lt;br /&gt;channel tape_1: restored backup piece 1&lt;br /&gt;piece handle=0gimldma_1_2 tag=TAG20070712T151000&lt;br /&gt;channel tape_1: restore complete, elapsed time: 00:00:02&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_12/o1_mf_1&lt;br /&gt;_43_39f4gzy&lt;br /&gt;r_.arc thread=1 sequence=43&lt;br /&gt;channel default: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/slsd/archivelog/2007_07_12/o1_mf_1&lt;br /&gt;_43_39f4gzyr_.arc recid=13 stamp=627756064&lt;br /&gt;archive log filename=/u04/oradata/slsd/redo2a.rdo thread=1 sequence=44&lt;br /&gt;archive log filename=/u02/oradata/slsd/redo3b.rdo thread=1 sequence=45&lt;br /&gt;archive log filename=/u02/oradata/slsd/redo1a.rdo thread=1 sequence=46&lt;br /&gt;media recovery complete, elapsed time: 00:00:10&lt;br /&gt;Finished recover at 12-JUL-07&lt;br /&gt;released channel: tape_1&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-643037415761337379?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/643037415761337379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmandrksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/643037415761337379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/643037415761337379'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmandrksh.html' title='Output log of rman_dr.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-3799666764176894939</id><published>2007-06-03T12:13:00.000-07:00</published><updated>2008-10-25T13:56:23.027-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of rman_arch_bkup.ksh</title><content type='html'>This shows the output log of rman_arch_bkup.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;---------------------------------------------------------&lt;br /&gt;Tue Jun 26 14:25:25 EDT 2007&lt;br /&gt;---------------- rman_arch_bkup.ksh started ------------------&lt;/p&gt;&lt;p&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 26 14:25:25 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database: sls1 (DBID=1522268517)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;using target database control file instead of recovery catalog&lt;br /&gt;RMAN configuration parameters are:&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1;&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br /&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default&lt;br /&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br /&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' FORMAT   '%u_%p_%c';&lt;br /&gt;CONFIGURE MAXSETSIZE TO UNLIMITED; # default&lt;br /&gt;CONFIGURE ENCRYPTION FOR DATABASE OFF; # default&lt;br /&gt;CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default&lt;br /&gt;CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default&lt;br /&gt;CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/product/10.2.0/dbs/snapcf_sls1.f'; # default&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt;&lt;br /&gt;Starting backup at 26-JUN-07&lt;br /&gt;current log archived&lt;br /&gt;allocated channel: ORA_DISK_1&lt;br /&gt;channel ORA_DISK_1: sid=137 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_2&lt;br /&gt;channel ORA_DISK_2: sid=135 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_3&lt;br /&gt;channel ORA_DISK_3: sid=134 devtype=DISK&lt;br /&gt;allocated channel: ORA_DISK_4&lt;br /&gt;channel ORA_DISK_4: sid=133 devtype=DISK&lt;br /&gt;channel ORA_DISK_1: starting archive log backupset&lt;br /&gt;channel ORA_DISK_1: specifying archive log(s) in backup set&lt;br /&gt;input archive log thread=1 sequence=15 recid=416 stamp=626279130&lt;br /&gt;channel ORA_DISK_1: starting piece 1 at 26-JUN-07&lt;br /&gt;channel ORA_DISK_1: finished piece 1 at 26-JUN-07&lt;br /&gt;piece handle=/u06/flash_recovery_area/sls1/backupset/2007_06_26/o1_mf_annnn_TAG20070626T142533_382pjytc_.bkp tag=TAG20070626T142533 comment=NONE&lt;br /&gt;channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02&lt;br /&gt;channel ORA_DISK_1: deleting archive log(s)&lt;br /&gt;archive log filename=/u06/flash_recovery_area/sls1/archivelog/2007_06_26/o1_mf_1_15_382pjsyy_.arc recid=416 stamp=626279130&lt;br /&gt;Finished backup at 26-JUN-07&lt;/p&gt;&lt;p&gt;Starting Control File and SPFILE Autobackup at 26-JUN-07&lt;br /&gt;piece handle=/u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070626-02 comment=NONE&lt;br /&gt;Finished Control File and SPFILE Autobackup at 26-JUN-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN retention policy will be applied to the command&lt;br /&gt;RMAN retention policy is set to redundancy 1&lt;br /&gt;using channel ORA_DISK_1&lt;br /&gt;using channel ORA_DISK_2&lt;br /&gt;using channel ORA_DISK_3&lt;br /&gt;using channel ORA_DISK_4&lt;br /&gt;allocated channel: ORA_SBT_TAPE_1&lt;br /&gt;channel ORA_SBT_TAPE_1: sid=132 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_2&lt;br /&gt;channel ORA_SBT_TAPE_2: sid=141 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_2: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_3&lt;br /&gt;channel ORA_SBT_TAPE_3: sid=139 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_3: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_4&lt;br /&gt;channel ORA_SBT_TAPE_4: sid=136 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_4: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;Deleting the following obsolete backups and copies:&lt;br /&gt;Type                 Key    Completion Time    Filename/Handle&lt;br /&gt;-------------------- ------ ------------------ --------------------&lt;br /&gt;Backup Set           187    26-JUN-07        &lt;br /&gt;  Backup Piece       245    26-JUN-07          /u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070626-01&lt;br /&gt;deleted backup piece&lt;br /&gt;backup piece handle=/u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070626-01 recid=245 stamp=626279056&lt;br /&gt;Deleted 1 objects&lt;/p&gt;&lt;p&gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;Report of database schema&lt;/p&gt;&lt;p&gt;List of Permanent Datafiles&lt;br /&gt;===========================&lt;br /&gt;File Size(MB) Tablespace           RB segs Datafile Name&lt;br /&gt;---- -------- -------------------- ------- ------------------------&lt;br /&gt;1    1024     SYSTEM               ***     /u02/oradata/sls1/system01.dbf&lt;br /&gt;2    512      UNDOTBS1             ***     /u05/oradata/sls1/undotbs01.dbf&lt;br /&gt;3    512      SYSAUX               ***     /u02/oradata/sls1/sysaux01.dbf&lt;br /&gt;4    2040     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_01.dbf&lt;br /&gt;5    2040     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_02.dbf&lt;br /&gt;6    1024     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_03.dbf&lt;br /&gt;7    2040     SLS1_INDEX           ***     /u04/oradata/sls1/sls1_index_01.dbf&lt;br /&gt;8    1024     SLS1_INDEX           ***     /u04/oradata/sls1/sls1_index_02.dbf&lt;br /&gt;9    2036     SLS1AUD_ARCH         ***     /u05/oradata/sls1/sls1aud_arch_01.dbf&lt;br /&gt;10   1024     SLS1AUD_ARCH         ***     /u05/oradata/sls1/sls1aud_arch_02.dbf&lt;br /&gt;11   128      USERS                ***     /u02/oradata/sls1/users01.dbf&lt;br /&gt;12   1972     SLS1HIST_ARCH        ***     /u05/oradata/sls1/sls1hist_arch_01.dbf&lt;br /&gt;13   100      FLOW_1               ***     /u05/oradata/sls1/FLOW_1.dbf&lt;/p&gt;&lt;p&gt;List of Temporary Files&lt;br /&gt;=======================&lt;br /&gt;File Size(MB) Tablespace           Maxsize(MB) Tempfile Name&lt;br /&gt;---- -------- -------------------- ----------- --------------------&lt;br /&gt;1    528      TEMP       &amp;amp;&lt;br /&gt;nbsp;         1024        /u07/oradata/sls1/temp01.dbf&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;Report of files that need backup due to unrecoverable operations&lt;br /&gt;File Type of Backup Required Name&lt;br /&gt;---- ----------------------- -----------------------------------&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;br /&gt;---------------------------------------------------------&lt;br /&gt;Tue Jun 26 14:25:48 EDT 2007&lt;br /&gt;---------------- rman_arch_bkup.ksh completed ----------------&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-3799666764176894939?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/3799666764176894939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmanarchbkupksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3799666764176894939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3799666764176894939'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmanarchbkupksh.html' title='Output log of rman_arch_bkup.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7623386905853552253</id><published>2007-06-03T12:10:00.000-07:00</published><updated>2008-10-25T13:56:23.027-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of rman_tape_bkup.ksh</title><content type='html'>This shows the output log of rman_tape_bkup.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;---------------------------------------------------------&lt;br /&gt;Fri Jun 15 14:56:06 EDT 2007&lt;br /&gt;---------------- rman_tape_bkup.ksh started ------------------&lt;/p&gt;&lt;p&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jun 15 14:56:07 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database: sls1 (DBID=1522268517)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;using target database control file instead of recovery catalog&lt;br /&gt;RMAN configuration parameters are:&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1;&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br /&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default&lt;br /&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br /&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' FORMAT   '%u_%p_%c';&lt;br /&gt;CONFIGURE MAXSETSIZE TO UNLIMITED; # default&lt;br /&gt;CONFIGURE ENCRYPTION FOR DATABASE OFF; # default&lt;br /&gt;CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default&lt;br /&gt;CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default&lt;br /&gt;CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/product/10.2.0/dbs/snapcf_sls1.f'; # default&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt; 4&amp;gt; 5&amp;gt; 6&amp;gt; 7&amp;gt;&lt;br /&gt;Starting backup at 15-JUN-07&lt;br /&gt;allocated channel: ORA_SBT_TAPE_1&lt;br /&gt;channel ORA_SBT_TAPE_1: sid=146 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_2&lt;br /&gt;channel ORA_SBT_TAPE_2: sid=141 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_2: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_3&lt;br /&gt;channel ORA_SBT_TAPE_3: sid=144 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_3: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;allocated channel: ORA_SBT_TAPE_4&lt;br /&gt;channel ORA_SBT_TAPE_4: sid=139 devtype=SBT_TAPE&lt;br /&gt;channel ORA_SBT_TAPE_4: Tivoli Data Protection for Oracle: version 5.2.0.0&lt;br /&gt;skipping backupset key 161; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 162; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 163; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 164; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 165; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 166; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 167; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 168; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 169; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 170; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 171; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 172; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 173; already backed up 1 time(s)&lt;br /&gt;skipping backupset key 174; already backed up 1 time(s)&lt;br /&gt;input backupset count=183 stamp=625325470 creation_time=15-JUN-07&lt;br /&gt;channel ORA_SBT_TAPE_2: starting piece 1 at 15-JUN-07&lt;br /&gt;channel ORA_SBT_TAPE_2: backup piece /u01/oracle/product/10.2.0/dbs/controlfile_c-1522268517-20070615-00&lt;br /&gt;input backupset count=180 stamp=625321637 creation_time=15-JUN-07&lt;br /&gt;channel ORA_SBT_TAPE_1: starting piece 1 at 15-JUN-07&lt;br /&gt;channel ORA_SBT_TAPE_1: backup piece /u06/flash_recovery_area/sls1/backupset/2007_06_15/o1_mf_annnn_TAG20070615T122717_375hh73n_.bkp&lt;br /&gt;piece handle=5kikb9l5_1_2 comment=API Version 2.0,MMS Version 5.2.0.0&lt;br /&gt;channel ORA_SBT_TAPE_1: finished piece 1 at 15-JUN-07&lt;br /&gt;channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03&lt;br /&gt;piece handle=c-1522268517-20070615-00 comment=API Version 2.0,MMS Version 5.2.0.0&lt;br /&gt;channel ORA_SBT_TAPE_2: finished piece 1 at 15-JUN-07&lt;br /&gt;channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:03&lt;br /&gt;Finished backup at 15-JUN-07&lt;/p&gt;&lt;p&gt;Starting Control File and SPFILE Autobackup at 15-JUN-07&lt;br /&gt;piece handle=c-1522268517-20070615-01 comment=API Version 2.0,MMS Version 5.2.0.0&lt;br /&gt;Finished Control File and SPFILE Autobackup at 15-JUN-07&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;Report of database schema&lt;/p&gt;&lt;p&gt;List of Permanent Datafiles&lt;br /&gt;===========================&lt;br /&gt;File Size(MB) Tablespace           RB segs Datafile Name&lt;br /&gt;---- -------- -------------------- ------- ------------------------&lt;br /&gt;1    1024     SYSTEM               ***     /u02/oradata/sls1/system01.dbf&lt;br /&gt;2    512      UNDOTBS1             ***     /u05/oradata/sls1/undotbs01.dbf&lt;br /&gt;3    512      SYSAUX               ***     /u02/oradata/sls1/sysaux01.dbf&lt;br /&gt;4    2040     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_01.dbf&lt;br /&gt;5    2040     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_02.dbf&lt;br /&gt;6    1024     SLS1_DATA            ***     /u03/oradata/sls1/sls1_data_03.dbf&lt;br /&gt;7    2040     SLS1_INDEX           ***     /u04/oradata/sls1/sls1_index_01.dbf&lt;br /&gt;8    1024     SLS1_INDEX           ***     /u04/oradata/sls1/sls1_index_02.dbf&lt;br /&gt;9    2036     SLS1AUD_ARCH         ***     /u05/oradata/sls1/sls1aud_arch_01.dbf&lt;br /&gt;10   1024     SLS1AUD_ARCH         ***     /u05/oradata/sls1/sls1aud_arch_02.dbf&lt;br /&gt;11   128      USERS                ***     /u02/oradata/sls1/users01.dbf&lt;br /&gt;12   1972     SLS1HIST_ARCH        ***     /u05/oradata/sls1/sls1hist_arch_01.dbf&lt;br /&gt;13   100      FLOW_1               ***     /u05/oradata/sls1/FLOW_1.dbf&lt;/p&gt;&lt;p&gt;List of Temporary Files&lt;br /&gt;=======================&lt;br /&gt;File Size(MB) Tablespace           Maxsize(MB) Tempfile Name&lt;br /&gt;---- -------- -------------------- ----------- --------------------&lt;br /&gt;1    528      TEMP                 1024        /u07/oradata/sls1/temp01.dbf&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;br /&gt;---------------------------------------------------------&lt;br /&gt;Fri Jun 15 14:56:31 EDT 2007&lt;br /&gt;---------------- rman_tape_bkup.ksh completed ----------------&lt;/p&gt;&lt;p&gt;&amp;amp;nbsp&lt;br /&gt;;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7623386905853552253?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7623386905853552253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmantapebkupksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7623386905853552253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7623386905853552253'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmantapebkupksh.html' title='Output log of rman_tape_bkup.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6709768107147215539</id><published>2007-06-03T12:04:00.000-07:00</published><updated>2008-10-25T13:56:23.027-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rman logs'/><title type='text'>Output log of rman_config.ksh</title><content type='html'>This shows the output log  of rman_config.ksh&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jun 11 14:58:03 2007&lt;/p&gt;&lt;p&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;connected to target database: sls1 (DBID=1522268517)&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;using target database control file instead of recovery catalog&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1;&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1;&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE BACKUP OPTIMIZATION ON;&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt; 2&amp;gt;&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK;&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK;&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt;&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; 2&amp;gt; 3&amp;gt;&lt;br /&gt;old RMAN configuration parameters:&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' FORMAT   '%u_%p_%c';&lt;br /&gt;new RMAN configuration parameters:&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)' FORMAT   '%u_%p_%c';&lt;br /&gt;new RMAN configuration parameters are successfully stored&lt;/p&gt;&lt;p&gt;RMAN&amp;gt;&lt;br /&gt;RMAN&amp;gt; &lt;/p&gt;&lt;p&gt;Recovery Manager complete.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6709768107147215539?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6709768107147215539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmanconfigksh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6709768107147215539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6709768107147215539'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/output-log-of-rmanconfigksh.html' title='Output log of rman_config.ksh'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-700771396041918289</id><published>2007-06-03T12:02:00.000-07:00</published><updated>2008-10-25T13:56:23.027-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sqlnet'/><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Sample sqlnet.ora file</title><content type='html'>This is a sample sqlnet.ora file&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Sample sqlnet.ora - Ramakrishna Nemani&lt;br /&gt;#&lt;br /&gt;NAMES.DEFAULT_DOMAIN=world&lt;br /&gt;NAMES.DEFAULT_ZONE=world&lt;br /&gt;automatic_ipc=off&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-700771396041918289?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/700771396041918289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/sample-sqlnetora-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/700771396041918289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/700771396041918289'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/sample-sqlnetora-file.html' title='Sample sqlnet.ora file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7121069807481252460</id><published>2007-06-03T11:52:00.000-07:00</published><updated>2008-10-25T13:56:23.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sqlnet'/><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Sample tnsnames.ora</title><content type='html'>This is a sample tnsnames.ora file&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Sample tnsnames.ora - Ramakrishna Nemani&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;# The following is the general syntax for any entry in&lt;br /&gt;# a tnsnames.ora file. There could be several such entries&lt;br /&gt;# tailored to the user's needs.&lt;br /&gt;#&lt;br /&gt;sls1.world =&lt;br /&gt;  (DESCRIPTION =&lt;br /&gt;    (ADDRESS = (PROTOCOL = TCP)(HOST = us6atlp1)(PORT = 1521))&lt;br /&gt;    (CONNECT_DATA =&lt;br /&gt;      (SID = cmad)&lt;br /&gt;      (ORACLE_HOME = /apps/oracle/product/10.2.0)&lt;br /&gt;      (service_names = sls1)&lt;br /&gt;    )&lt;br /&gt;  )&lt;br /&gt;sls2.world =&lt;br /&gt;  (DESCRIPTION =&lt;br /&gt;    (ADDRESS = (PROTOCOL = TCP)(HOST = us6atlp1)(PORT = 1521))&lt;br /&gt;    (CONNECT_DATA =&lt;br /&gt;      (SID = stgt)&lt;br /&gt;      (ORACLE_HOME = /apps/oracle/product/10.2.0)&lt;br /&gt;      (service_names = sls2)&lt;br /&gt;    )&lt;br /&gt;  )&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7121069807481252460?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7121069807481252460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/sample-tnsnamesora.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7121069807481252460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7121069807481252460'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/sample-tnsnamesora.html' title='Sample tnsnames.ora'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-7845438510889464415</id><published>2007-06-03T11:49:00.000-07:00</published><updated>2008-10-25T13:56:23.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sqlnet'/><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Sample Listener.ora</title><content type='html'>This is a sample listener.ora file&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#&lt;br /&gt;# Sample listener.ora - Ramakrishna Nemani&lt;br /&gt;#&lt;br /&gt;LISTENER =&lt;br /&gt;  (ADDRESS_LIST =&lt;br /&gt;    (ADDRESS = (PROTOCOL = TCP)(HOST = us6atlp1)(PORT = 1521))&lt;br /&gt;    (ADDRESS = (PROTOCOL = IPC)(KEY = sls1))&lt;br /&gt;    (ADDRESS = (PROTOCOL = IPC)(KEY = sls2))&lt;br /&gt;    (ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))&lt;br /&gt;  )&lt;/p&gt;&lt;p&gt;SID_LIST_LISTENER =&lt;br /&gt;  (SID_LIST =&lt;br /&gt;    (SID_DESC =&lt;br /&gt;      (GLOBAL_DBNAME = sls1.world)&lt;br /&gt;      (ORACLE_HOME = /u01/oracle/product/10.2.0)&lt;br /&gt;      (SID_NAME = sls1)&lt;br /&gt;    )&lt;br /&gt;    (SID_DESC =&lt;br /&gt;      (GLOBAL_DBNAME = sls2.world)&lt;br /&gt;      (ORACLE_HOME = /u01/oracle/product/10.2.0)&lt;br /&gt;      (SID_NAME = sls2)&lt;br /&gt;    )&lt;br /&gt;  )&lt;/p&gt;&lt;p&gt;SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-7845438510889464415?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/7845438510889464415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/sample-listenerora.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7845438510889464415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/7845438510889464415'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/06/sample-listenerora.html' title='Sample Listener.ora'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-6038795942332605963</id><published>2007-05-08T16:01:00.000-07:00</published><updated>2008-10-25T13:56:23.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sqlnet'/><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Sample .profile file</title><content type='html'>A sample .profile file&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;if [ "$DISPLAY" = "" ]; then&lt;br /&gt;   if [ "`tty`" != "/dev/console" -o "$TERM" != "console" ]; then&lt;br /&gt;      REMOTEHOSTNAME="`who am i  cut -d'(' -f2,2  cut -d')' -f1,1`"&lt;br /&gt;      DISPLAY="$REMOTEHOSTNAME:0.0"&lt;br /&gt;      export DISPLAY&lt;br /&gt;    fi&lt;br /&gt;fi&lt;/p&gt;&lt;p&gt;umask 022&lt;br /&gt;export ORACLE_BASE=/apps/oracle&lt;br /&gt;export ORACLE_HOME=$ORACLE_BASE/product/10.2.0&lt;br /&gt;export TNS_ADMIN=$ORACLE_HOME/network/admin&lt;br /&gt;export AGENT_HOME=$ORACLE_BASE/product/agent10g&lt;br /&gt;PATH=$PATH:$ORACLE_HOME/bin:/home/oracle/bin&lt;br /&gt;export ORACLE_SID=slsp&lt;br /&gt;PS1='$ORACLE_SID:'"`uname -n`:"'$PWD&amp;gt; '&lt;br /&gt;alias slsp='export ORACLE_SID=slsp'&lt;br /&gt;alias dird='ls -lrt  grep -i "^d"'&lt;br /&gt;alias cdslsp='cd /apps/oracle/admin/slsp/scripts'&lt;br /&gt;alias rmandir='cd /apps/oracle/admin/rman'&lt;br /&gt;export TMOUT=0&lt;br /&gt;export LIBPATH=$ORACLE_HOME/lib:/usr/lib&lt;br /&gt;export EXCLUDE=/usr/tivoli/tsm/client/ba/bin/inclexcl.oracle&lt;br /&gt;lsattr -El sys0  grep -i REALMEM&lt;br /&gt;AIXTHREAD_SCOPE=S; export AIXTHREAD_SCOPE&lt;br /&gt;NUM_SPAREVP=1; export NUM_SPAREVP&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-6038795942332605963?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/6038795942332605963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/05/sample-profile-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6038795942332605963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/6038795942332605963'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/05/sample-profile-file.html' title='Sample .profile file'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-3187284765062159379</id><published>2007-05-08T15:56:00.000-07:00</published><updated>2008-10-25T13:56:23.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='export'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Export to UNIX pipe and Compress</title><content type='html'>This script  exports to a UNIX pipe which is then fed to gzip to create a compressed export dump file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. $HOME/.profile&lt;br /&gt;##&lt;br /&gt;## script name : exp_pipe.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script  exports to a UNIX pipe which is then fed to gzip to create&lt;br /&gt;## a compressed export dump file&lt;br /&gt;## This is useful when space is at a premium or when you are dealing with&lt;br /&gt;## an export dump file that can grow larger than 2GB and you are working on&lt;br /&gt;## a file system that can not handle files larger than 2GB in size&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## There are a bunch of modifiable parameters in this script that you&lt;br /&gt;## should modify to reflect your environment.&lt;br /&gt;## I have tested this script on UNIX/LINUX&lt;br /&gt;## Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Begining of modifiable parameters&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;export ORACLE_SID=slsd&lt;br /&gt;EXP_DIR="./"&lt;/p&gt;&lt;p&gt;DUMPFILE=${EXP_DIR}slsd.pipe&lt;br /&gt;GZIPDUMPFILE=${EXP_DIR}slsd_exp.dmp.gz&lt;/p&gt;&lt;p&gt;PARFILE=${EXP_DIR}slsd_exp.par&lt;/p&gt;&lt;p&gt;LOGFILE=${EXP_DIR}exp_slsd.log&lt;br /&gt;ERRFILE=${EXP_DIR}full_exp.out&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## End of modifiable parameters&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Create a pipe&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;rm -f $DUMPFILE 2&amp;gt;/dev/null&lt;br /&gt;mknod $DUMPFILE p&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Compress using gzip the cat output from pipe. This is done in the background&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;cat $DUMPFILE  gzip -c &amp;gt; $GZIPDUMPFILE &amp;amp;&lt;/p&gt;&lt;p&gt;exp parfile=$PARFILE log=$LOGFILE file=$DUMPFILE 2&amp;gt; $ERRFILE&lt;/p&gt;&lt;p&gt;export RETURN_CODE=$?&lt;br /&gt;echo RETURN_CODE: $RETURN_CODE&lt;/p&gt;&lt;p&gt;exit $RETURN_CODE&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-3187284765062159379?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/3187284765062159379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/05/export-to-unix-pipe-and-compress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3187284765062159379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/3187284765062159379'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/05/export-to-unix-pipe-and-compress.html' title='Export to UNIX pipe and Compress'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2876563497138343096.post-1101516547643991274</id><published>2007-05-08T14:13:00.000-07:00</published><updated>2008-10-25T13:56:23.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ramakrishna Nemani'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='import'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Import through UNIX pipe</title><content type='html'>This script imports through an UNIX pipe.This is useful when space is at a premium or when you are dealing with an export dump file that is larger than 2GB and you are working on a file system that can not handle files larger than 2GB in size.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;#!/bin/ksh&lt;br /&gt;. ~/.profile&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## script name : imp_pipe.ksh&lt;br /&gt;## Author : Ramakrishna Nemani&lt;br /&gt;##&lt;br /&gt;## Purpose :&lt;br /&gt;## This script  imports from an oracle export dump file through a UNIX pipe.&lt;br /&gt;## This is useful when space is at a premium or when you are dealing with an export dump file&lt;br /&gt;## that is larger than 2GB and you are working on a file system that can not handle files&lt;br /&gt;## larger than 2GB in size&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;##&lt;br /&gt;## Note :&lt;br /&gt;## There are a bunch of modifiable parameters in this script that you should modify to&lt;br /&gt;## reflect your environment.&lt;br /&gt;## I have tested this script on UNIX/LINUX.&lt;br /&gt;## Use it at your own risk.&lt;br /&gt;##&lt;br /&gt;## This is an example or sample script&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;## ----------------------------------------------------------------------------&lt;br /&gt;##                       Begining of modifiable parameters&lt;br /&gt;## ----------------------------------------------------------------------------&lt;/p&gt;&lt;p&gt;&lt;br /&gt;ORACLE_SID=slsd; export ORACLE_SID&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## name the directory that has the import dump file&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;IMP_DIR="/u01/import/"&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## name a directory where you want to create the export logs, errors and pipes&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;LOG_DIR="/u01/log/"&lt;/p&gt;&lt;p&gt;&lt;br /&gt;##&lt;br /&gt;## name your export dump file here&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;EXPDUMPFILE=${IMP_DIR}slsp_exp.dmp.gz&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## name your pipe - you can give any name, I prefer to give ORACLE_SID.pipe&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;PIPEFILE=${LOG_DIR}slsd.pipe&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## name your import parameters file (parfile) here&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;PARFILE=${LOG_DIR}imp_slsd.par&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## name your Error log files here&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;ERRFILE=${LOG_DIR}imp_slsd.out&lt;br /&gt;LOGFILE=${LOG_DIR}imp_slsd.log&lt;/p&gt;&lt;p&gt;## ----------------------------------------------------------------------------&lt;br /&gt;##                       End of modifiable parameters&lt;br /&gt;## ----------------------------------------------------------------------------&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Create a pipe&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;rm $PIPEFILE&lt;br /&gt;mknod $PIPEFILE p&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## unzip and read the compressed dump file  to the screen&lt;br /&gt;## and redirect the screen output to the pipe . This process&lt;br /&gt;## is run in the background&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;gunzip -c $EXPDUMPFILE &amp;gt; $PIPEFILE &amp;amp;&lt;/p&gt;&lt;p&gt;##&lt;br /&gt;## Import from pipe&lt;br /&gt;##&lt;/p&gt;&lt;p&gt;imp parfile=$PARFILE log=$LOGFILE file=$PIPEFILE 2&amp;gt; $ERRFILE &lt;/p&gt;&lt;p&gt;exit&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2876563497138343096-1101516547643991274?l=dbtechblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbtechblog.blogspot.com/feeds/1101516547643991274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbtechblog.blogspot.com/2007/05/import-through-unix-pipe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/1101516547643991274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2876563497138343096/posts/default/1101516547643991274'/><link rel='alternate' type='text/html' href='http://dbtechblog.blogspot.com/2007/05/import-through-unix-pipe.html' title='Import through UNIX pipe'/><author><name>Ramakrishna Nemani</name><uri>http://www.blogger.com/profile/02498861592158415475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
