debug with pl/sql

28
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

Upload: lewis-cunningham

Post on 28-Apr-2015

80 views

Category:

Documents


4 download

DESCRIPTION

Virtathon 2011

TRANSCRIPT

Page 1: Debug With PL/SQL

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

Page 2: Debug With PL/SQL

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

Page 3: Debug With PL/SQL

My Books

Page 4: Debug With PL/SQL

Agenda

• What SQL Developer offers

• Setup for debugging

• Compiling

• Running

• Breakpoints, data, watches

• Remote Debugging

Page 5: Debug With PL/SQL

Debugging

• Source Level Debugger

– Step through code

– Set break and watch points

– Smart Data

– Watch Expressions

• Local and Remote Debugging

Page 6: Debug With PL/SQL

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;

Page 7: Debug With PL/SQL

Compile

• Compile code for debug

Page 8: Debug With PL/SQL

Run Procedure

Page 9: Debug With PL/SQL

Debug Dialog

Page 10: Debug With PL/SQL

Debug Log

Page 11: Debug With PL/SQL

Set a Break Point

Page 12: Debug With PL/SQL

Rerun

It remembers the previous run changes

Page 13: Debug With PL/SQL

Breakpoint halts execution

Page 14: Debug With PL/SQL

View Breakpoints

View or add breakpoints

Right-click for preferences

Conditional breakpoints

Page 15: Debug With PL/SQL

Smart Data

View changing data

Right-click for preferences

Double click item to change

Page 16: Debug With PL/SQL

Data

View all data

Right-click for preferences

Double click item to change

Page 17: Debug With PL/SQL

Watches

View or add watches

Right-click for preferences

Page 18: Debug With PL/SQL

Stack

Page 19: Debug With PL/SQL

Stepping

Page 20: Debug With PL/SQL

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

Page 21: Debug With PL/SQL

Start Remote Debugger

Page 22: Debug With PL/SQL

Debugger Listener

Page 23: Debug With PL/SQL

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');

Page 24: Debug With PL/SQL

Attach Client to Debugger

Page 25: Debug With PL/SQL

SQL Dev Accepts connection

Page 26: Debug With PL/SQL

Remote Procedure Runs

Page 27: Debug With PL/SQL

SQL Dev Ready to Debug

Page 28: Debug With PL/SQL

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