Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: lsnrctl pwd in script

Re: lsnrctl pwd in script

From: Jared Still <jkstill_at_gmail.com>
Date: Wed, 10 Oct 2007 11:34:33 -0700
Message-ID: <bf46380710101134h1daac5dj1d7f3321842664aa@mail.gmail.com>


On 10/10/07, Joe Smith <joe_dba_at_hotmail.com> wrote:
>
> Has anybody scripted out changing the LISTENER password and got it to
> work?
>
> I have tried a number of ways and still get errors. I can do it by hand.
> So, I know it works.
>
> ${ORACLE_HOME}/bin/lsnrctl <<EOF
> set current_listener LISTENER
> start
> change_password
> ${PASSWORD}
> ${PASSWORD}
> ${PASSWORD}
> save_config
> EOF
>
>

That will not work from a shell script.

The EOF operator allows the shell to take input from the script (a 'here' document)
but does not allow passing data to an interactive command, which is what the change_password command is.

The EOF redirects STDIN from the script, but the change_password command does
not read STDIN, it reads from a terminal. (unix experts feel free to clarify or correct
this. This means you Tim G. :)

There are packages designed to mimic interactive input to make this kind of thing possible.
Expect was originally written in TCL. There is also a Perl version, an example of which is
provided as a text attachment.

I just tested this on an 8i listener, worked fine.

The script requires Perl (of course) and the Expect.pm module.

-- 
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist



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

  • application/octet-stream attachment: clp.pl
Received on Wed Oct 10 2007 - 13:34:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US