Search This Blog

Total Pageviews

Tuesday 19 October 2010

Oracle Copy or move old archive log file

ctime last time the inode changed - ie., chmod, chown, etc.
atime last time the file was read (Example: cat, grep, sort, vim, file_get_contents..)
mtime last time the file was written, or open append and closed without writing.



-mtime -2 means files that are less than 2 days old, such as a file that is 0 or 1 days old.

-mtime +2 means files that are more than 2 days old... {3, 4, 5, ...}


find /opt/oracle/admin/anuj/arch -type f -mtime +2|xargs cp -p {} /mnt/backup/Archive_Before_16102010/ {} \;

find /opt/oracle/admin/anuj/arch/*.arc -mtime +2 -exec cp -p {} /mnt/backup/Archive_Before_16102010/ {} \;


find /opt/oracle/admin/anuj/arch -type f -mtime +2|xargs mv {} /mnt/backup/Archive_Before_16102010/ {} \;


shell script


days=10
find '/opt/oracle/admin/anuj/arch/' -type f -mtime +$days | \
# find '/tmp/' -type f -mtime +$days | \
while read file
do
cp $file /mnt/backup/Archive_Before_16102010/
# cp $file /tmp/XXX
done

Oracle DBA

anuj blog Archive