Manage archive redo log files

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.

#!/bin/ksh

###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
do
  #add last 24 hours files to tar archive file
  tar uvf arch${DATE}.tar ${FN}
  rm ${FN}
done

#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

    Requires Free Membership to View

    By submitting your registration information to SearchOracle.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchOracle.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

  • Best Oracle Web Links
    : tips, tutorials, scripts, and more.
  • Have an Oracle tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
  • Ask your technical Oracle questions--or help out your peers by answering them--in our live discussion forums.
  • Check out our Ask the Experts feature: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.

This was first published in May 2002

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.

    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.