Hello Prem,
my code will work with ksh and sh. I don't have a HP-UX system but I assume it will work with HP-UX, too as it is a standard shell script.
In my code you have to insert the path in which your logs are written, then your code will be executed only when one or more logs are present to backup. I don't know this path, it is defined in your database configuration.
If your script is executed every 6 hours, then change the value of the mmin parameter from -30 to -360 - I have done this in the example below.
I don't know the names of your logs, so please adjust the value of the name parameter.
Then the script should be something like this...
filecount=`find <path_to_logdirectory> -type f -name "*.log" -mmin -360 | wc -l`
if [ $filecount -gt 0 ]
then
cat /dev/null>/oracle/script/DBarch_test.log
su - oratest <<EOF
brarchive -sd -c force -u / >> /oracle/script/DBarch_test.log
EOF
else
return 0
fi
So, please play around with the script code and try some variations.
Best regards,
Jochen
------------------------------
Jochen Meixner
Principal Consultant Storage & Backup Solutions
ACT Gruppe
Duesseldorf, Germany
------------------------------
Original Message:
Sent: Thu October 17, 2019 05:52 PM
From: Prem Singh
Subject: SAP Archive log schedule is returning error Failed1
Hi Jochen,
Thanks for the quick response below is the script which is running through SP scheduler. that invokes in every 6 hour through SP scheduler. Please advice now. operating system is hp-ux.
#!/bin/sh
cat /dev/null>/oracle/script/DBarch_test.log
su - oratest <<EOF
brarchive -sd -c force -u / >> /oracle/script/DBarch_test.log
EOF
--
Original Message------
Hello,
I don't know which OS and which scripting language you are using.
Here is an example for a linux ksh script:
filecount=`find <path_to_logdirectory> -type f -name "*.log" -mmin -30 | wc -l`
if [ $filecount -gt 0 ]
then
<your code to backup the logs>
else
return 0
fi
Do the following adjustments before trying this code:
- This assumes you are backing up your logs every 30 minutes, otherwise correct the value of mmin to the number of minutes the script should search for new logfiles.
- replace the <path_to_logdiectory> with the directory the logfiles reside in.
- replace the value of the -name parameter if your logfiles do not end with .log
- replace the spaceholder <your code to backup the logs>with your code for the log backup
This should start your backup when there are logfiles to process only, otherwise it returns 0.
I hope this helps...
Best regards,
Jochen
------------------------------
Jochen Meixner
Principal Consultant Storage & Backup Solutions
ACT Gruppe
Duesseldorf, Germany
------------------------------
#PrimaryStorage
#Storage
#StorageManagementandReporting