Re: Automate rman login with shell script

  • From: De DBA <dedba@xxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Mon, 12 Dec 2011 13:13:04 +1000

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@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx auxiliary
>> sys@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@/u01/app/oracle/sm/build_cricprodls.rcv
>> <<EOF\n
>> PasswordOfPrim\n
>> PasswordOfLogstdby\n
>> EOF"
>>
>> eval "$cmd"
>>
>>
>> --
>> //www.freelists.org/webpage/oracle-l
>>
>>
>
> --
> //www.freelists.org/webpage/oracle-l
>
>
>
>

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


Other related posts: