Hi all,
I am developing a proto app. I have Oracle 11gR2 standard edition 1 on Windows 8.1.
My requirement is execution of OS commands from PL/SQL. The PLSQLOSCOMMAND.zip fulfils all the requirements like ZIP file and LOB.
http://www.oracle.com/technetwork/database/enterprise-edition/calling-shell-commands-from-plsql-1-1-129519.pdf
Oracle PL/SQL executing OS Commands | SourceForge.net
1) First I run the install.sql script against my user ( STK_BIN ). This is having DBA role. No errors.
2) Logged in as SYS and run following commands :
begin
dbms_java.grant_permission( 'STK_BIN', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read,write,execute,delete' );
commit;
dbms_java.grant_permission( 'STK_BIN', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor','' );
commit;
dbms_java.grant_permission( 'STK_BIN', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor','' );
commit;
end;
3) select * from dba_java_policy shows
| GRANT | STK_BIN | SYS | java.io.FilePermission | <<ALL FILES>> | read,write,execute,delete | ENABLED | 151 |
| GRANT | STK_BIN | SYS | java.lang.RuntimePermission | readFileDescriptor | | ENABLED | 152 |
| GRANT | STK_BIN | SYS | java.lang.RuntimePermission | writeFileDescriptor | | ENABLED | 153 |
4) select * from table(file_pkg.get_file_list(file_pkg.get_file('\')));
Shows proper directory and file details
5) But when I run command,
select os_command.exec('mkdir STK_BIN_DIR') from dual;
It gives me error
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.io.IOException: Exception during creation of the process:
java.io.IOException: The handle is invalid.
ORA-06512: at "STK_BIN.OS_COMMAND", line 68
What I have done wrong. Why execution of any windows OS commands giving the error ?