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@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>auxiliary >>> sys@cricprod_logstdby.**theglobeandmail.com@/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<//www.freelists.org/webpage/oracle-l> >> >> >> >> >> > -- //www.freelists.org/webpage/oracle-l