Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Database Administration >> script to keep a desired number of acrhive logs

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: script to keep a desired number of acrhive logs
 Soumya  Posted: Feb 22, 2008 05:50:10 AM

 Total Post: 56
 Joined: Mar, 2006






 
Hi,

I need to keep a limited number of archive log files on my database.
That I need to keep may be 200 archive log at a given time .

Starting from latest to previous one. i.e. the last archive log &
previous 199 .


Can I get a script for the same.

Thanx

 Mohammed Taj
Posted: Feb 23, 2008 12:04:10 AM  

 Total Post: 694
 Joined: Jul, 2007






 
You can't limit your archivelog file.
archivelog file depands on redo generation rate. reduce redo log generation and take backup in short interval or delete old archivelog files.

archivelog file most important for recovery purpose.

Regards
Taj

 Soumya
Posted: Feb 23, 2008 12:23:36 AM  

 Total Post: 56
 Joined: Mar, 2006






 
Hello,

I dont want to remove archive log files, that will never be possoble.

I want to clean the files from the archive log destination.

Thanx for ur time .





 Mohammed Taj
Posted: Feb 23, 2008 12:31:30 AM  

 Total Post: 694
 Joined: Jul, 2007






 
Yes you can clean them from archivelog destination but after taking backup or transfer all archivelog to tape location.


 Soumya
Posted: Feb 23, 2008 12:58:55 AM  

 Total Post: 56
 Joined: Mar, 2006






 

If you are not able to understand the ques dont reply.

What I need is a UNIX scripts that checks the count of archive log
at the destination . Once the count reaches 200 + it will remove
arch logs that are oldest . This script will run through the crontab .

Any way I have got the solution....


Again Thanx....

 Mohammed Taj
Posted: Feb 23, 2008 01:03:53 AM  

 Total Post: 694
 Joined: Jul, 2007






 
>>> it will remove
>>>arch logs that are oldest .
this is i want to say don't remove archivelog file becuase it is most important for recovery purpose.

Remove only after save in tape or after backup of database.


Regards
Taj

 Soumya
Posted: Feb 23, 2008 01:10:34 AM  

 Total Post: 56
 Joined: Mar, 2006






 

Hello,

Mr. Taj , I about this backup/recovery .

My issue was never about backup/recovery . All I need was a UNIX script
to clean up old archive logs.

If you want that script let me know , I will give you.


Thanx


 Mohammed Taj
Posted: Feb 23, 2008 01:22:09 AM  

 Total Post: 694
 Joined: Jul, 2007






 
ok
thanks for feedback.



 Tom
Posted: May 07, 2008 12:20:10 PM  

 Total Post: 1
 Joined: May, 2008






 
Here is the script

#!/bin/sh

grep $1 /archDir/archRm.txt | while read LINE
do
Server=`echo ${LINE} | awk '{print $1}'`
aPath=`echo ${LINE} | awk '{print $2}'`
noFile=`echo ${LINE} | awk '{print $3}'`
ls -1t $aPath | sed '1,'$noFile' d' > /archDir/$1a.out
echo cd $aPath > /archDir/$1b.out
sed 's/^/rm /g' /archDir/$1a.out >> /archDir/$1b.out
sh /archDir/$1b.out
done

. Save it as /archDir/archRm.sh and add execute permission to the file
. Setup a cronjob to run at your desire time. E.g
0,30 * * * * /archDir/archRm.sh <hostname>

Note: you need to specify the <hostname> argument to pass into $1

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar814
  Mohammed Taj694
  Jayanta Sur479
  Vigyan Kaushik386
  positive fanatic361
  Gitesh Trivedi322
  Gopu Gopi239
  neeraj sharma228
  Ramesh Jois226
  snehalatha p169






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software