ORACLE 11G Single Instance disk File System DG archive log Delete script based on Red HAT LINUX 5.3 X86 64BIT

Source: Internet
Author: User

Recently do a DG archive log Delete,

[[Email protected] logs]crontab-l* 8 * * * sh/home/oracle/dbscripts/del_arc.sh
The script calls generate delete checksum three scripts respectively
Cat del_arc.sh#! /bin/bashsource/home/oracle/.bash_profilesh/home/oracle/dbscripts/build_del_archivelog.sh >>/home/oracle/ Dbscripts/del_arch ' Date +%f_%h '. Shsleep 5sh/home/oracle/dbscripts/del_arch ' date +%f_%h '. SH >>/home/oracle/ Dbscripts/logs/del_arch ' Date +%f_%h '. Logsleep 5sh/home/oracle/dbscripts/crosscheck_archivelog.sh >>/home/ Oracle/dbscripts/logs/cross_check ' Date +%f_%h '. Log

First look at the generated

Cat build_del_archivelog.sh sqlplus-s shark/235619<<eofset heading  offset linesize 1000set echo offset Feedback offset Timing  offset termout onset trimout offset trimspool onset newpage noneselect ' rm-f ' | | Name  from  v\ $archived _log where applied= ' YES ' and deleted= ' NO ' and Completion_time < trunc (sysdate); Eof


The primary is to generate the physical deletion of archived logs that have been applied from V$archived_log, note that the name in ASM Disk Management does not include paths.

In addition, the spacing of each line is too large, I hope you will not hesitate to enlighten.


The resulting delete script

]head del_arch2014-05-07_08.sh rm-f/arch_backup/1_24144_831167377.log                               Rm-f/arch_backup/2_22765_831167377.log        


Is that Y's too much line spacing.

]cat crosscheck_archivelog.sh #! /bin/bashsource/home/oracle/.bash_profileexec >>/home/oracle/dbscripts/logs/del_arch ' Date +%F_%H '. log$ Oracle_home/bin/rman target/<<eofcrosscheck archivelog all;delete noprompt expired archivelog all; #delete NoPrompt Archivelog until time ' sysdate-1 '; exit; Eof

This is the last script for the test! The annotations that were originally used to delete the archived logs.

This verification script is primarily intended to clean up archived information. Assuming this information is stored in the control file, DG can't be deleted.




ORACLE 11G Single Instance disk File System DG archive log Delete script based on Red HAT LINUX 5.3 X86 64BIT

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.