Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

running lsnr commands in DCL com file

 
SOLVED
Go to solution
SAMI AHMAD
Regular Advisor

running lsnr commands in DCL com file

the following works in unix how can I do this in vms ?


lsnrctl < EOF
set current_listener listener_name
set password encrypted_password
stop
exit
EOF
5 REPLIES 5
Steven Schweda
Honored Contributor
Solution

Re: running lsnr commands in DCL com file

Details differ, but, assuming that the Oracle
command works the same way, I'd expect
something like this to work:

$ lsnrctl
set current_listener listener_name
set password encrypted_password
stop
exit


Lines without "$" are normally read as input
to the program. See also, "HELP DECK".
John Gillings
Honored Contributor

Re: running lsnr commands in DCL com file

SAMI,

I'm not sure if Oracle define lsnrctl as a DCL command or foreign command. I'm assuming you can just type "lsnrctl" interactively and get a prompt. If not, you need to work that part out (maybe ask Oracle?)

If "listener_name" and "encrypted password" are literal text, then this should work:

$ lsnrctl
$ DECK
set current_listener listener_name
set password encrypted_password
stop
exit
$ EOD
$ EXIT

This also assumes that lsnrctl reads input from SYS$INPUT. It's possible (but hopefully unlikely!) that it reads directly from SYS$COMMAND, in which case you'd need to redirect input prior to running the command. Ask Oracle if the above doesn't work.

If "listener_name" and "encrypted password" are intended to be variables, you need to get a bit more creative:

$ listener_name="mylistener"
$ encrypted_password="secret"
$ wo="WRITE SYS$OUTPUT"
$ PIPE (-
wo "set current listener ",listener_name ;-
wo "set password ",encrypted_password ;-
wo "stop" ;-
wo "exit") | -
(define/user sys$input sys$pipe ;
lsnrctl)
$ EXIT



A crucible of informative mistakes
Hein van den Heuvel
Honored Contributor

Re: running lsnr commands in DCL com file


Well,

Typically all you need for OpenVMS is
a 'command' file which would look something like:

$LSNRCTL
command 1
command 2
$EXIT

HOWEVER... (For Oracle 10.2) On OpenVMS 'lsnrctl' is an alias.
$SHOW SYMBOL lnsrctl !--->
LSNRCTL == "@ora_root:[bin]lsnrctl"

This foils the normal SYS$INPUT redirection.
Now if you look into ora_root:[bin]lsnrctl.COM,
then you'll see it actually runs: ORA_ROOT:[bin]LSNRCTL.EXE

So a script has too look like, for example:

$RUN ORA_ROOT:[bin]LSNRCTL.EXE
status
exit
$EXIT


Now if you need variables, then it becomes much more fun.
You'll need something like:

$listener_name = "test"
$OPEN/WRITE tmp lsnrctl.TMP
$WRITE tmp "status ", listener_name
$WRITE tmp "exit"
$CLOSE tmp
$DEFINE/USER SYS$INPUT lsnrctl.TMP
$RUN ORA_ROOT:[bin]LSNRCTL.EXE
$DELETE lsnrctl.TMP.

Enjoy!

Hein van den Heuvel ( at gmail dot com )
HvdH Performance Consulting



Richard W Hunt
Valued Contributor

Re: running lsnr commands in DCL com file

Depending on the ORACLE version you are running, you might need to remember to run this as an ORACLE batch job, not as SYSTEM. On our versions of OpenVMS-based ORACLE, if you try to do an ORACLE command as SYSTEM, you never get far enough to care because the ORAUSER stops you.

The LSNRCTL commands are instantiated as DCL foreign commands after you run @ORAUSER
and that of course only works after you have run @INSORACLE (as ORACLE) from the appropriate [ORACLE.?] folder. Where the ? depends on your version number.

I do the LSNRCTRL commands as DCL foreign verbs all of the time in batch jobs that manage my startup. So I know it is possible.
Sr. Systems Janitor
Robert Gezelter
Honored Contributor

Re: running lsnr commands in DCL com file

Sami,

I concur. I have done this many times at various client sites.

However, the question of which version of Oracle is being used AND how the local environment is set up does make a difference. The comment about ORAUSER setting the context is appropriate and correct.

- Bob Gezelter, http://www.rlgsc.com