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
- What do you think about this tip? E-mail the Editor at
Requires Free Membership to View
- tdichiara@techtarget.com with your feedback.
- The 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