Debug PL/SQL with SQL Developer
Lewis Cunningham Data Architect, FIS http://it.toolbox.com/blogs/oracle-guide http://databasewisdom.com/
Virtathon 2011 7/17/2011
Introduction
Oracle ACE Director Author Data Architect for FIS Global Twitter: @theRealLewisC Blogger
An Expert's Guide to Oracle Technology
http://it.toolbox.com/blogs/oracle-guide
The Database Geek
http://databasegeek.com
Cloud Computing Info
http://clouddb.info
My Books
Agenda
What SQL Developer offers Setup for debugging Compiling Running Breakpoints, data, watches Remote Debugging
Debugging
Source Level Debugger
Step through code Set break and watch points Smart Data Watch Expressions
Local and Remote Debugging
Setup
Need to grant permissions
DEBUG ANY PROCEDURE DEBUG CONNECT SESSION Must be DBA to do the grants GRANT DEBUG ANY PROCEDURE to HR; GRANT DEBUG CONNECT SESSION to HR;
Compile
Compile code for debug
Run Procedure
Debug Dialog
Debug Log
Set a Break Point
Rerun
It remembers the previous run changes
Breakpoint halts execution
View Breakpoints
View or add breakpoints
Right-click for preferences Conditional breakpoints
Smart Data
View changing data
Right-click for preferences Double click item to change
Data
View all data
Right-click for preferences Double click item to change
Watches
View or add watches
Right-click for preferences
Stack
Stepping
Remote Debugging
Remote debugging means debugging a different session
That session can be on any server or client
You need to know the user name running
You need to attach the client to the server via a debugger listener
Start Remote Debugger
Debugger Listener
Attach Client to Debugger
Need to connect client to debugger
Can be run from a stored procedure
EXEC DBMS_DEBUG_JDWP.CONNECT_TCP( 'localhost', '4000');
Attach Client to Debugger
SQL Dev Accepts connection
Remote Procedure Runs
SQL Dev Ready to Debug
Debug PL/SQL with SQL Developer
Lewis Cunningham Data Architect, FIS http://it.toolbox.com/blogs/oracle-guide http://databasewisdom.com/
Virtathon 2011 7/17/2011