Thursday, February 20, 2014

ORA-24247 error with SQL Developer on Oracle 12c

The PLSQL Debugger in SQL Developer works fine with Oracle version prior to 12c. These are the things we need in place to start debugging PL/SQL

              1.       A grant of DEBUG CONNECT SESSION privilege
              2.       A execute privilege on DBMS_DEBUG_JDWP.
              3.       Execute privilege on the procedure to debug.                                                         (make sure the procedure is Compiled for Debug )

But, even if you have these privileges in Oracle 12c, you will end up with this error message.

Connecting to the database RAJESH_12c.
Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP('10.191.59.133', '50504')
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: at line 1
Process exited.
Disconnecting from the database RAJESH_12c.

Starting with Oracle 12c, if you want to debug PL/SQL stored procedures in the database through a Java Debug Wire Protocol (JDWP)-based debugger, such as SQL Developer or JDeveloper, then you must be granted the jdwp ACL privilege to connect your database session to the debugger at a particular host.

The one way you can configure network access for JDWP operations:

sys@PDB1> begin
  2  dbms_network_acl_admin.append_host_ace
  3  (host=>'PC143855',
  4   ace=> sys.xs$ace_type(privilege_list=>sys.XS$NAME_LIST('JDWP') ,
  5                         principal_name=>'rajesh',
  6                         principal_type=>sys.XS_ACL.PTYPE_DB) );
  7  end;
  8  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.53
sys@PDB1>

Once done the error goes away

Connecting to the database RAJESH_12c.
Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( 'PC143855', '59255' )
Debugger accepted connection from database on port 59255.
Executing PL/SQL: CALL DBMS_DEBUG_JDWP.DISCONNECT()
Hello World
Process exited.
Disconnecting from the database RAJESH_12c.
Debugger disconnected from database.

6 comments:

  1. Thanks! Nice explanation and good to see it doesn't depend on all the deprecated portions of dbms_network_acl_admin that other solutions I have found use.

    Jack

    ReplyDelete
  2. Useful post!
    Thank you!

    ReplyDelete
  3. Hi ,

    We tried above steps but we are getting same issues.Could you please anyone help on this issues.


    Thanks,
    S.Pathmanaban

    ReplyDelete
    Replies
    1. Please check out my discussion with AskTom team then, The above solution worked in 12.1.0.1 but not with 12.1.0.2.
      How ever you could go with the workaround provided by AskTom team, for now.

      https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9528615800346614204

      Delete
  4. http://nhatkha.blogspot.com/2017/07/debugging-procedure-using-sql-developer.html

    ReplyDelete