Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Debugging PL/SQL from your APEX Applications with Oracle SQL Developer

1.152 Aufrufe

Veröffentlicht am

You have an Oracle APEX Application. It runs some PL/SQL. You want to debug THAT PLSQL. Here's how!

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Debugging PL/SQL from your APEX Applications with Oracle SQL Developer

  1. 1. Copyright © 2019 Oracle and/or its affiliates. All rights reserved. | Debugging PL/SQL with SQL Developer Jeff Smith Senior Principal Product Manager Jeff.d.smith@oracle.com || @thatjeffsmith Database Tools, Oracle Corp 1
  2. 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Not Just THAT SQLDev Guy… • Database Development Tools team • Product manager/story teller • I bother help people online, everywhere • Contact me for a free remote presentation for your group/company – Jeff.d.smith@oracle.com – @thatjeffsmith – https://www.thatjeffsmith.com
  3. 3. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | thatJeffSmith on • 60+ Videos • Feature demos • Tips & Tricks • Short & Long Form – SQL Developer – SQLcl – Data Modeler – ORDS
  4. 4. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
  5. 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 5 SQL Developer Snapshot Time Tested Launched in 2005 An Industry Standard 5M+ Oracle DBAs & Developers Always Improving Quarterly Releases 4
  6. 6. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Project Raptor  Early Adopter on OTN 2005 1.1  File Based PL/SQL editing  Reports  Ships with 11gR1 1.5.x  Localizations - Japanese, Spanish, Italian, German, French, Portuguese, Chinese, & Koreans  Ships with 11gR2 SQLDev v1.0  SQL Worksheet  Procedure Editor  The world takes notice! 1.5  Schema Copy/Diff/Export  Thick connections  Versioning  TimesTen 2.1  Unit Testing  Data Modeler Viewer  Unshared SQL Worksheets 2007 201020092006 3.0  Full Data Modeler  View > DBA  SQL Tuning Advisor  Query Builder 2008 2011 2012 3.1  New Database DIFF  PDF Reports  RMAN  Data Pump 2013 3.2  APEX Listener / ORDS Support  Database 12c Support  Schema Service Support 4.0  Java 7  ASH/AWR/ADDM  Color Coded Connections  Command line Interface 4.0.3  Optimized Code Insight  Oracle Big Data Appliance 2014 2015 2016 4.1  ORDS Included/Full GUI  instance Viewer  SQLcl  Copy PDB to DBaaS  Larry live demos PDB relocate @ OOW 4.2  Real Time SQL Monitoring  Top SQL Report  Formatter & Other Editor Enhancements  Easier RESTful Services Development 2017 SQLcl  New CLI  Modern SQL*Plus Release History
  7. 7. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2017 2017.2  Bug Fixes  Sharding  Data Guard 17.3 & 17.4  Bug Fixes Quarterly Releases!!! 2018 Release History 18.1  Autonomous Data Warehouse Support  New Welcome Screen/Connections  SQL Injection Detection  PL/Scope SQL Statement Support  Better Formatting 18.2 & 3  PL/SQL Injection Detection  Cloud data Loads  SQL Developer Web
  8. 8. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | What does ‘debug’ mean?  Run and watch?  dbms/owa OUTPUT?  Stare at your code until you decide to get coffee?
  9. 9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |  after  code++  observe  clean up DBMS/OWA_OUTPUT is not ‘bad’
  10. 10. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |  Coming?  Going?  Pause/Poke  Play with what-if scenarios Interactive, step-by-step experience with your code
  11. 11. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | The PL/SQL Debugger  SYS.DBMS_DEBUG_JDWP  Native SQL Developer tooling  $0.00
  12. 12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | A Tale of Two Debugging Methods  LOCAL Code/Session originates from SQL Developer  REMOTE aka EXTERNAL aka Just in Time Session kicks off and runs from your program, which then connects back down to SQL Developer for you to debug
  13. 13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |  Required PRIVS: DEBUG CONNECT SESSION & EXECUTE for PL/SQL  12c+ : Access Control Lists (Fine Grained Access)  Open Code/Object in a code editor  Compile for DEBUG  Click the big ‘Bug’ button Local Debugging
  14. 14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | What happens next  the DATABASE will CONNECT to your Machine  not CLIENT => SERVER but SERVER => CLIENT  ACL in 12c+ allows the DB to reach out on the network  if this is a bridge too far…
  15. 15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | DBMS_DEBUG (PROBE API) DatabaseDebuggerDisableJDWP=true CLIENT => SERVER
  16. 16. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |  Not officially supported  Not as feature rich  External debugging won’t work
  17. 17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  18. 18. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  19. 19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |  Set a Breakpoint! OR  Configure Preferences  Start Debugging: Step Over Some Tips
  20. 20. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Breakpoints ‘stops’ execution on a specific line OR If a condition is met
  21. 21. 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
  22. 22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Where do we go? Where do we go now? Where do we go? Oh, oh Where do we go? (Where do we go now?) Mind the Call Stack
  23. 23. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Remote/External Debugging – cue APEX!  APEX runs, calls PL/SQL  hits breakpoint  SQLDev takes over  do debugging  control back to APEX
  24. 24. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Listen for Debug Requests SQL Developer Client Machine IP Make sure SQL Dev is listening when APEX rings the door bell
  25. 25. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Setup Debugger in your Application execute DBMS_DEBUG_JDWP.CONNECT_TCP(‘sqldev-IP’, port);
  26. 26. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Remember to set a breakpoint! Executable lines of code
  27. 27. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Run your APEX App  Session trips breakpoint APEX will ‘hang’  SQL Developer will ‘blink’ to life  Start debugging!
  28. 28. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Debug!

×