Operating System - HP-UX
1833452 Members
3497 Online
110052 Solutions
New Discussion

find atime mtime purge oracle log

 
kholikt
Super Advisor

find atime mtime purge oracle log

Hi,

I just wondering why the following command doesn't work

find /oracle/TRP/saparchlocal -name '*arch*dbf' -atime +1 -print -exec ls -al {} \;

I have the following file in this directory I only want to list out those file where the timestamp is more than 1 day. I have tried mtime but doesn't seem to work as well. Please help.

-rw-rw---- 1 oratrp dba 41942016 Jun 22 12:00 TRParch1_2420.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 12:33 TRParch1_2421.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 12:36 TRParch1_2422.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 12:38 TRParch1_2423.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 12:41 TRParch1_2424.dbf
-rw-rw---- 1 oratrp dba 41942016 Jun 22 12:51 TRParch1_2425.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 14:07 TRParch1_2426.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 14:08 TRParch1_2427.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 14:09 TRParch1_2428.dbf
-rw-rw---- 1 oratrp dba 41938944 Jun 22 14:10 TRParch1_2429.dbf
---------- 1 oratrp dba 6618112 Jun 22 15:30 TRParch1_2430.dbf
---------- 1 oratrp dba 0 Jun 22 16:45 TRParch1_2431.dbf
---------- 1 oratrp dba 0 Jun 22 17:45 TRParch1_2432.dbf
---------- 1 oratrp dba 0 Jun 22 17:45 TRParch1_2433.dbf
---------- 1 oratrp dba 0 Jun 22 17:45 TRParch1_2434.dbf
---------- 1 oratrp dba 0 Jun 22 18:00 TRParch1_2435.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 20:05 TRParch1_2436.dbf
-rw-rw---- 1 oratrp dba 41942016 Jun 22 22:30 TRParch1_2437.dbf
-rw-rw---- 1 oratrp dba 41942016 Jun 22 23:31 TRParch1_2438.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 22 23:34 TRParch1_2439.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 01:01 TRParch1_2440.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 04:30 TRParch1_2441.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 07:30 TRParch1_2442.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 07:33 TRParch1_2443.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 07:36 TRParch1_2444.dbf
-rw-rw---- 1 oratrp dba 41942016 Jun 23 09:26 TRParch1_2445.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 10:45 TRParch1_2446.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 11:09 TRParch1_2447.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 11:10 TRParch1_2448.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 11:10 TRParch1_2449.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 12:32 TRParch1_2451.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 12:43 TRParch1_2452.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 14:04 TRParch1_2453.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 15:25 TRParch1_2454.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 16:30 TRParch1_2455.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 17:31 TRParch1_2456.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 17:34 TRParch1_2457.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 18:18 TRParch1_2458.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 19:55 TRParch1_2459.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 20:36 TRParch1_2460.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 23:02 TRParch1_2461.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 23:32 TRParch1_2462.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 23:34 TRParch1_2463.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 23:37 TRParch1_2464.dbf
-rw-rw---- 1 oratrp dba 41942016 Jun 24 03:00 TRParch1_2465.dbf
-rw-rw---- 1 oratrp dba 41943040 Jun 24 06:02 TRParch1_2466.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 24 07:33 TRParch1_2467.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 24 07:35 TRParch1_2468.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 24 09:56 TRParch1_2469.dbf

abc
6 REPLIES 6
Muthukumar_5
Honored Contributor

Re: find atime mtime purge oracle log

hai,

To find the files with timestamp more than one day +1 is correct.

The find with -ctime for changed time,-mtime for modified time and -atime for accessed time.

So -mtime option,we have to do the modification in that file.

Regards,
Muthukumar.
Easy to suggest when don't know about the problem!
john korterman
Honored Contributor

Re: find atime mtime purge oracle log

Hi kholikt,
you should keep in mind that certain backup methods affect (update) the access timestamp - a simple copy also does.
+1 means "more than 24 hours" so the result will also depend on the time the command is executed.
You should also protect your wildcards with qoutes in order to prevent the automatic filename expansion in the current directory, i.e. the wildcards must not be expanded before the shell starts executing the commands.
Btw: the listing of the files with no permissions indicate that something went wrong during af copy/backup operaton; perhaps a full filesystem.

regards,
John K.
it would be nice if you always got a second chance
Indira Aramandla
Honored Contributor

Re: find atime mtime purge oracle log

Hi,

To list the files that are 24 hours older you use as you did

find /path -name "*string*" -mtime +1 -exec ls -l {} \;

So with your find (say if you executed your find at 20:00 hours on 24-JUN-04) you should get listing of the files
-rw-rw---- 1 oratrp dba 41944064 Jun 23 18:18 TRParch1_2458.dbf
-rw-rw---- 1 oratrp dba 41944064 Jun 23 19:55 TRParch1_2459.dbf

If you wanted files that are older than a given time then user the -newer parameter of find.

1. touch a file with a given time as
touch CCYYMMDDHHMMSS

2. find /path -name "*string*" -newer touch_file -exec ll {} \;

This will list all the files older that the touched file.

Indira A



Never give up, Keep Trying
Volker Borowski
Honored Contributor

Re: find atime mtime purge oracle log

Hi,

as this is SAP Environment and you probably backup the archivelogs with brarchive and the -cds option, keep in mind that brarchive accesses these file for reading two times before they are deleted.

So if you run "brarchive -cds" each day, atime will never be greater than 1,0 days, because brarchive will access the file and reset atime, and next day it will delete the file.

Since no one writes to these files beside the archiver process, ctime should be sufficiant for you.

Hope this helps
Volker
kholikt
Super Advisor

Re: find atime mtime purge oracle log

Just wondering where is those info like atime, mtime and ctime was kept for a file. I suppose this is different from the time I see from ls -al command
abc
john korterman
Honored Contributor

Re: find atime mtime purge oracle log

Hi again,
the information is kept in the inode for the file in question: the "ls -al" shows the time of the last change, like "mtime".
"ls -lu" shows the last time the file was accessed, like "atime".

regards,
John K.
it would be nice if you always got a second chance