Skip to content

Archive-move-emergency

July 1, 2013

In case of emergency to move archive files to tmp location where sufficient disk space is available and create softlinks for same files in archive destination.
Change date,time,archive destination and tmp location in script according to your requirement in script.
————————————————————————————————————-

cat > fmove.ksh
 #######################Start of script ####################################
#Change directory to your Archive destination.
cd /r10/oradata/HPCL/archive_logs/
#Check the total size of archives generated on specific date and time
 ls -ltr *.ARC|grep "Jun  7 16:" | awk '{total += $5}; END {print total/1024/1024/1024 " GB"}'
#Store the file names in variable fnm
 fnm=`ls -ltr *.ARC|grep "Jun  7 16:" | awk ' {print $9} '`
 echo $fnm
 ls -ltrh $fnm
#move the files to temp folder where you have sufficient disk space.
 mv $fnm /d13/exports/tmp_arc/
#Create the Softlinks in archive destination (/r10/oradata/HPCL/archive_logs/) for the moved archives files,
 #to avoid any rman backup or replication(standby) failure.
 ln -s /d13/exports/tmp_arc/*.ARC /r10/oradata/HPCL/archive_logs/
 ls -ltrh $fnm
#######################End of script ####################################

To run above script
—————————
nohup ksh -x fmove.ksh &

 

Advertisements

From → Shell Scripts

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: