Manage archive redo log files

Here is a simple script that I use on AIX to manage archive redo log files. This will create a empty tar file, and loop through the available arch log files appending to the tar. Once complete, the tar is compressed.


###part 1: Daily arch log compressed tar
#create the daily tar file
DATE=`date +'%Y%m%d_%H%M%S'`
cd /dir1/dir2
tar cvf arch${DATE}.tar

#loop through arch log files from last 24 hours (current timedate - 24 hours)
find . -name "a*.log" -ctime +1 | while read FN
  #add last 24 hours files to tar archive file
  tar uvf arch${DATE}.tar ${FN}
  rm ${FN}

#compress tar file
gzip arch${DATE}.tar

Reader Feedback

Robert H. writes: The command

tar cvf arch${DATE}.tar

does not work in tru64 Unix. To tar something, I usually type it like this:

tar cvf arch${DATE}.tar things_to_tar

Madhukar Y. writes: I have a slight correction to this tip. To get all the archived log files from the last 24 hours, the syntax has to be

find . -name "a*.log" -ctime -1 | while read FN

instead of

find . -name "a*.log" -ctime +1 | while read FN

For More Information

  • What do you think about this tip? E-mail the Editor at

    Requires Free Membership to View

This was first published in May 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.