RE: Automate rman login with shell script

From: Taylor, Chris David <ChrisDavid.Taylor_at_ingrambarge.com>
Date: Mon, 12 Dec 2011 10:47:49 -0600
Message-ID: <C5533BD628A9524496D63801704AE56D6A34135844_at_SPOBMEXC14.adprod.directory>



I may be mistaken (probably am) but doesn't the password HAVE to go on the next line below the "<< EOF"

$ORACLE_HOME/bin/rman target sys_at_cricprod_prim <<EOF
syspassword
show all;
EOF That's the way I always wrote them, otherwise how does it know where the password ends? (Notice there is no space, after syspassword)

Chris Taylor
Sr. Oracle DBA
Ingram Barge Company
Nashville, TN 37205

"Quality is never an accident; it is always the result of intelligent effort." -- John Ruskin (English Writer 1819-1900)

CONFIDENTIALITY NOTICE: This e-mail and any attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender immediately and delete the contents of this message without disclosing the contents to anyone, using them for any purpose, or storing or copying the information on any medium.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of sundar mahadevan Sent: Monday, December 12, 2011 10:43 AM To: De DBA
Cc: oracle-l_at_freelists.org
Subject: Re: Automate rman login with shell script

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_at_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_at_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_at_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_at_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_at_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_at_cricprod_prim.**theglobeandmail.com<sys_at_cricprod_prim.theglobean
>>> dmail.com>auxiliary
>>> sys_at_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




--
http://www.freelists.org/webpage/oracle-l
Received on Mon Dec 12 2011 - 10:47:49 CST

Original text of this message