Upload
jeff-smith
View
858
Download
13
Embed Size (px)
Citation preview
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
Oracle SQL DeveloperPL/SQL Debugging
Jeff [email protected] || @thatjeffsmithSenior Principal Product ManagerDatabase Development Tools Group
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Gentle Introduction to Debugging
Worksheet vs Procedure Editor
Debug Demo
How it works – boring architectural stuff
Advanced Debugger ‘Tricks’
Today’s Mission: Debugging PL/SQL < 5 Minutes
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
FREE Oracle Database IDE/GUI Windows, OS X, *NIX More than 4,000,000 users worldwide My Oracle Support available via your DB license
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Project Raptor 2005 ~ Oracle SQL Developer v1.0 2006 1.5 2008 2.1 2009 3.0 2011 3.1, 3.2 2012 4.0 2013 4.0.3 2014
4.1 May 2015
Release History
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Run program, see what happens Add a bunch of DBMS_OUTPUT code Use your IDE to ‘step’ interactively through the PL/SQL program(s)
What do we mean by ‘Debug?’
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
After the fact Extra Coding Not interactive Don’t forget to remove before Production
DBMS_OUTPUT is Better than Nothing
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Confirm required PRIVS (DEBUG CONNECT SESSION) If 12c, configure Access Control (Fine Grained Access) Open Code – in the Procedure Editor Compile for DEBUG
Click the big ‘Bug’ button
How to Launch a Debug Session
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Set a Breakpoint! OR Configure Preferences
Start Debugging: Step Over
Some Tips
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Breakpoints
‘Pauses’ execution on a specific line
OR
If a condition is met
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Step Over vs Step Into
Step Over – Executes line 51, goes to line 54 Step Into – Opens program at line 51 for debugging
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
See whereyou’ve beenand whereyou’re going
Mind the Call Stack
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Remote/External Debugging
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Listen for Debug Requests
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
execute DBMS_DEBUG_JDWP.CONNECT_TCP('127.0.0.1',4000);
create or replaceFUNCTION GET_EMP_NAME( ID IN NUMBER ) RETURN VARCHAR2 ASname varchar2(100);BEGIN select first_name||' '||last_name into name from employees where employee_id = ID; RETURN name;END GET_EMP_NAME;
Setup Debugger in your Application (hard way)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Just set an ENV VARIABLE!
ORA_DEBUG_JDWP=host=mypc;port= 1234
Enable Application for debugging (the EASY way)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Advantages overSQL Worksheet:
Package body, jumpto Spec and vice versa ‘Breadcrumbs’ Highlighted compilererrors and warnings bydefault
Procedure Editor – a PL/SQL aware IDE
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SQL Developer Resources
• SQL Developer on OTN– www.oracle.com/sqldeveloper
• Feature Exchange– sqldeveloper.oracle.com
• Forums– https://forums.oracle.com/forums/forum.jspa?forumID=260
• Oracle Learning Library– www.oracle.com/oll