Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: RMAN command from script

Re: RMAN command from script

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Mon, 28 Nov 2005 21:41:08 +0100
Message-ID: <dmfq14$5om$00$1@news.t-online.com>


ram schrieb:
> Hello,
> I am trying to run the RMAN backup from a script (unix). i wrote a
> small script (sh) with following commands:
> rman TARGET /
> RUN { backup database;
> }
> when i run it gives errors RUN, backup commands not found.
Who gives errors?
Your shell?
If what you posted is taken from your script exactly, shell should never get control after rman was called (except , rman command was not found) . If it is rman, could you post the entire error stack and some unimportant details such as Oracle version and OS ?
> Do i need to store this file under some specific dir? am i missing
> something?
> Thanks
>

In general, to run rman from shell script you have to ensure, that you have proper environment set (on Linux it may be necessary to get rid of another rman executable which has nothing to do with oracle). The next thing, you have to redirect somehow the contents of your shell script to rman input. It can be for example a here document or somewhat else...

#! /bin/bash
ORACLE_HOME=/abc/xyz
PATH=$ORACLE_HOME/bin:$PATH
ORACLE_SID=yoursid
export ORACLE_HOME ORACLE_SID PATH
rman target / << RMAN_SCRIPT > backup.log backup database;
exit;
RMAN_SCRIPT
exit 0

Best regards

Maxim Received on Mon Nov 28 2005 - 14:41:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US