Many a times , the DBA need to remove/housekeep the files on file system on Server so as to make the database running fine...!!
You can also remove files based on the age of the file. For example, say you determine that any trace files more than 2 days old can be safely deleted. Typically, the find command is used in conjunction with the rm command to accomplish this task. Before removing files, first display the results of the find command:
You can also remove files based on the age of the file. For example, say you determine that any trace files more than 2 days old can be safely deleted. Typically, the find command is used in conjunction with the rm command to accomplish this task. Before removing files, first display the results of the find command:
$ find . -type f -mtime +2 -name "*.trc*"
If
you are satisfied with the list of files, then add the 'rm'
command to remove them:
$ find . -type f -mtime +2 -name "*.trc*" | xargs rm
In
the prior line of code, the results of the find
command are piped to the xargs command,
which executes the rm command
for every file found by the find command.
This is an efficient method for deleting files based on age. However, be very
sure you know which files will be deleted.
Another
file that sometimes consumes large amounts of space is the listener.log
file. Because this file is actively written to by the
listener process
$ cp listener.log /u01/backups
Next,
use the cat command to replace (nullify) the
contents of the listener.log with
the /dev/null file (which contains zero
bytes) :
$ cat /dev/null > listener.log
For Archivelog deletion, we can use various policies as below :
On Primary
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
On Standby (
Depends upon where backup is preformed )
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;