Toad Tips & Tricks Tips for Maximizing Toad Productivity Collaborate 2009 Orlando, FL May 3rd 2008 Quest Software, Inc. ALL RIGHTS RESERVED.
Agenda This is an All-Day Live-Demo with accompanying slides No Paper, just Demo & PowerPoint slides (lots of them!!!) Hopefully enough slides for notes and as topic bookmarks Not trying to sell you the product, you should already have Toad to derive real benefit & value from this presentation Goals Everyone, regardless of job title or Toad experience, will say: I did not know Toad could do that (too) I m walking away with 4-6 very useful tips Time well spent only wish it had been longer
Bert Scalzo Database Expert & Product Architect for Quest Software Oracle Background: Worked with Oracle databases for over two decades (starting with version 4) Work history includes time at both Oracle Education and Oracle Consulting Academic Background: Several Oracle Masters certifications BS, MS and PhD in Computer Science MBA (general business) Several insurance industry designations Key Interests: Data Modeling Database Benchmarking Database Tuning & Optimization "Star Schema" Data Warehouses Oracle on Linux and specifically: RAC on Linux Articles for: Oracle s Technology Network (OTN) Oracle Magazine, Oracle Informant PC Week (eweek) Articles for: Dell Power Solutions Magazine The Linux Journal www.linux.com www.orafaq.com 3
Books by Bert Coming in 2009 Out Now 2nd Edition Coming Soon 4
Couple of Questions (for both our benefit) How many people using Toad 9.7.2.5 Toad 9.6.1.0 Oracle 10g Oracle 11g Current on Toad Maintenance Contract Toad Free Information & Collaboration www.toadworld.com www.asktoad.com Toad Yahoo Discussion Groups
Couple of Cool Facts (for your benefit) Toad 9.6 made the PL/SQL Debugger part of Standard Toad version, thus no longer requires purchasing Toad Professional just for debugger Toad 9.7 gives you a free copy (for the same user) of our new Toad for Data Analysis the multi-database version of Toad aimed more at people who work with the data, and who often try to use lesser database access, tools like MS Excel and MS Access There is still a Toad freeware (www.toadsoft.com) and we re planning a significant update to it in 2009
Let s Get Started Will use Toad 9.7.2.5 (latest & greatest GA version) Will try to focus on three different user personas Oracle SQL and/or PL/SQL Developer Oracle Database Administrator (DBA) Business Analyst (less technical business user) Will show lots of feature breadth for 3 personas Will show some feature depth for 3 personas Will make sure to say what comes with what bundle
High Level Table of Contents Part 01: Some Toad Basics Part 02: Look & Feel & Behavior Part 03: Connecting to Database Part 04: Browsing DB s, Objects & Data Part 05: Master Detail Browser Part 06: Graphical Query Builder Part 07: Editing & Running SQL Part 08: Fast Reports (Report Builder) Part 09: Code Xpert and SQL Xpert Part 10: Debugging SQL & PL/SQL Part 11: Project Manager Part 12: App Designer
PART 01: Some Toad Basics
Which Toad Bundle Do I Have?
Toad for Oracle 9.7 Developer Bundles Toad for Oracle The development tool of choice for database professionals world wide. The essential tool for efficient and accurate Oracle DB development, including debugging. New for Toad for Oracle 9.7: Querying and reporting tool (Toad for Data Analysis) included in Toad installer Link to Getting Started videos Support for Subversion VCS Toad for Oracle Professional Built with a focus on building code with for quality and maintainability Includes all functionality in the Toad for Oracle base edition, plus: Code Xpert Export File Browser New for Toad for Oracle 9.7: Data generator for creating multiple rows of data for one or more Oracle tables for testing Top 20 rules list for performing a quick code quality check Toad for Oracle Xpert Designed for developers with SQL tuning responsibilities that focus on database performance Includes functionality in Toad for Oracle Professional, plus Quest SQL Optimizer for Oracle: Automated SQL optimization SQL scanning Virtual index generation New for Toad for Oracle 9.7 SQL Optimizer 7.4 Better organization and usability in Batch Optimizer New options in tuning lab Summary report for analyzed SQL in SQL Scanner Toad Development Suite for Oracle Enables Database Development Best Practices and ensures that the best possible code is deployed to production. Integrated suite of three tools: Toad for Oracle Xpert Quest Code Tester for Oracle Benchmark Factory for Databases Oracle Edition New for Toad for Oracle 9.7: Greater workflow integration with Benchmark Factory for Databases allowing trace files to be pushed to Benchmark Factory from Toad to initiate a workload replay test
Toad for Oracle 9.7 DBA Bundles Toad for Oracle DB Admin Module (formerly DBA Module) Maintain database health and stability and ensure the best possible performance, while minimizing the impact of changes on the database environment. New for Toad for Oracle 9.7: Database Browser enhancements StatsPack and AWR advisories Schema compare and synch enhancements Trace File Browser RMAN Script templates Toad DBA Suite for Oracle Simplify common database administration tasks and become more proactive in solving database-related performance issues before end users are impacted. The suite includes: Toad for Oracle Xpert, with DB Admin Module Spotlight on Oracle Standard Edition Toad Data Modeler Benchmark Factory for Databases Oracle Edition New for Toad for Oracle 9.7: Tighter workflow integration with Benchmark Factory for Databases allowing trace files to be pushed to Benchmark Factory from Toad to initiate a workload replay test The DB Admin Module must be purchased with or added onto another edition of Toad for Oracle.
Which Toad Version Do I Have?
Toad vs. Oracle Product Release History Oracle 8i Oct 98 8.1.7.4 Oracle 9i R2 Oracle 9i Jun 99 Feb 00 Dec 00 Apr 01 v5 v6.1 v6.3 v6.5 Quest Buys 70+ screens PL/SQL Debugger, SQL Modeler v7.0 Dec 01 v7.2 Apr 02 v7.3 V8.0 XML Support, Code Xpert, Script Debugger, Rebranded: Toad for Oracle Summary: Jun 05 v8.5 Oct 02 May 03 Nov 03 v7.4 v7.5 v7.6 Team Coding, Session DBA Toad Script Mgr, HTML Schema Project Module Reports SQL*Loader Doc Generator, Manager, Adv data types Brower, Wizard Command Line QSR Script in data grids New Support Runner Toolbars Oracle 10g R2 9.2.0.8 Jul 04 Oracle 10g Oct 05 v8.6 Oct 06 Oracle 11g Jun 07 v9.0 Apr 08 v9.5 11.0.1.7 Sep 08 v9.6 v9.7 Stats Pack JIT (external) Query Builder, Single Merged Policy Mgr, Debugger App Designer, Browser, Debugging, Tabbed Editor, Action Recall, New Toad to Standard, Trace File 11g Support, Citrix support, Fast Reports, New & Improved Toad Tips, Browser, PL/SQL Profiler, HC Vulnerability RAC support, Master-Detail Code Xpert, Vista Support Code Xpert Assessment, New Formatter, Enhanced Oracle OEM s Browser Improved DB RMAN support, Batch Mode, 10g support ASM/ADDM/AWR Browser Toad for Data SQL Opt 7.2 Mgrs and Reports TDM Integration Analysis Integration Oracle 9i >= Toad 9.0 Oracle 10g >= Toad 9.6 v9.1 Nov 07 10.2.0.4 Oracle 11g >= Toad 9.7
How Do I Upgrade my Toad Version? You must be current on Toad maintenance contract Then simply login and download from Quest Support http://support.quest.com You cannot: Upgrade commercial using trial from web site Upgrade commercial using trial from show DVD What if I let my maintenance lapse? What can I do? Contact sales ask for options (all depends )
Toad Requires Oracle Client
Toad Has a REGEDIT like Oracle Homes Tool
Only One Client Version Active Per Toad Session
Oracle Client / Server Interoperability Support (See Metalink Document 207303.1) Toad may work with older client talking to newer databases but there might be data type issues
Toad Seems Slow or Slower Than Before? Speed Up Toad - Updated http://www.toadworld.com/community/blogs/tabid/67/entryid/274/default.aspx Speed Up Toad http://www.toadworld.com/community/blogs/tabid/67/entryid/162/default.aspx Toad Sometimes Slow on Oracle 10g http://www.toadworld.com/community/blogs/tabid/67/entryid/135/default.aspx
1. Toad Advisor 2. Gather Data Dictionary statistics (DBA needs to do this)
What s new in my current Toad version? http://www.toadworld.com http://www.asktoad.com http://www.toadsoft.com http://toadsoft.com/get2know97/web/index.html Adobe Acrobat Document
http://toadsoft.com/get2know97/web/index.html
Toad Crashed How do I troubleshoot? http://support.quest.com Your Toad Options settings
Toad (like Keebler Cookies) has Elves!!! When Toad screen or utility crashes, the Delphi code traps the error and pops-up the special Elf error dialog screen This is critical do not just say OK and close the screen Choose click here to see more info
Toad.ini file + Support Bundle file + Toad.elf file = much better chance finding bug or user error
PART 02: Look & Feel & Behavior
I don t like Toad s Menus and Toolbars! Just like Microsoft Office, simply choose menu or toolbar and choose customize
Drag-and-Drop: Existing toolbar icons and/or menu items around (reorganize) Existing toolbar icons and/or menu items to Customize Window (remove) Customize Window toolbar text/icons to toolbar and/or menu location (add)
Toad does not work the way I want! Always check Toad Options Can Toad do this Can Toad work this way Can Toad look like this How do I customize Toad
Ten Years of Options and Growing
Toad.Ini File
What is Toad Doing? How does it do that? Built-In Method Stand-Alone EXE SQLMonitor.exe
Output & Sliders
Desktops (nice way to persist your likes)
PART 03: Connecting to Database
Delete Entries: DEL key or remove
tnsnames.ora ---Nothing--- OID or MS AD
Hard to see on printed slides, but adds a color border around the entire window too
tnsnames.ora file will by default be located under your Oracle client home network admin directory
PART 04: Browsing DB s, Objects & Data
Database Browser
Subset of Schema Browser for those objects not owned by a schema (i.e. public owner or simply just no owner)
Schema Browser
Of the more often used screens, Toad Schema Browser is probably the most user configurable
Refresh current or focused RHS details Refresh current or focused LHS object Left Hand Side (LHS) Right Hand Side (RHS) Refresh all LHS objects
In Tree-View mode, Toad basically looks and feels just like other tools, such as: SQL Navigator PL/SQL Developer SQL Developer
Now I have a Schema Browser that fits my specific job needs, with no excess stuff displayed and no over crowding! But not quite done just yet
Now Schema Browser is just right
Common object operations on the LHS toolbar, and all object operations available via righthand-mouse menu Did you notice that the Funnel icon is red instead of grey? What does that mean? Always notice Funnel color!
There s also the Quick Filter Accepts standard wildcards (*) Accepts database wildcards (%)
Schema Browser navigation history
Instantly jumps from EMPLOYEE table to the EMPLOYEE_PK index (i.e. it automatically changes the focus or navigates to Indexes tab with the specific index in focus or preselected)
To delete all saved schema browser layout settings
Cut & Paste
What if table to import into does not yet exist?
PART 05: Master Detail Browser
Master-Detail Navigator
What if table has no FK constraints to link-up?
Save lets your user defined (non-database) relationships persist
All data grids work the same way, whether schema browser, master detail browser or editor
PART 06: Graphical Query Builder
All data grids work the same way once again
Group By Columns
PART 07: Editing & Running SQL & PL/SQL NOTE: Learning Toad s Schema Browser is like learning Windows File Explorer i.e. Not too bad. But learning the Toad Editor is like learning MS Word i.e. there s a ton to learn & master
Four major functional areas to cover: 1. Editor Toolbars 2. Editor Navigator 3. Editor Text Workspace 4. Editor Display Tabs Plus plethora of options This chapter alone could be 8 hours!
Before Make Code -> Clipboard -> Wherever
Clipboard -> Before Strip Code -> Editor Content
End Result of the Strip Code
F4 - Describe
CTRL-PERIOD Table Name List
CTRL-SPACE Code Templates Note: Steven F. and Bert S. maintain this list of code templates
CTRL-T Column Name List
F9 EXECUTE STATEMENT Means run a single SQL command Get all output via a single data grid
F5 EXECUTE SCRIPT Means run multiple SQL commands Get all output via a single text output and also show one data grid per SQL
F8 STATEMENT RECALL
SQL*Plus Compatibility
SQL Generate SQL or Dynamic SQL Scripting
Toad provides a free little SQL*Plus like tool called Script Runner
PART 08: Fast Reports (Report Builder) Anyone building queries in Toad to then cut & paste into a Report Writer tool such as: Crystal Reports Cognos BI or Impromptu Micro Strategy Oracle Discoverer Why when Toad can do it all
Toad provides a great Report Writer built-in!!!
PART 09: Code Xpert & SQL Xpert
Code Xpert NOTE: Toad can help you engineer better code, both SQL and PL/SQL, but it merely automates gathering software engineering metrics that you then interpret and react to. If you don t know about the following coding metrics, then Toad cannot both automate and then interpret & implement coding changes based upon this it s up to you Toad World Paper: Engineering Better PL/SQL http://www.toadworld.com/linkclick.aspx?fileticket=3jnnslcv8h0=&tabid=321
We ve found that so few people seem to know the software metrics under reports / code metrics that we ve added a simple three color rating: red (bad!!!), yellow (iffy), green (good)
Since this code fragment had no table references, the CRUD Matrix is empty.
Some PL/SQL code in the DB
CRUD Matrix no longer empty
A nice & simple code properties breakdown If you have SQL Scan On, then you get explain plan analysis & comments
What if not writing code, but just want to scan code for any potential problems
Can scan directories of source code and/or existing database objects and a mixture of both
TCR color coding shows here
SQL Xpert NOTE: Toad radically simplifies & fully automates writing very efficient SQL regardless of your Oracle explain plan & optimizer knowledge push a few buttons and simply get better SQL every time
You must be legally licensed for Oracle s OEM Tuning Pack
Oracle s SQL Tuning Advisor prior to 11g provides little useful advice for developers, and even with 11g the advice is really something that the DBA must do - i.e. as before, DB structural advice, and now SQL Plan Management Quest SQL Optimizer offers all that plus SQL rewrites that any developer can do
Quest SQL Optimizer offers so much that it may feel a bit overwhelming at first, but just learn to press a couple buttons first for quick & easy success
Found 253 potentially better rewrites (you can fully control this via options)
Optimized SQL returned & replaced back into the Toad Editor you re good to go now with better SQL code
PART 10: Debugging SQL & PL/SQL This section is NOT meant to teach one how to use a source code debugger you should already know that and simply be looking for how to do what you already know inside Toad for both SQL and PL/SQL
Toad has the only SQL script debugger not even Oracle database or tools provides this capability!!!
For PL/SQL debugging, Oracle provides API s that they and all third party vendors call to debug PL/SQL since PL/SQL executes within the database. So we all just add GUI s to that API so no debugger has more features than any other, just better user interfaces The original PL/SQL debugger API was DBMS_PROBE. But Oracle decided to switch to a Java based debugger engine/interface a few versions back it has some very features that the old API lacked, such as better simple and complex data type support. Toad let s you pick
You can set breaks on watched variables as well Eventually you ll see some value that s wrong and you can change it here without recompiling code
You can code any valid SQL or PL/SQL expression or simply set a loop pass counter limit
Need screen snapshot with ref cursor grid
Ever wanted to debug some PL/SQL code called by some other application e.g. code in Visual Studio or Eclipse Toad can do that to has had this for years
PART 11: Project Manager Ever wished that Toad would let you collect and organize objects that you work with, say for a work project.
What s going to happen.
PART 12: App Designer
Often you go into a Toad screen to set some settings, push exec, and have something happen (perform work) Toad has for a long time had a way to capture those settings and then let you repeat work that from command line But old way had problems, and was not everywhere So we re working on replacing the old command line method with a cool, new Toad Application Designer. Think of it as a macro record and playback facility Toad 9.6 started this effort was called actions Toad 9.7 revised the approach now called App Designer
Some screens still not converted to app designer Look for open folder and floppy disk icons These are for load and save screen settings Notice no camera icon in bottom left corner (new method)
Now you can automate tasks and program dependencies and iterations, with conditional logic and anything else you can imagine and program
Questions and Answers Thank You Presenters: Bert Scalzo: Bert.Scalzo@Quest.com Note: these slides should be available on Collaborate web site, but we ll also make sure to post them on our company s web site: www.toadworld.com/experts/bertscalzostoadfanaticism/tabid/318/default.aspx