Upload
velanc1
View
82
Download
10
Embed Size (px)
Citation preview
© 2009 Quest Software, Inc. ALL RIGHTS RESERVED
Toad Tips & Tricks for the PL/SQL Pro
Tips & Tricks for Analysts, Developer and DBA’s
Toad® for Oracle
2
Three Main Presentation Topics:
• Basics for newbies and often even old hands
• Advanced features for PL/SQL Developers
• Advanced features for DBA’s
3
Part #1
• Basics for newbies and often even old hands
4
Which Toad Version Do I Have?
5
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…)
6
I don’t like Toad’s Menus and Toolbars!Just like Microsoft Office, simply choose menu or toolbar and choose customize …
7
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)
8
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
9
Ten Years of Options – and Growing …
10
11
What is Toad Doing? How does it do that?
Built-In Method Stand-Alone EXE
SQLMonitor.exe
12
13
14
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
15
16
Toad Crashed – How do I troubleshoot?http://support.quest.com
Your Toad Options settings
17
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 …
18
Toad.ini file + Support Bundle file + Toad.elf file = much better chance finding bug or user error
19
20
tnsnames.ora ---Nothing--- OID or MS AD
21
22
23
Hard to see on printed slides, but adds a
color border around the entire window too
24
Of the more often used screens, Toad Schema
Browser is probably the most user configurable
25
Left Hand Side (LHS) Right Hand Side (RHS) Refresh all LHS objects
Refresh current or
focused LHS object
Refresh current or
focused RHS details
26
27
28
29
30
In Tree-View mode, Toad basically looks
and feels just like other tools, such as:
• SQL Navigator
• PL/SQL Developer
• SQL Developer
31
32
33
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 ☺☺☺☺
34
35
Now Schema Browser is “just right” ☺☺☺☺
36
Did you notice that the Funnel
icon is red instead of grey?
What does that mean?
Always notice Funnel color!
Common object operations
on the LHS toolbar, and all
object operations available
via right-hand-mouse menu
37
38
There’s also the “Quick Filter”
Accepts standard wildcards (*)
Accepts database wildcards (%)
39
Schema Browser navigation history …
40
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)
41
42
43
44
45
46
To delete all saved schema
browser layout settings …
47
48
49
Cut & Paste …
50
Part #2
• Advanced features for developers
51
Editor 201
• Code Insight– Object name completion (CNTRL + Period)
– Column Popup (Multi-Select!)
– PL/SQL Completion
– Too ‘Mr. Clippy’ for yourtastes? Disable thefeature!
52
Editor 201• SQL Recall
– Use Named SQL for super fast recall.
– ALT + Up/Dn to scroll through history recall list
• Code Snippets– If..Then..Elsif..
– Exceptions
– Cursor For Loop
– Your custom code
53
Split Editor
• Work with multiple sections of your file simultaneously– Left/Right
– Top/Bottom
54
Editor 201• Make/Strip Code
– Translate Delphi, Java, C++, Perl, C#, VB, etc to SQL
– Translate SQL to Delphi, Java, …
– Write your own custom Code Transformation Templates
55
Editor 201
• Keyboard Shortcuts– Check your options!
• Customize Toolbars– Hate Toad’s 80 gazillion
buttons and toolbars? TURN THEM OFF ☺
56
Editor 201• Debugger
– Conditional Breakpoints
– Use Watches to change variable values and as breakpoints
– Step into TYPE Body
– Supports DML Triggers
– Toad can now write your DBMS_OUTPUT instrumentation code for you!
57
External Debugging• Debug a session that is spawned from a remote
application or service.
• Step thorough your code and view the data as it was initialized somewhere else in the world.
• Your application’s session
sets a DEBUG Flag with a
named Identifier
• You tell Toad which session
to grab. Toad automatically
steps into the code.
58
Editor 201• Never build a DBMS_OUTPUT statement manually !
– Right-click – Output Statements
• Find a matching END IF, END or ) using bracketing
• Code Folding
• Code Refactoring
59
Code Road Map – Document and Create Local
Test/Development Environments – 1 Click!• Diagram Views &
PL/SQL Objects– Generate Test Data
– Generate DDL Scripts
– Build HTML Reports
60
PL/SQL Profiler (DBMS_ & Hierarchical
Support)• Find out which lines take longer to run than others.
• Identify execution bottlenecks
• Figure out what needs tuning
Integrated with the Editor for
instant analysis.
Graphs for quicker identification.
61
PL/SQL Execution – View Collections• Return Values & Out Parameters for your PL/SQL – let Toad
build DMBS_OUPUT for you
• Example – A 2 Dimensional PL/SQL Table Package Function that returns a PL/SQL Table.
62
PL/SQL Execution – View REF Cursors• Does your PL/SQL return a REF Cursor? Let Toad put it
into a Data Grid for you.
63
3rd Party Source Code Control Integration
• CVS
• MSFT TFS 2005, 2008, 2010
• MSFT Visual Source Safe
• Perforce
• PVCS (Serena)
• Subversion
Control files or additionally control objects in the database via Toad’s Team Coding Feature
64
CodeXpert – let Toad review your code before your
peers laugh at you ☺• Analyzes your code against Best Practices rules
developed by Steven Feuerstein, Bert Scalzo, and Quest’s Oracle experts.
Explains why your
code is flagged and
gives advice for better
implementations.
Can identify SQL that
needs Optimized.
65
Ok, you’ve written some kick-butt PL/SQL,
but does it work?• Quest’s latest PL/SQL tool automatically tests your
PL/SQL for correctness.
Step 1: Tell Code Tester what your program does in PLAIN ENGLISH
66
Code Tester for Oracle Writes the Test Code For You!
Step 2: Sit back and relax as Code Tester generates your test code.
67
Run your tests on demand to see what your programs
DO and DO NOT accomplish.
Step 3: Analyze the results. RED = BAD. See the Expected VS Actual
Results.
68
Test Performance/Scalability
• Your stored procedure runs OK for 1 user, how will it handle 10? 50? 100?
• Toad can answer that question, track response time to user load
69
Part #3
• Advanced features for DBA’s
70
Database Browser
71
72
73
74
75
76
77
78
Subset of Schema Browser for those objects not owned
by a schema (i.e. public owner or simply just no owner)
79
App Designer
80
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
81
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)
82
83
84
85
86
87
88
89
90
Now you can automate tasks and program
dependencies and iterations, with conditional logic
and anything else you can imagine and program ☺☺☺☺
© 2009 Quest Software, Inc. ALL RIGHTS RESERVED
Thank youThank you
Questions?you