Re: lsnrctl pwd in script

  • From: "Jared Still" <jkstill@xxxxxxxxx>
  • To: joe_dba@xxxxxxxxxxx
  • Date: Wed, 10 Oct 2007 11:34:33 -0700

On 10/10/07, Joe Smith <joe_dba@xxxxxxxxxxx> 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

Other related posts: