Archive logs record database operation records, which are the basis for data recovery. If the archive mode is enabled for the database, a large number of archive logs will be generated. Of course, if there is an RMAN backup, logs that have been backed up can be deleted after the backup. If RMAN backup is not used, you need to delete the archived logs by yourself. The following scripts reduce DBA workload.
Linux platform:
0 2 ***/home/Oracle/scripts/del_archive.sh>/home/Oracle/scripts/del_archive.log
[Oracle @ hfcc-svr-newccsdb1 ~] $ More/home/Oracle/scripts/del_archive.sh
#! /Usr/bin/KSh
# Create by tianlesoftware
Export ORACLE_HOME =/DBA/Oracle/product/10.2.0/db_1
Export oracle_sid = orcl
Export shell_dir =/home/Oracle/scripts
Del_seq = 'ls/u01/newccs_archive/| head-1 | cut-F2-D _'
Echo $ del_seq
$ ORACLE_HOME/bin/sqlplus-s "sys/pwd @ Sid as sysdba" <EOF>/home/Oracle/scripts/MAX
_ SN. Log
Set head off;
Set feedback;
Select max (sequence #) from V/$ log_history;
Exit;
EOF
Max_sn = 'cat/home/Oracle/scripts/max_sn.log | awk '{print $1}' | grep ^ [0-9]'
Max_sn = 'expr $ max_sn-5'
Echo $ max_sn
While [$ del_seq-lt $ max_sn]
Do
Rm/u01/archive/1 _ "$ del_seq" _ 692846987.dbf
Del_seq = 'expr $ del_seq + 1'
Echo $ del_seq
Done
Or use the script:
Del_arc.sh
Find/u01/backups-mtime + 10-name "*. DBF"-exec Rm-RF {}/;
Windows:
Del_arc_orcl.bat
Forfiles/P d:/arc_orcl/M *. DBF/D-3/C "CMD/C del @ file"
Add del_arc_orcl.bat to the scheduled task.