Friday, November 26, 2021

Script to flush the online redologs in oracle database

 Script to flush the online redo logs in oracle database:

we have come across some requirement to flush the online redo log  and generate the archive forcifully,so created this script.

When you run this script just pass the <SID> and  script will create the archives.

flush_oracle_8i_redo.ksh

#!/bin/ksh

#######################################################################

# Purpose :This script force to generate archive 

# Developed by Bala nov-17-2021

# need to pass the SID

#######################################################################

wdir=`pwd`

hostname=`hostname`

date=`date +"%b %d, %Y %T"`

export wdir

cd $wdir


ORACLE_SID=$1

export ORACLE_SID=$1

export ORACLE_HOME=/opt/oracle/product/8.1.7

export PATH=$PATH:/opt/oracle/product/8.1.7/bin

export NLS_LANG=AMERICAN_AMERICA.UTF8

export SHLIB_PATH=$ORACLE_HOME/lib


########################################################################

# Check DB status   and flush archive                                  #

########################################################################


sqlplus -s /nolog << EOF


connect / as sysdba

set echo on

set verify on

set feedback on

set heading off;

col open_mode for a10

spool /home/sqlutils/${ORACLE_SID}_db_archive_flush.log

select  name,open_mode from v\$database;

ALTER SYSTEM ARCHIVE LOG CURRENT;

spool off

EOF



**********************************

No comments:

Post a Comment