Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Rac on Linux

Re: Rac on Linux

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 25 Oct 2006 15:58:57 -0700
Message-ID: <1161817136.198201@bubbleator.drizzle.com>


JEDIDIAH wrote:

> On 2006-10-12, DA Morgan <damorgan_at_psoug.org> wrote:

>> Fuzzy wrote:
>>> JEDIDIAH wrote:
>>>> On 2006-09-13, HansF <Fuzzy.Greybeard_at_gmail.com> wrote:
>>>>> On Tue, 12 Sep 2006 15:18:54 -0700, hpuxrac wrote:
>>>>>
>>>>>
>>>>>> Do you like your database vendor to also provide your file systems?
>>>> Your are COMPLETELY dependent on Oracle for everything.
>>> As if you aren't anyway.
>> This is just another version of the Java developer's mantra about
>> platform independence that Tom Kyte has been trying to kill for quite
>> some time.
>>
>> Platform independence is a direct route to mediocrity or worse.
>>
>> Trying to run Oracle databases successfully while ignoring Oracle
>> best practices is similarly an exercise in masochism.
> 
> 	You make it sound like you could get 5 DBA's in a room
> and not have 6 opinions about any subject.

Not on the above subject you wouldn't. I've yet to hear any DBA challenge Tom on this.

> ASM and RMAN both increase the arcana level of an Oracle > database.

Let me see if I've got this correct.

RUN {
   ALLOCATE CHANNEL d1 DEVICE TYPE DISK;    BACKUP DATABASE;
}

is arcane.

And this:


#!/usr/bin/ksh
#This script will do a full backup of the database while it is shutdown.
#It expects to have a config file in /apps/oracle/admin/$db_name/backup
#called env_backup.ksh which defines PURGE, CHANNELS, and BACKUP_DIR.
#
#Arguments 1 -> ORACLE_SID
#          2 -> db_name
#          3 -> export (optional)

if [[ ( $# -ne 2 ) && ( $# -ne 3 ) ]]; then   echo "\n usage is $0 <ORACLE_SID> <db_name> optional <export>\n"   exit 1
fi

export ORACLE_SID=$1
export ORAENV_ASK=NO
export PATH=$PATH:/usr/local/bin:/usr/contrib/bin . oraenv

db_name=$2
#Get the values for BACKUP_DIR etc...
. /apps/oracle/admin/$db_name/backup/env_backup.ksh

TODAYS_DATE=`date +"%Y%m%d%H%M"`
BACKUP_FILE=$BACKUP_DIR/${TODAYS_DATE}backupfiles.par RECOVER_FILE=$BACKUP_DIR/${TODAYS_DATE}recovery.par RETNO=0
EXPLOG=$EXP_DIR/${TODAYS_DATE}exp.out

echo "Backup of $db_name started at "`date +"%Y%m%d %H:%M"`

#Check to see if the instance is running. If it is not then exit with status
#of 1.
if [ -z "`ps -ef | grep smon | grep $ORACLE_SID`" ]; then

   echo "Oracle instance $ORACLE_SID already shutdown. Exiting..."    exit 1
fi

#Purge old backups
find $BACKUP_DIR -type f -mtime $PURGE | xargs rm -rf

#Create list of files to backup
sqlplus -S / << EOD > /dev/null 2>&1
spool $BACKUP_FILE
set heading off pages 0 trimspool on lines 200 echo off verify off feedback off termout off
select name
from v\$datafile
order by name
/
select member
from v\$logfile
order by member
/
select name
from v\$controlfile
order by name
/
spool off
exit
EOD svrmgrl << EOD &
connect internal
shutdown immediate;
exit
EOD #Wait for the database to shutdown cleanly cnt=0
while [ $cnt -lt 61 ]
do

   if [ `jobs | wc -l` -eq 1 ]; then

     sleep 10
     let cnt=$cnt+1
   else
     break

   fi
done

#Give up. It is not coming down cleanly, so kill it. if [ $cnt -eq 61 ]; then

   echo "Unable to do a clean shutdown!"    echo "Doing a shutdown abort"
svrmgrl << EOD
connect internal
shutdown abort;
exit
EOD
fi

#Purge all old archive logs
find $ARCH_DIR -type f -mtime $PURGE | xargs rm -f

#Add a list of archive logs to backup
find $ARCH_DIR -type f >> $BACKUP_FILE

 >$RECOVER_FILE
#Begin backing up the files. One file per CHANNEL for fname in `cat $BACKUP_FILE`
do

   while [ `jobs | wc -l` -eq $CHANNELS ]    do
     sleep 2
   done
   echo "Compressing $fname to $BACKUP_DIR"    BFILENAME=$BACKUP_DIR/${TODAYS_DATE}`basename $fname`.gz    cat $fname | gzip -c > $BFILENAME &
   echo "$fname $BFILENAME" >> $RECOVER_FILE done

#Wait until all the background processes finish wait

#Startup the database so users can get back in and we can export. svrmgrl << EOD
connect internal
startup
alter rollback segment big_roll online;
exit
EOD #Do an export if they asked us to.
if [ "$3" = "export" ]; then

   #Clean out old exports
   find $EXP_DIR -type f -mtime $PURGE | xargs rm -rf    COMPRESS_PIPE=$EXP_DIR/compress_pipe

   if [ ! -p $COMPRESS_PIPE ]; then
     mkfifo $COMPRESS_PIPE
   fi

   cat $COMPRESS_PIPE | gzip -c > $EXP_DIR/${TODAYS_DATE}exp.dmp.gz &

   exp / compress=n buffer=65536 consistent=y file=$COMPRESS_PIPE full=y direct=y log=$EXPLOG
fi
echo "Backup of $db_name ended at "`date +"%Y%m%d %H:%M"`


isn't. We're both sure glad you don't work for me.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Wed Oct 25 2006 - 17:58:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US