hello All,
I have this in my /etc/oratab
dbase1:/orahome/app/oracle/product/11.2.04/dbbase:N
dbase2:/orahome/app/oracle/product/10.2.05/dbbase:N
The idea is to use a script to loop through each database, mindful that Database HOME is different.
Again, go into directory:
/orahome/app/oracle/admin/dbase1/adump
or
/orahome/app/oracle/admin/dbase2/adump
1) remove all files older than 7 days including old zip and tar files.
2) zip and tar the rest of the files while renaming it and put a timestamp of the day of creation of tarball.
Here is my script
#!/bin/ksh
#
# Script Name: copy_zip_tar.sh
#
ORACLE_SID=`cat /etc/oratab | grep -v "^#" | grep -v "^\*" | grep -v "^agent" | cut -d":" -f1 | sort`
while read ORACLE_SID
do
find /orahome/app/oracle/admin/'$ORACLE_SID'/adump/* -mtime +7 -exec rm{} \
tar cvf /orahome/app/oracle/admin/'$ORACLE_SID'/adump/*aud | gzip -c > '$ORACLE_SID'_aud_files`date +" %b_%d_%Y"`.tar.gz
done
exit
Above is my effort.
I have to admit that I have not tested this.
Please help & thanks for your help in advance.
I have this in my /etc/oratab
dbase1:/orahome/app/oracle/product/11.2.04/dbbase:N
dbase2:/orahome/app/oracle/product/10.2.05/dbbase:N
The idea is to use a script to loop through each database, mindful that Database HOME is different.
Again, go into directory:
/orahome/app/oracle/admin/dbase1/adump
or
/orahome/app/oracle/admin/dbase2/adump
1) remove all files older than 7 days including old zip and tar files.
2) zip and tar the rest of the files while renaming it and put a timestamp of the day of creation of tarball.
Here is my script
#!/bin/ksh
#
# Script Name: copy_zip_tar.sh
#
ORACLE_SID=`cat /etc/oratab | grep -v "^#" | grep -v "^\*" | grep -v "^agent" | cut -d":" -f1 | sort`
while read ORACLE_SID
do
find /orahome/app/oracle/admin/'$ORACLE_SID'/adump/* -mtime +7 -exec rm{} \
tar cvf /orahome/app/oracle/admin/'$ORACLE_SID'/adump/*aud | gzip -c > '$ORACLE_SID'_aud_files`date +" %b_%d_%Y"`.tar.gz
done
exit
Above is my effort.
I have to admit that I have not tested this.
Please help & thanks for your help in advance.