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: Mercadante, Thomas F (LABOR) <Thomas.Mercadante_at_labor.state.ny.us>
Date: Thu, 11 Oct 2007 08:04:28 -0400
Message-ID: <ABB9D76E187C5146AB5683F5A07336FFE09042@EXCNYSM0A1AJ.nysemail.nyenet>


Another way of doing this without using Perl is as follows:

Echo all of the lsnrctl commands to a temporary file. You can then feed that file to lsnrctl like this:

Echo "status" > lsnr.cmd
Echo "exit" >> lsnr.cmd
Lsnrctl < lsnr.cmd

Tom

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Radoulov, Dimitre Sent: Thursday, October 11, 2007 6:11 AM To: oracle-l_at_freelists.org
Subject: Re: lsnrctl pwd in script

} Has anybody scripted out changing the LISTENER password and got it to work?

If you have zsh
(you should add error checking and turn parameters to variables, this is only an example):

xubuntu% cat chpasslsnr
#!/usr/local/bin/zsh
result=""
zmodload zsh/zpty
zpty lsnr lsnrctl

zpty -r lsnr line "*>";print "$line";zpty -w lsnr "set cur"
zpty -r lsnr line "*>";print "$line";zpty -w lsnr "set password"
zpty -r lsnr line "*assword:" ;print "$line";zpty -w lsnr "oracle"
zpty -r lsnr line "*>";print "$line";zpty -w lsnr "change_password"
zpty -r lsnr line "*ld password:";print "$line"; zpty -w lsnr "oracle"
zpty -r lsnr line "*ew password:";print "$line"; zpty -w lsnr "elcaro"
zpty -r lsnr line "*eenter new password:";print "$line"; zpty -w lsnr

"elcaro"

zpty -r lsnr line "*successfully";print "$line"; zpty -w lsnr
"save_config"

zpty -r lsnr line "*successfully";print "$line"; zpty -w lsnr "exit"

xubuntu% ./chpasslsnr

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 11-OCT-2007 12:03:55

Copyright (c) 1991, 2007, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL>
 Current Listener is LISTENER
LSNRCTL>
 Password:  

The command completed successfully
LSNRCTL>
 Old password:  

New password:  

Reenter new password:  

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) Password changed for LISTENER
The command completed successfully

LSNRCTL> Connecting to
LSNRCTL> (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) Saved LISTENER configuration parameters. Listener Parameter File
/u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora Old Parameter File
/u01/app/oracle/product/11.1.0/db_1/network/admin/listener.bak The command completed successfully

Dimitre

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




--
http://www.freelists.org/webpage/oracle-l
Received on Thu Oct 11 2007 - 07:04:28 CDT

Original text of this message

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