1

I have a cron job scheduled as below.what it will do is invoke RMAN in Oracle and then clear all the achivelogs in the oracle database which are 1 day old. But the issue is that it is not getting executed through the cron job. but if I execute the same script from the prompt it nicely delete the logs through RMAN. Please help me in sheduling this script...

05 07 * * * /x01/rman_backup/mahesh/logde.sh

contents of the script as follows

#!/bin/bash
 /x01/oracle/app/oracle/product/11.2.0/db_1/bin/rman cmdfile=/x01/rman_backup/mahesh /logdelete.rcv

The Content of the logdelete.rcv is as below

connect target /
 run
  {
  delete archivelog all completed before 'trunc(sysdate)';
  crosscheck archivelog all;

   }
 exit;

Please someone help me in scheduling this. I'm using this in SUSE Linux version 11

shx2
  • 61,779
  • 13
  • 130
  • 153
user1793864
  • 241
  • 2
  • 6
  • 13

2 Answers2

0

Generally, use output redirection with your cronjob to collect errors in a file, e.g.

06 12 * * * /x01/rman_backup/mahesh/logde.sh > /x01/rman_backup/mahesh/output.txt 2>&1

Specifically, your problem is probably that logdelete.rcv will not be found from cron, as this job will execute in $HOME so the file would need to be there. If it's not, specify the full path to it.

C. Ramseyer
  • 2,322
  • 2
  • 18
  • 22
0

You must have some initializations which are done for your console but not in cron execution. Initialize variables manually or manually source profile files in your cron line.

igr
  • 3,409
  • 1
  • 20
  • 25