CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle DBMS_DEBUG_JDWP

Version 11.1
 
General
Purpose Connect/disconnect debug using jdwp protocol
Source {ORACLE_HOME}/rdbms/admin/dbmsjdwp.sql
First Available 9.0.#

Constants
Name Data Type Value
connect_defer_suspension PLS_INTEGER 1
 connect_force_connect PLS_INTEGER 2
connect_string_environment_var PLS_INTEGER 1
connect_string_cookie PLS_INTEGER 2
Dependencies
DBMS_DEBUG_JDWP_CUSTOM

Exceptions
Error Code Reason

ORA-00022

Attempted to disconnect a session other than self

ORA-01031

User does not have the DEBUG CONNECT SESSION and DEBUG ANY PROCEDURE privileges

ORA-30677

The requested session is already being debugged

ORA-30681

Improper argument was provided for a call to CONNECT_TCP

ORA-30682

Improper value for CONNECT_TCP parameter

ORA-30683

Failed to establish a debugger connection
Security Model Execute is granted to PUBLIC
 
CONNECT_TCP

Connect the specified session to the debugger waiting at host:port

This demo performs added security checks to decide if the debug connection request is granted (for example, by verifying that the debugger is running on a trusted host)

Note: In 11gR1, and thereafter, an ACL must be created for this call to succeed (see link below)
dbms_debug_jdwp.connect_tcp(
host               IN VARCHAR2,
port               IN VARCHAR2,
session_id         IN PLS_INTEGER := NULL,
session_serial     IN PLS_INTEGER := NULL,
debug_role         IN VARCHAR2 := NULL,
debug_role_pwd     IN VARCHAR2 := NULL,
option_flags       IN PLS_INTEGER := 0,
extensions_cmd_set IN PLS_INTEGER := 128);
DECLARE
 vhost VARCHAR2(40) := 'bigdog.psoug.org';
 vport VARCHAR2(10) := '1521';
BEGIN
  IF (utl_inaddr.get_host_address(vhost) != '119.168.1.119') THEN
    RAISE_APPLICATION_ERROR(-20000, 'debug connection to this host not permitted');
  ELSE
    dbms_debug_jdwp.connect_tcp(vhost, vport);
  END IF;
  dbms_debug_jdwp.disconnect;
END;
/
 
CURRENT_SESSION_ID

Returns the current session identifier
dbms_debug_jdwp.current_session_id RETURN PLS_INTEGER;
SELECT dbms_debug_jdwp.current_session_id
FROM dual;
 
CURRENT_SESSION_SERIAL
Returns the current session serial number dbms_debug_jdwp.current_session_serial RETURN PLS_INTEGER;
SELECT dbms_debug_jdwp.current_session_serial
FROM dual;
 
DISCONNECT
A session cannot yet disconnect another session from a debugger; it
 can only connect or disconnect itself
dbms_debug_jdwp.disconnect(
session_id     IN PLS_INTEGER := NULL,
session_serial IN PLS_INTEGER := NULL);
See CONNECT_TCP Demo Above
 
GET_NLS_PARAMETER
Sets the value of the specified NLS parameter affecting the format in which NUMBER, DATE, TIME (WITH TIME ZONE) and TIMESTAMP (WITH TIME ZONE) dbms_debug_jdwp.get_nls_parameter(name IN VARCHAR2) RETURN VARCHAR2;
desc nls_session_parameters

SELECT * FROM nls_session_parameters;

SELECT
dbms_debug_jdwp.get_nls_parameter('NLS_TIMESTAMP_FORMAT')
FROM dual;

exec
dbms_debug_jdwp.set_nls_parameter('NLS_TIMESTAMP_FORMAT','DD-MON-YYYY HH.MI.SSXFF AM');

SELECT dbms_debug_jdwp.get_nls_parameter('NLS_TIMESTAMP_FORMAT')
FROM dual;
 
PROCESS_CONNECT_STRING

Undocumented
dbms_debug_jdwp.process_connect_string(
connect_string      IN VARCHAR2,
connect_string_type PLS_INTEGER);
TBD
 
SET_NLS_PARAMETER
Sets the value of the specified NLS parameter affecting the format in which NUMBER, DATE, TIME (WITH TIME ZONE) and TIMESTAMP (WITH TIME ZONE) dbms_debug_jdwp.set_nls_parameter(name IN VARCHAR2, value IN VARCHAR2);
See GET_NLS_PARAMETER Demo Above
 
Related Topics
DBMS_DEBUG_JDWP_CUSTOM
DBMS_NETWORK_ACL_ADMIN
DBMS_NETWORK_ACL_UTILITY
SYS_CONTEXT
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [63 users online]    © 2010 psoug.org