Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

archiving problem of oraarch files on unix server

 
Highlighted
rahul_rtns
Frequent Advisor

archiving problem of oraarch files on unix server

Hi,

 

hi,
I am having an archiving script running on Blade860 server having hpux 11.31 installed on it.


We are having an archiving script in production server for the archiving of ".dbf" files that is scheduled to run on every hour (the crontab entry has been hashed out, so it is not running at present)

 In production server the format of file is  "sample file:(1_46226_652110140.dbf)"  and in DR server files are shipped as
(MPFarch1_46226_652110140.dbf). (Think this was done while Data guard configuration)

>>The old .dbf files from production server are getting deleted or moved to some other place that we are not able to figure out. Can anyone please confirm on this.

>>I want to have a unix script so that we can first ship the files to DR server and then the archiving should happen.

I am also giving the archiving script that we have currently hashed out in the server.

#!/usr/bin/csh
source $HOME/.dbenv_`hostname`.csh >/dev/null
l /oracle/$ORACLE_SID/oraarch/$ORACLE_SID* >& /dev/null
if ( "$status" > "0" ) then
   exit 2
endif
rm /oracle/$ORACLE_SID/scripts/last_archives.log
rman cmdfile=/sapbasis/common_scripts/Rman2.cmd > /oracle/$ORACLE_SID/scripts/last_archives.log
rman cmdfile=/sapbasis/common_scripts/Rman3.cmd
if ( "$status" > "0" ) then
  mailx -s "SAP archive backup of $ORACLE_SID failed.  Please check rman log" declarkson@babcock.com </oracle/$ORACLE_SID/scripts/last_archives.log
  exit 1
endif

(Can anyone explain the meaning of this script also as i m new to scripting)

Please give the suggestions on this or reply if any other information is required.

6 REPLIES 6
Highlighted
Dennis Handly
Acclaimed Contributor

Re: archiving problem of oraarch files on HP-UX server

>(Can anyone explain the meaning of this script also as I'm new to scripting)

 

First of all that C shell script should be rewritten in a real shell, ksh/sh.

 

>source $HOME/.dbenv_`hostname`.csh >/dev/null

 

This sources the variables in that .csh file.

 

>l /oracle/$ORACLE_SID/oraarch/$ORACLE_SID* >& /dev/null

 

This lists the files matching that pattern and sends to /dev/null.

 

>if ( "$status" > "0" ) then
   exit 2
endif

 

If there are no files, exit.

 

>rm /oracle/$ORACLE_SID/scripts/last_archives.log

 

Remove the .log.

 

>rman cmdfile=/sapbasis/common_scripts/Rman2.cmd > /oracle/$ORACLE_SID/scripts/last_archives.log
>rman cmdfile=/sapbasis/common_scripts/Rman3.cmd

 

Run rman twice.

 

>if ( "$status" > "0" ) then
  mailx -s "SAP archive backup of $ORACLE_SID failed.  Please check rman log" declarkson@babcock.com </oracle/$ORACLE_SID/scripts/last_archives.log
  exit 1
endif

 

If the last rman failed, send mail with a subject and the contents of the .log to the listed mail alias.

Highlighted
rahul_rtns
Frequent Advisor

Re: archiving problem of oraarch files on HP-UX server

Hi Dennis,

 

Thanks for your reply.

 

I am having concerns about one statement in the script that i am mentioning here :

 

>l /oracle/$ORACLE_SID/oraarch/$ORACLE_SID* >& /dev/null

 

This lists the files matching that pattern and sends to /dev/null.

 

I am having .dbf files in our production server that are generated as logs in /oracle/MP1/oraarch/*.dbf directory. The old .dbf files from this path are getting removed or moving to some other place that we are not aware of. The above archiving script is also we have hashed out and it is not running.

 

Highlighted
Dennis Handly
Acclaimed Contributor

Re: archiving problem of oraarch files on HP-UX server

>>l /oracle/$ORACLE_SID/oraarch/$ORACLE_SID* >& /dev/null


>I am having .dbf files in our production server that are generated as logs in /oracle/MP1/oraarch/*.dbf directory.

 

What is the value of $ORACLE_SID?  It would have to match MP1 before that l(1) command did something.

 

Is it defined in $HOME/.dbenv_`hostname`.csh?

Highlighted
rahul_rtns
Frequent Advisor

Re: archiving problem of oraarch files on HP-UX server

The value of $ORACLE_SID is MP1. It is defined.

Highlighted
Dennis Handly
Acclaimed Contributor

Re: archiving problem of oraarch files on HP-UX server

>The value of $ORACLE_SID is MP1. It is defined.

 

Then that script may be processing files like: /oracle/MP1/oraarch/MP1*.dbf

rahul_rtns
Frequent Advisor

Re: archiving problem of oraarch files on HP-UX server

In production server in the /oracle/MP1/oraarch folder the files are generated as 1_46259_652110140.dbf(sample file) and they are shipped in DR server as MPFarch1_46259_652110140.dbf.  The format of the file is changing after shipping. I thought this may be the configuration of Dataguard but i m not sure about this. We are renaming these files in DR server.

 

Also the old .dbf files are getting removed from the production server. That also we want to know.