PL/SQL Debugging Setup

In order to debug a PL/SQL program in an Oracle Database, you must do the following:

This section includes the following topics:

Granting Database Privileges for Debugging

Performing PL/SQL debugging requires certain database privileges. These can be easily granted through the Grant Debugging Privileges Dialog. The specific privileges are as follows:

BEGIN
  DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
    HOST => '255.255.255.25',

    LOWER_PORT => 61000,

    UPPER_PORT=> 65000,
    ACE => XS$ACE_TYPE(PRIVILEGE_LIST => XS$NAME_LIST('jdwp'),

                       PRINCIPAL_NAME => 'HR',
                       PRINCIPAL_TYPE => XS_ACL.PTYPE_DB));
END;

To revoke this privilege, execute:

BEGIN
   DBMS_NETWORK_ACL_ADMIN.REMOVE_HOST_ACE(
     HOST => '255.255.255.25',

     LOWER_PORT => 61000,

     UPPER_PORT => 65000,
     ACE => XS$ACE_TYPE(PRIVILEGE_LIST => XS$NAME_LIST('jdwp'),

                        PRINCIPAL_NAME => 'HR',
                        PRINCIPAL_TYPE => XS_ACL.PTYPE_DB));
 END;

For more information on the DBMS_NETWORK_ACL_ADMIN package, see Oracle Database PL/SQL Packages and Types Reference.

Set PL/SQL Debugging Options

A listener is started in Visual Studio for debugging session connections from the database. To ensure that the database can connect to this listener, a valid IP address and port number must be provided. Additionally, Oracle Developer Tools needs to know which Server Explorer connection contains the PL/SQL code to be debugged. All of these values should be set in the PL/SQL Compiler Settings Options Page.