when i am stopping the listener, getting following error message...
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 01-JUN-2012 12:21:31 Copyright (c) 1991, 2007, Oracle. All rights reserved. NL-00857: wrong number (0 - 1 needed) of arguments to "stop"
I am using following command to stop the listener..
$ORACLE_HOME/bin/lsnrctl stop LISTENER
when i execute the command through command prompt then it works but through java it fails.
Please help me to resolve this problem....
I think your java cmdStr is not correct; you can't just put a space between commands (setting the env variable then calling lsnrctl). You need to use a semicolon:
String cmdStr="env ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1;/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl stop LISTENER";
env
is a bash command, so you can't exec it from java. You can either make that into a short shell script and exec that from java or you can do the following
String cmd = "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl stop LISTENER";
String[] envp = "ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1";
Process proc = Runtime.getRuntime().exec(cmd, envp);
if (proc.waitFor() != 0) {
throw new RuntimeException("exit value was nonzero");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.