FAQ
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 auxiliary
sys@cricprod_logstdby.theglobeandmail.com@/u01/app/oracle/sm/build_cricprodls.rcv
<<EOF\n
PasswordOfPrim\n
PasswordOfLogstdby\n
EOF"

eval "$cmd"

Search Discussions

  • Phillip Jones at Dec 9, 2011 at 9:38 pm
    Hi,
    EOF"

    Should be

    EOF
    "

    Phil
    On Fri, Dec 9, 2011 at 8:38 PM, sundar mahadevan wrote:


    cmd="rman target 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"



    --
    http://www.freelists.org/webpage/oracle-l
  • Jared Still at Dec 10, 2011 at 12:40 am

    On Fri, Dec 9, 2011 at 1:34 PM, Phillip Jones wrote:
    Hi,
    EOF"

    Should be

    EOF
    "
    That doesn't seem to be necessary - identical results on Oracle Linux 5
    with bash and ksh on (old) Suse linux

    ====
    #!/bin/sh

    cmd="
    $ORACLE_HOME/bin/rman target / nocatalog <<EOF
    show all;
    EOF"

    echo "$cmd"

    eval "$cmd"


    results:

    16:35-poirot:ts20:jkstill-27 > ./r.sh

    /u01/app/oracle/product/10gR2/ts20/bin/rman target / nocatalog <<EOF
    show all;
    EOF

    Recovery Manager: Release 10.2.0.3.0 - Production on Fri Dec 9 16:35:51 2011

    Copyright (c) 1982, 2005, Oracle. All rights reserved.

    connected to target database: TS20 (DBID=509834197)
    using target database control file instead of recovery catalog

    RMAN>
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
    CONFIGURE BACKUP OPTIMIZATION OFF; # default
    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; #
    default
    CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
    CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO
    '/u01/app/oracle/product/10gR2/ts20/dbs/snapcf_ts20.f'; # default

    RMAN>

    Recovery Manager complete.
    [ /home/jkstill/tmp ]

    16:35-poirot:ts20:jkstill-27 > PD KSH v5.2.14 99/07/13.2^C
    [ /home/jkstill/tmp ]


    Jared Still
    Certifiable Oracle DBA and Part Time Perl Evangelist
    Oracle Blog: http://jkstill.blogspot.com
    Home Page: http://jaredstill.com
  • Jared Still at Dec 10, 2011 at 12:42 am

    On Fri, Dec 9, 2011 at 12:38 PM, 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
    ...

    Hard to help when we don't know what happens with your script.

    Care to share the output and a reproducible test case?

    Jared Still
    Certifiable Oracle DBA and Part Time Perl Evangelist
    Oracle Blog: http://jkstill.blogspot.com
    Home Page: http://jaredstill.com
  • Martijn Bos at Dec 10, 2011 at 12:52 pm
    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 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
  • De DBA at Dec 12, 2011 at 3:14 am
    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 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
  • Sundar mahadevan at Dec 12, 2011 at 4:43 pm
    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 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
  • Taylor, Chris David at Dec 12, 2011 at 4:50 pm
    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@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@freelists.org On Behalf Of sundar mahadevan
    Sent: Monday, December 12, 2011 10:43 AM
    To: De DBA
    Cc: oracle-l@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@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 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.theglobean
    dmail.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




    --
    http://www.freelists.org/webpage/oracle-l
  • Taylor, Chris David at Dec 12, 2011 at 4:53 pm
    Bah. Humbug.

    Looks the oracle-l mail engine strips off the formatting.

    $ORACLE_HOME/bin/rman target sys@cricprod_prim <<EOF
    syspassword
    show all;
    EOF

    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@freelists.org On Behalf Of Taylor, Chris David
    Sent: Monday, December 12, 2011 10:48 AM
    To: 'sundarmahadevan82@gmail.com'; 'De DBA'
    Cc: 'oracle-l@freelists.org'
    Subject: RE: Automate rman login with shell script

    I may be mistaken (probably am) but doesn't the password HAVE to go on the next line below the "<< 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@freelists.org On Behalf Of sundar mahadevan
    Sent: Monday, December 12, 2011 10:43 AM
    To: De DBA
    Cc: oracle-l@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@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 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.theglobean
    dmail.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




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




    --
    http://www.freelists.org/webpage/oracle-l
  • Sundar mahadevan at Dec 12, 2011 at 5:38 pm
    Forgot to add that i am on Oracle 11g Rel 2 EE on Suse Linux 11 x86_64.
    Thanks.
  • Sundar mahadevan at Dec 12, 2011 at 6:40 pm
    Hi All,
    I changed my script to connect differently and it works fine now. Attached
    new script as below. Thanks all for your help. Appreciate it.
    #!/bin/sh
    . /u01/app/oracle/.profile1
    ${ORACLE_HOME}/bin/rman <<EOF
    connect target sys/syspassword@cricprod_prim
    connect auxiliary sys/syspassword@cricprod_logstdby
    show all;
    EOF


    On Mon, Dec 12, 2011 at 12:37 PM, sundar mahadevan wrote:

    Forgot to add that i am on Oracle 11g Rel 2 EE on Suse Linux 11 x86_64.
    Thanks.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedDec 9, '11 at 9:25p
activeDec 12, '11 at 6:40p
posts11
users6
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase