Ronnie has asked for the wisdom of the Perl Monks concerning the following question:

I got some very good help with my DBI/RMAN here document problem. It now works in part however I am not able to connect to our recovery catalog database. The rough & ready code I'm useing - purely for test purposes - is below
system("$ENV{'ORACLE_HOME'}/bin/rman <<EOF connect target / connect catalog aaaaaaaaa/bbbbbbbb@rman-live show retention policy ; show all ; EOF" ) or die "\n\tOops :: $!\n" ;
This connects to the target but fails on the catalog connect.
RMAN> connected to target database: IFSLIVE (DBID=3249276949) RMAN> RMAN-00571: ========================================================== += RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ============== += RMAN-00571: ========================================================== += RMAN-04004: error from recovery catalog database: ORA-01017: invalid u +sername/password; logon denied RMAN> using target database control file instead of recovery catalog RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default 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 OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; +# default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # d +efault CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # defaul +t 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 '/ifs/app/oracle/live/10.2.0/db +s/snapcf_IFSLIVE.f'; # default RMAN> Recovery Manager complete.
I think the problem is the @ in the connect string (the username/pass/db are all as I would use when connecting directly but I've not supplied them here for security reasons). I tried putting single quotes around this string but had the same problem. Any suggestions? I'm quite willing to believe it's something simple - like me - but can't see it!
Cheers

Replies are listed 'Best First'.
Re: Interpolation Problem?
by Corion (Patriarch) on May 07, 2009 at 12:16 UTC

    Perl has ways to show you what you're not seeing. use strict; will tell you. use warnings; will also tell you. Why don't you use them?

      If you mean #!/usr/bin/perl -w that's at the start of my test script. I only reproduced the piece of code where the error is being generated?

        Oh - by using I implied that you need to read the output the warnings generate. And/or use strict; which will likely prevent the warning from ever being generated by turning it into a fatal error.

        I normally use "use strict" but had commented it out whilst trying to get something out of the script. When I put it back in I get
        Possible unintended interpolation of @rman in string at xxrc_env_test. +pl line 51. Global symbol "@rman" requires explicit package name at xxrc_env_test. +pl line 51. Execution of xxrc_env_test.pl aborted due to compilation errors.

        The error is much as I expected the problem is I don't know how to circumvent it.
Re: Interpolation Problem?
by otto (Beadle) on May 07, 2009 at 15:10 UTC

    Not sure if what others have said has helped, but my take is that your here-me doc is wrong...

    system("$ENV{'ORACLE_HOME'}/bin/rman <<EOF connect target / connect catalog aaaaaaaaa/bbbbbbbb@rman-live show retention policy ; show all ; EOF" )

    should be

    system("$ENV{'ORACLE_HOME'}/bin/rman <<EOF connect target / connect catalog aaaaaaaaa/bbbbbbbb@rman-live show retention policy ; show all ; EOF ");

    see here-me doc search for <<EOF.

    The indent of EOF is wrong, I think

    Try running your system out to a file, via a unix cat command or equiv