What you are looking for is a remote debug feature available in Oracle SQL Developer.
There are several prerequisites to be met:
- All packages you want to debug should be compiled for debug:
alter package SCHEMA.PACKAGE_NAME compile debug;
- The user from which schema you want to perform remote debugging should be granted with the proper privileges:
grant debug connect session to USER_NAME;
is for availability to connect to remote user's session
grant debug any procedure to USER_NAME;
is for availability to debug procedures (including those bundled in packages)
- if you use Oracle 12c, you should take into account additional ACL restrictions, take a look here and here, also note that there are some useful Oracle views like
dba_network_acl_privileges
to check your existing ACL privileges
- The remote user should be able to "give a signal" for debugger
grant execute on SYS.DBMS_DEBUG_JDWP to REMOTE_USER_NAME;
to have access to its CONNECT_TCP
procedure
If these requirements are met (or you are able to meet them), you may follow e.g. this entry in Sue Harper's blog (or this article in Oracle blog of the same author, or this one) to reach your goal. In short:
- You should locally start your debug listener on a specific port and set a breakpoint (or set the proper debugger option).
- Remote user should run
exec DBMS_DEBUG_JDWP.CONNECT_TCP( 'ip-address', port )
before running the code of interest, this may be implemented on session logon trigger.
- Debug your code remotely.
There may be some more specific on this (with Oracle it is more than real), but that is how I usually deal with it.
Also I would like to mention that PL/SQL Developer unfortunately does not support the remote debugging (uses DBMS_DEBUG
package instead of DBMS_DEBUG_JDWP
), even in the latest version. Oracle SQL Developer is written in Java, PL/SQL Developer is not, I think this is the root of the problem.