NAME
Oracle::Debug - A Perl (perldb-like) interface to the Oracle DBMS_DEBUG package for debugging PL/SQL programs.
SYNOPSIS
./oradb
ABSTRACT
A perl-debugger-like interface to the Oracle DBMS_DEBUG package for debugging PL/SQL programs.
The initial impetus for creating this was to get a command-line interface, similar in instruction set and feel to the perl debugger. For this reason, it may be beneficial for a user of this module, or at least the intended oradb interface, to be familiar with the perl debugger first.
DESCRIPTION
There are really 2 parts to this exersize:
- DB
-
The current Oracle chunk is a package which can be used directly to debug PL/SQL without involving perl at all, but which has similar commands to the perl debugger.
- oradb
-
The Perl chunk implements a perl-debugger-like interface to the Oracle debugger itself, through the DB library above.
In both cases much more conveniently from the command line, than the vanilla Oracle packages themselves. In fairness DBMS_DEBUG is probably designed to be used from a GUI of some sort, but this module focuses on it from a command line usage.
NOTES
Ignore any methods which are prefixed with an underscore (_)
We use a special table rjsf_oracle_debug for our own purposes.
Set Oracle_Debug=1 for debugging information.
METHODS
- new
-
Create a new Oracle::Debug object
my $o_debug = Oracle::Debug->new(\%dbconnectdata);
- _prime
-
Prime the object and connect to the db
Also ensure we are able to talk to Probe
$o_debug->_prime;
- dbh
-
Return the database handle
my $dbh = $o_debug->dbh;
- _connect
-
Connect to the database
- getarow
-
Get a row
my ($res) = $o_debug->getarow($sql);
- help
-
Print the help listings
$o_oradb->help;
- parse
-
Parse the input command to the appropriate method
$o_oradb->parse($cmd, $input);
- do
-
Wrapper for oradb->dbh->do() - internally we still use prepare and execute.
$o_oradb->do($sql);
- recompile
-
Recompile this procedure|function|package for debugging
my $i_res = $oradb->recompile('PROCEDURE x');
- target
-
Run the target session
$o_oradb->target;
- start_target
-
Get the target session id(given) and stick it in our table (by process_id)
my $dbid = $oradb->start_target($dbid);
$x_res = $self->do('COMMIT');
- debugger
-
Run the debugger
$o_debug->debugger;
- start_debug
-
Start the debugger session
my $i_res = $oradb->start_debug($db_session_id, $pid);
- sync
-
Blocks debug session until we exec in target session
my $i_res = $oradb->sync;
- exec
-
Runs the given statement against the target session
my $i_res = $oradb->exec($call);
- execute
-
Runs the given statement against the target session
my $i_res = $oradb->execute($xsql);
- break
-
Set a breakpoint
my $i_res = $oradb->break("PROCNAME $i_line");
- continue
-
Continue execution until given breakpoints
my $i_res = $oradb->continue;
- next
-
Step over the next line
my $i_res = $oradb->next;
- step
-
Step into the next statement
my $i_res = $oradb->step;
- return
-
Return from the current scope
my $i_res = $oradb->return;
- runtime
-
Print runtime_info via dbms_output
$oradb->runtime;
- backtrace
-
Print backtrace from runtime info via dbms_output
$oradb->backtrace();
- list_source
-
Print source
$oradb->list_source();
- list_breakpoints
-
Print breakpoint info
$oradb->list_breakpoints;
- self_check
-
Check the connections (fails otherwise)
my $i_ok = $oradb->self_check();
- probe_version
-
Log the Probe version
print $oradb->probe_version;
- ping
-
Ping the target process (gives an ORA-error if no target)
my $i_ok = $oradb->ping; # 9.2
- is_running
-
Check the target is still running - ???
my $i_ok = $oradb->is_running; # 9.2
- plsql_errstr
-
Get PL/SQL error string
$o_debug->plsql_errstr;
- put_msg
-
Put debug message info
$o_debug->put_msg($msg);
- get_msg
-
Get debug message info
print $o_debug->get_msg;
- get_val
-
Get the value of a variable
my $val = $o_debug->get_val($varname);
- audit
-
Get auditing info
my ($audsid) = $o_debug->audit;
- log
-
Log handler (currently just prints to STDOUT)
$o_debug->log("this");
- quit
-
Quit the debugger
$o_oradb->quit;
- error
-
Error handler
- fatal
-
Fatal error handler
- detach
-
Tell the target session to detach itself
$o_debug->detach;
SEE ALSO
DBD::Oracle
perldebug
perldebugtut
AUTHOR
Richard Foley, <Oracle_Debug@rfi.net>
COPYRIGHT AND LICENSE
Copyright 2003 by Richard Foley
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 395:
=pod directives shouldn't be over one line long! Ignoring all 7 lines of content
- Around line 485:
=pod directives shouldn't be over one line long! Ignoring all 3 lines of content
- Around line 801:
=pod directives shouldn't be over one line long! Ignoring all 10 lines of content