0

I wanted to execute OS commands from Oracle, so I found this script (https://github.com/bunk3r/ora-exec-cmd/blob/master/ora_exec_cmd.pl) to execute via Java.

It worked, but on the middle of an execution it failed and doesn't work anymore. Now it get "paused" after setting java privs. I tried to delete the java class, function, procedure but it fails.

Using the same account that I used to run the script I'm able to revoke Java privs.

SQL> BEGIN
    dbms_java.revoke_Permission('JUAN-SYS', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    dbms_java.revoke_Permission('JUAN-SYS', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    dbms_java.revoke_Permission('JUAN-SYS', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    END;
  6  /

PL/SQL procedure successfully completed.

But trying to delete the procedure, java source, etc fails.

SQL> DROP JAVA SOURCE "Util";
* ERROR at line 1: ORA-04043: object Util does not exist


SQL> DROP FUNCTION "run_cmd";
* ERROR at line 1: ORA-04043: object run_cmd does not exist


SQL> DROP PROCEDURE "rc";
* ERROR at line 1: ORA-04043: object rc does not exist

What am I doing wrong? I would like to remove everything that this script did.

Thanks

J. Fox
  • 31
  • 1
  • 1
  • 3
  • That looks right to me. Maybe it got dropped already? Check out this question and run the query to see if anything shows up. https://stackoverflow.com/questions/657803/where-are-java-classes-stored-in-oracle – kfinity Feb 02 '18 at 20:48
  • You could also try this to see if it's under a different user. `select * from all_objects where object_name = 'Util';` – kfinity Feb 02 '18 at 20:49
  • Maybe the name is `Util` and not `"Util"`? – miracle173 Feb 02 '18 at 22:27
  • 1
    Joy of naming Oracle objects using mixed case with double quotes. Try to identify them by `select * from all_objects where UPPER(object_name) = 'UTIL';` (i.e. convert both to uppercase). The result will be its actual name - then you should be able to drop it; if it is all uppercase - fine, you don't need any quotes. If it is anything else, enclose its name into double quotes, but following letter case EXACTLY as the previous SELECT returned it. – Littlefoot Feb 03 '18 at 12:25

0 Answers0