Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All,

I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60%

Need to identify the unique file system that reaches threshold value.
ex:
capacity
60%

file system /ora/arch/dbname1/.arch
/ora/arch/dbname2/
.arch

script need to run when file system reaches 60 % ----archivebkup.ksh

Here an attempt that may need to be tested and adapted

df | grep [6-90][0-9][%] | awk '/ora\/arch\/dbname.\/*.arch/{print $NF}' | while read f
do archivebkup.ksh $f
done

Hi Thanks for quick reply.

I will check in my environment and get back to you.

Kindly help me on this.

---------- Post updated at 06:12 AM ---------- Previous update was at 05:07 AM ----------

I am giving some more details of my environment this will help you understand my scenario.

                                   capacity     
                                   \--------

/dev/fvg03_lv6471 62.75 61.01 3% 70 1% /oraarch/fs1771
/dev/fvg03_lv6472 62.75 43.98 50% 221 1% /oraarch/fs1772

First file system /oraarch/fs1771 contains the below database archive directories
OS00DB1 OS00DB2 OS00DB3

and second file system /oraarch/fs1772 contains database arch directories
OS00DB1 OS00DB2 OS00DB3

disk usage using du command:
oracle > du *
0 OS00DB1
1496 OS00DB2
38818792 OS00DB3

Inside each directory archive files will be stored with .arc extension
ex:/oraarch/fs1772/OS00DB3/1_1035_721234582.arc
/oraarch/fs1772/OS00DB2/1_1035_721234594.arc
.
.

I need to find the unique database name that is causing the archive file system crossing threshold value and check which database actually reaching the threshold value and appropriate script needs to run.

/u01/script/rman_OS00DB1_ar.ksh
/u01/script/rman_OS00DB2_ar.ksh
/u01/script/rman_OS00DB3_ar.ksh

Having 3 archive directories on a single filesystem is a bad idea : if for any reason one of the archive directory fills the FS, it will also freeze the 2 other databases.

You'd better to separate 3 differents FS and mount each of them on their own directories so that if a problem occurs, the problem will not impact the 2 other database.

In production environment there is dedicated archive file system for each database.

df -g | grep arch
/dev/P0054D_lv10019 251.00 224.12 59% 61 1% /oraarch/fs2718

cd /oraarch/fs2718
>ls
DB0070
cd DB0070
.arc files exists in this directory

pwd
/oraarch/fs2718/DB0070

Archive backup script location is /u01/apps/script/DB0070_ar.ksh
some other database archive scripts are also there in servers which are migrated to another server.
I want to call the script by checking the database name in archive destination respective database archive should run.

Please let me know if you need any more details

Thanks in advance,

---------- Post updated 10-17-13 at 08:51 AM ---------- Previous update was 10-16-13 at 09:14 AM ----------

Could any one help me with this shell script