cancel
Showing results for 
Search instead for 
Did you mean: 

Need HP UX command

 
Afaq
Advisor

Need HP UX command

HI,

 

Since we maintain database files regularly, i'm looking for an hp-ux command to remove files that:

1-have the word "arch" in their names.

2-have "dbf" extension.

3-older than two days.

 

please provide me with the single command so that i remove all files that meet the three conditions above at once.

1 REPLY
Matti_Kurkela
Honored Contributor

Re: Need HP UX command

The command you need is "find".

 

find /some/directory -name "*arch*.dbf" -mtime +1 -exec rm {} \+

 

-mtime +1 means "older than 1 full day, ignoring fractional days" = "at least 2 full days old" = "48 hours old or older". If this is not what you want, adjust the value. (-mtime +2 would be "72 hours old or older")

 

This looks like you're removing database archivelogs. If the archivelogs are used for on-line database backups, why does the backup software not delete the old archivelogs when (and *only* when) they've been successfully stored on tape?

 

If you delete all archivelogs older than 2 days without making sure they're successfully backed up first, and the tape backup system fails on a Friday evening and cannot be fixed until Monday, this will start removing archivelogs that are not backed up, breaking the archivelog chain. A broken archivelog chain makes it difficult to restore the database state to any point in time after the break.

 

To recover from a broken archivelog chain, a full database backup may be required so that a new chain of archivelogs can be started. If your database is large, a full backup might take a very long time. With multi-terabyte databases, accepting that the database will stop if the backup hardware fails and archivelog space fills up might result in a shorter service break than breaking the log chain and making the full backup before resuming normal service (been there, learned the lesson!).

MK