Oracle10gracstandby automatic deletion script for archiving logs
Oracle 10g rac standby automatic deletion script for archiving logs
Homepage → Database Technology
Background:
Read News
Oracle 10g rac standby automatic deletion script for archiving logs
[Date:] Source: Linux Author: calvin_kang [Font:]
Oracle 10g rac standby automatic deletion script for archiving logs
#! /Bin/bash
Export ORACLE_HOME =/opt/oracle/product/10.2.0/db_1
Export ORACLE_SID = standby1
Export ARCHIVE_DIR =/log/archivelog
Export LOG_FILE =/home/oracle/logs/del_archive.log
If [! $1]
Then
Sn = 200
Else
Sn = $1
Fi
Echo "begin delete archivelog: 'date'..."> $ LOG_FILE
If ['whoam '! = 'Oracle ']
Then
Echo "Error: You must be oracle to execute."> $ LOG_FILE
Exit 99
Fi
Echo "delete archivelog thread 1"> $ LOG_FILE
Del_seq = 'LS-tr $ ARCHIVE_DIR/| grep-v stdarch | grep arch_1 | head-1 | cut-f3-d _'
$ ORACLE_HOME/bin/sqlplus-silent "/as sysdba" < /Home/oracle/logs/tmp1.log
Set pagesize 0 feedback off verify off heading off echo off
Select max (sequence #) from v \ $ ARCHIVED_LOG where THREAD # = 1 and APPLIED = 'yes ';
Exit;
XFF
Max_sn = 'cat/home/oracle/logs/tmp1.log'
Rm/home/oracle/logs/tmp1.log-f
Max_sn =$ ($ max_sn-$ sn ))
While [[$ {del_seq}-lt $ {max_sn}]
Do
Echo "$ {ARCHIVE_DIR}/arch_1 _ $ {del_seq} _ 794450242.arc"> $ LOG_FILE
Rm ${ARCHIVE_DIR}/arch_1 _ $ {del_seq} _ 794450242.arc-f
Del_seq = $ ($ del_seq + 1 ))
Done
Echo "delete archivelog thread 2"> $ LOG_FILE
Del_seq = 'LS-tr $ ARCHIVE_DIR/| grep-v stdarch | grep arch_2 | head-1 | cut-f3-d _'
$ ORACLE_HOME/bin/sqlplus-silent "/as sysdba" < /Home/oracle/logs/tmp2.log
Set pagesize 0 feedback off verify off heading off echo off
Select max (sequence #) from v \ $ ARCHIVED_LOG where THREAD # = 2 and APPLIED = 'yes ';
Exit;
XFF
Max_sn = 'cat/home/oracle/logs/tmp2.log'
Rm/home/oracle/logs/tmp2.log-f
Max_sn =$ ($ max_sn-$ sn ))
While [[$ {del_seq}-lt $ {max_sn}]
Do
Echo "$ {ARCHIVE_DIR}/arch_2 _ $ {del_seq} _ 794450242.arc"> $ LOG_FILE
Rm ${ARCHIVE_DIR}/arch_2 _ $ {del_seq} _ 794450242.arc-f
Del_seq = $ ($ del_seq + 1 ))
Done
Echo "end delete archivelog: 'date'..."> $ LOG_FILE
$ ORACLE_HOME/bin/rman target/< > $ LOG_FILE
Crosscheck archivelog all;
Delete noprompt expired archivelog all;
Exit;
EOF
Echo ".................................... ">>> $ LOG_FILE
0
RMAN backup error Message file RMAN . Msb not found
Oracle rac ssh equivalence Configuration
Oracle 10g RAC
Image Information
View All comments in this article (0)
Comments
Latest Information
Popular this week
Introduction to Linux community-advertisement service-website map-help Info-contact us
The articles published on this site (LinuxIDC) do not mean that they agree with the statement or description. They only provide more information and do not constitute any suggestions.
Copyright©2006-2011 Linux community All rights reserved Zhejiang ICP backup No. 06018118