Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Wait.sql Oracle
  • Identical Dblink Issue… Oracle
  • Paste command syntax Linux/Unix
  • Benefits and Usage of RMAN with Standby Databases Oracle
  • Nice notes on wait events Oracle
  • More info about /proc folder and its relation with processes. Linux/Unix
  • How to find pinned objects from shared pool. (pinned via dbms_shared_pool.keep) Oracle
  • UNderstand and eliminate Latch contention. Oracle
  • Library cahe Latches and internal explaination Oracle
  • Roles and Stored Procs II Oracle
  • DBMS_JOB all example Oracle
  • Directory wise folder wise space usage Linux/Unix
  • Good link for LIO in Oracle ( Logical IOs) Oracle
  • usnsql.sql Displays information about UNDO segments with sql statements Oracle
  • New OFA for 11g Oracle

move_arch_files.ksh /* Good One */

Posted on 02-Aug-2005 By Admin No Comments on move_arch_files.ksh /* Good One */

#!/bin/ksh

a=`ps -ef|grep “move_arch_files.ksh”|grep -v grep|wc -l`

if [ $a -gt 2 ]

then

echo “Exiting because of more than 1 Moving archive log script is running ”

exit

fi

#

## Setting Environment information and variables

#

NODENAME=`hostname`

## change start

ORACLE_SID=UAS

LOG_FILE=/oracle/scripts/log/MOVE_UAS01.log

ARCHMOUNTPOINT=/UASARCH

DESTFOLDER=/uocdb7/archlog/UAS

### change end

COMFORT_SPACE=75

NO_FILES_MOVED=0

NOTIFY_LIST=’dbaoracle@1800flowers.com’

cp /dev/null $LOG_FILE

## change start

#ARCH_SPACE=`df -k /UASARCH | tail -1 | awk ‘{print $5’} | sed ‘s/%//g’`

ARCH_SPACE=`df -k $ARCHMOUNTPOINT | tail -1 | awk ‘{print $5’} | sed ‘s/%//g’`

##change end

echo “The script execution started at `date`” >> $LOG_FILE

while [ ${ARCH_SPACE} -ge ${COMFORT_SPACE} ]

do

FIRST_FILE=`ls -latr $ARCHMOUNTPOINT/*.arc|head -1|awk ‘{print $9}’`

# cp -p $FIRST_FILE /blprddb14/archlog/BLINK

cp -p $FIRST_FILE $DESTFOLDER

CURR_FILE_SZ=`ls -latr $FIRST_FILE|awk ‘{print $5}’`

CURR_FL_NAME=`echo $FIRST_FILE |cut -f3 -d’/’`

# COPIED_FILE_SZ=`ls -latr /blprddb14/archlog/BLINK/$CURR_FL_NAME |awk ‘{print $5}’`

COPIED_FILE_SZ=`ls -latr $DESTFOLDER/$CURR_FL_NAME |awk ‘{print $5}’`

if [ $CURR_FILE_SZ -eq $COPIED_FILE_SZ ]

then

echo “Compressing the $FIRST_FILE” >>$LOG_FILE

compress $DESTFOLDER/$CURR_FL_NAME

echo “compression of $FIRST_FILE is done” >>$LOG_FILE

echo “Removed ” $FIRST_FILE “at “`date` >> $LOG_FILE

rm $FIRST_FILE

fi

NO_FILES_MOVED=`expr $NO_FILES_MOVED + 1`

# ARCH_SPACE=`df -k /BLINKARCH | tail -1 | awk ‘{print $5’} | sed ‘s/%//g’`

ARCH_SPACE=`df -k $ARCHMOUNTPOINT | tail -1 | awk ‘{print $5’} | sed ‘s/%//g’`

# ARCHBAK_SPC=`df -k /blprddb14 | tail -1 | awk ‘{print $5’} | sed ‘s/%//g’`

ARCHBAK_SPC=`df -k $DESTFOLDER | tail -1 | awk ‘{print $5’} | sed ‘s/%//g’`

done

if [ $NO_FILES_MOVED -gt 0 ]

then

#echo $NO_FILES_MOVED archive log files were moved from $ARCHMOUNTPOINT to $DESTFOLDER

#echo Currently $ARCHMOUNTPOINT is at $ARCH_SPACE % and $DESTFOLDER is at $ARCHBAK_SPC %

mailx -s ” File Moved Alert from $NODENAME, $ORACLE_SID Database” $NOTIFY_LIST< $NO_FILES_MOVED archive log files were moved from $ARCHMOUNTPOINT to $DESTFOLDER

Currently $ARCHMOUNTPOINT is at $ARCH_SPACE % and $DESTFOLDER is at $ARCHBAK_SPC %

EOF

fi

Linux/Unix, shell

Post navigation

Previous Post: move_arch_files.ksh
Next Post: crontab syntax

Related Posts

  • avail.sh ( find filesystem spae usage) Linux/Unix
  • Unix split command to split files Linux/Unix
  • Search and replace pattern Linux/Unix
  • Establishing trusted relationship between dbmonitor( central monitoring) and monitoring targets. Linux/Unix
  • good linux notes Linux/Unix
  • chk_space_SID.ksh Linux/Unix

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • backspace in SQL Plus not working then..? Linux/Unix
  • How to collect CPU usage on Linux using Shell script Linux/Unix
  • Rman Notes -1 Oracle
  • How to know current SID Oracle
  • oracle_env_10g_CADEV Linux/Unix
  • chk_space_SID.ksh Linux/Unix
  • How to find Unix server conguraiton including Server Model number and underlying disk sub-system ( On Solaris) Linux/Unix
  • Renaming Global Name GLOBAL_NAME Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme