Received: (qmail 22643 invoked from network); 12 Dec 2011 10:44:27 -0600
Received: from freelists-180.iquest.net (HELO turing.freelists.org) (206.53.239.180)
  by static-ip-85-25-126-90.inaddr.ip-pool.com with SMTP; 12 Dec 2011 10:44:15 -0600
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B04B6E68ABE;
 Mon, 12 Dec 2011 11:44:13 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1323708253; bh=5m+SfItwZ6UG9J5S9OfDgu77f7+fDkVEQ1LHHuEi
 u0U=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:
	 From:To:Cc:Content-type:Content-Transfer-Encoding:Sender:Reply-To:
	 List-help:List-unsubscribe:List-Id:List-subscribe:List-owner:
	 List-post:List-archive; b=xugXJN3UUEsaagjDjVPiMIN/1qXDEMO29gOhEv0n
 33MvEEJPTF3+l1N3mWsJk+U3YoX891ijsA6f/OBSQYSlq4l09bzWjm2nNDFrP6LB/NQ
 qsGH/dzZJsE+buuvMPDLn1OGx7uuPd/HK6M7KkXY7Qiwz8GT/FiA4+3yTHSrGHVY=
X-Virus-Scanned: Debian amavisd-new at localhost.localdomain
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id FpsZS-MJQXwB; Mon, 12 Dec 2011 11:44:13 -0500 (EST)
Received: from turing.freelists.org (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 8C1A6E68AA0;
 Mon, 12 Dec 2011 11:43:30 -0500 (EST)
Received: with ECARTIS (v1.0.0; list oracle-l); Mon, 12 Dec 2011 11:42:49 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id F3A2FE68A9E
 for <oracle-l@freelists.org>; Mon, 12 Dec 2011 11:42:48 -0500 (EST)
Authentication-Results: turing.freelists.org; dkim=pass (1024-bit key) header.i=@gmail.com
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 2ZCKVECZhHDo for <oracle-l@freelists.org>;
 Mon, 12 Dec 2011 11:42:48 -0500 (EST)
Received: from mail-vw0-f51.google.com (mail-vw0-f51.google.com [209.85.212.51])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 7FC32E68A92
 for <oracle-l@freelists.org>; Mon, 12 Dec 2011 11:42:48 -0500 (EST)
Received: by vbbfp1 with SMTP id fp1so3643075vbb.10
        for <oracle-l@freelists.org>; Mon, 12 Dec 2011 08:42:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc:content-type;
        bh=oiUb48X5wN6sHVTu0tlFCPq22I/aJxA12uHBXo2aevE=;
        b=K9cyKIbvev4JS9m/HrTJuIyDWB5ShBBsMdsap9L795hso0Zn9epT/esFSqNAa6bi83
         iZM54ziC9/bEmRzk14QFg5us46MTs2igfXiaZf0TdlwyVhfHv9UFwReQFgHtB1cE5qxS
         QRCSRGYnRwCXf6yyJ/nyj7d1F7fgkpqoxkHXY=
MIME-Version: 1.0
Received: by 10.182.11.72 with SMTP id o8mr3125128obb.36.1323708167834; Mon,
 12 Dec 2011 08:42:47 -0800 (PST)
Received: by 10.182.39.229 with HTTP; Mon, 12 Dec 2011 08:42:47 -0800 (PST)
In-Reply-To: <4EE57140.70805@tpg.com.au>
References: <CADmQEr7Fixwd4A8MSiVV5MVSg7DizD9ZLHRwd1WfW6SiSc9kzg@mail.gmail.com>
 <20111210125114.GA8239@app01.bos>
 <4EE57140.70805@tpg.com.au>
Date: Mon, 12 Dec 2011 11:42:47 -0500
Message-ID: <CADmQEr7td30-WBfhXprXEJW1+CZd30dXAkn_Op7XtaB3r8=+zQ@mail.gmail.com>
Subject: Re: Automate rman login with shell script
From: sundar mahadevan <sundarmahadevan82@gmail.com>
To: De DBA <dedba@tpg.com.au>
Cc: oracle-l@freelists.org
Content-type: text/plain
Content-Transfer-Encoding: 8bit
X-archive-position: 40592
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: sundarmahadevan82@gmail.com
Precedence: normal
Reply-To: sundarmahadevan82@gmail.com
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-subscribe: <oracle-l-request@freelists.org?Subject=subscribe>
List-owner: <mailto:steve.adams@ixora.com.au>
List-post: <mailto:oracle-l@freelists.org>
List-archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l

Hi All,
thanks for your  replies. i still cant get it to work. My script and output
has been attached below. I tried the same with bash shell as well and i get
the same error.
cat test.sh
#!/bin/ksh

. /u01/app/oracle/.profile1
cmd="
$ORACLE_HOME/bin/rman target sys@cricprod_prim <<EOF
syspassword
show all;
EOF
"
echo "$cmd"
eval "$cmd"

----------------------------------------------------------------

./test.sh
/u01/app/oracle/product/11.2.0/ee_db1/bin/rman target sys@cricprod_prim<<EOF
syspassword
show all;
EOF


Recovery Manager: Release 11.2.0.2.0 - Production on Mon Dec 12 11:38:17
2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights
reserved.

target database Password:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01017: invalid username/password; logon denied



On Sun, Dec 11, 2011 at 10:13 PM, De DBA <dedba@tpg.com.au> wrote:

> Test confirms Martijn's hunch. It's the \n at the end of each line - it's
> not interpreted but incorporated in the string:
>
> $ cmd="rman target sys@home1 <<EOF
> pwd
> EOF
> "
>
> $ eval "$cmd"
>
> Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 12 13:02:15
> 2011
>
> Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights
> reserved.
>
> target database Password:
> connected to target database: HOME1 (DBID=999999999)
>
> RMAN>
>
> Recovery Manager complete.
>
> $ cmd="rman target sys@home1 <<EOF
> pwd\n
> EOF
> "
>
> $ eval "$cmd"
>
> Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 12 13:02:24
> 2011
>
> Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights
> reserved.
>
> target database Password:
> RMAN-00571: ==============================**=============================
> RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
> RMAN-00571: ==============================**=============================
> RMAN-00554: initialization of internal recovery manager package failed
> RMAN-04005: error from target database:
> ORA-01017: invalid username/password; logon denied
>
> $
>
>
> Cheers,
> Tony
>
>
> On 10/12/11 22:51, Martijn Bos wrote:
>
>> Is this all of your script?
>> I'm missing something like the following at one of the first lines:
>> #!/bin/bash
>>
>> Also it's my experience that you do not need the \n's after every line.
>> And the EOF" should read EOF I guess.
>>
>> Can you please include some more (the whole) of the script you are
>> editing?
>> And maybe some results or the errors.
>>
>> Oh...and rman changed a little over versions so maybe you should include
>> some details concerning OS and oracle versions.
>>
>> Best Regards,
>> Martijn Bos
>>
>> On Fri, Dec 09, 2011 at 03:38:09PM -0500, sundar mahadevan wrote:
>>
>>> Hi All,
>>> I have done the following similar with sqlplus -s but cant get this for
>>> rman. Not sure what i am doing wrong. i tried it with "echo -e" as well
>>> but
>>> cant get it to work. Has anyone got this to work? Thanks in advance.
>>> cmd="rman target sys@cricprod_prim.**theglobeandmail.com<sys@cricprod_prim.theglobeandmail.com>auxiliary
>>> sys@cricprod_logstdby.**theglobeandmail.com@/u01/app/**
>>> oracle/sm/build_cricprodls.rcv
>>> <<EOF\n
>>> PasswordOfPrim\n
>>> PasswordOfLogstdby\n
>>> EOF"
>>>
>>> eval "$cmd"
>>>
>>>
>>> --
>>> http://www.freelists.org/**webpage/oracle-l<http://www.freelists.org/webpage/oracle-l>
>>>
>>>
>>>
>> --
>> http://www.freelists.org/**webpage/oracle-l<http://www.freelists.org/webpage/oracle-l>
>>
>>
>>
>>
>>
>


--
http://www.freelists.org/webpage/oracle-l


