0% found this document useful (0 votes)
125 views20 pages

9.7 TipsAndTricks ToadForOracle

Uploaded by

srinath0253
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views20 pages

9.7 TipsAndTricks ToadForOracle

Uploaded by

srinath0253
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Toad® for Oracle 9.

7 Tips & Tricks Quick Reference

Introduction
Toad for Oracle is now celebrating its 10th year of being the market leading Oracle tool
for database p professionals. Whether you are new to Toad, or have been using it for the
past decade, there are several features that we feel you should be familiar with. This
document will step you through some Toad fundamentals. We break down the features
by the following areas:
Standard features – discusses functionality provided by the base edition of Toad
Xpert features – discusses our proprietary SQL and Index optimization features
Database Administration features – discusses how Toad can help a DBA or
Development team manage their Oracle environments with Toad.

If you are already a Toad customer and do not have access to the features being discussed
below, please contact your Quest Sales Representative and request a complimentary 30-
day evaluation license key.

Toad for Oracle Standard Edition Features


Regardless of your job title or responsibility in your organization, if you work with
Oracle, then you will need a quick and efficient way to access the data in your database.
This part of the document will step you through how to browse the contents of tables,
write your own custom queries, and view the relationships of your database objects.

This section also discusses Toad‟s powerful features available for developing and
maintaining your PL/SQL stored procedures.

Schema Browser - Tabular view of objects with add/delete/modify ability


The Schema Browser is your gateway to the database objects in your Oracle instance.
Simply select the user/schema, database object type, and database object, then
immediately gain access to all the pertinent information for that object.

1) Customize Left Hand Side (LHS)Tabs Customize tabular view by Right


clicking in the white area of the object icon bar and selecting the configure box.
Double click on the box intersecting the Tab you would like to hide and the box
that reads “VISABLE.”
Captions can be modified to display a user-defined description in the tab. Or if
English isn‟t your first language, translate “Tables” to “Les Tables” (yes, this is a
joke.)
Use the „Up‟ & „Down‟ arrow buttons to re-order the tabs, or use the
„Alphabetize‟ button to make items easier to find, versus „Tables‟ and „Views‟
appearing first and second respectively.
You can also use the Configure button dialog on the Right Hand Side.

2) Display Type Configure Toad to show your objects in a Tree List, Drop Down
list, or using a Single Line of tabs.

Selecting ‘Dropdown’ will give you the most amount of real estate for listing
objects and allow you to use the keyboard to navigate the object type list.

3) Favorites Add regularly accessed objects to the favorites tab by right clicking on
the object and selecting Add to SB Favorites.
4) Projects Organize your database objects by Application or Project by right
clicking on an object(s) and selecting „Add to Project Manager‟. Having a Project
defined will allow you to now filter your object list by Project. This can be handy
when you are logged into a 30,000+ object schema that contains tables for 30
different applications and you only want to see the „Payroll‟ tables versus
everything.
5) History Quickly navigate to objects you‟ve browsed to previously. Use the
„Sundial‟ button

6) Data View and modify a table‟s data by selecting table from the object tabular
view, and the DATA from the right side of the screen
a) Sort/Filter the data by selecting the icon resembling a funnel
b) Select Columns- to limit the columns shown in the grid right click and
choose SELECT COLUMNS
c) Save the data to a file format of your choice by right clicking in the data
grid and selecting Save As. This gives the choice of format and saving the
data to a file or copying to the clipboard.
d) Create Insert Statements by right clicking the data grid and selecting
create insert statement. It will save inserts on clipboard to be run from
Editor.
e) Customize Layouts by dragging and dropping columns into select order.
Fix a column or set of columns by right clicking and selecting fix current
column. View only desired columns by right clicking and choosing select
columns. To save a desired layout, select VIEW>OPTIONS>SCHEMA
BROWSER> DATA and GRIDS>DATA GRIDS and check „Save
Layouts‟
f) Card View allows you to view records one a time vertically. Click on the
„Blue Book‟ button to start using this feature.

g) Reporting- To access TOAD‟s Fast Report reporting tool, right click in


the Data Grid and select „Report.‟ You will find a report generation wizard
to walk you through report creation. You can also access this via the
„Grid‟ Toad menu item, e.g. GRID>Report.

7) Additional Detail View New for version 9.5, we now display by default all of the
detail information for your objects on the Right-Hand-Side (RHS). You can
manually add any of these detail items to the LHS by mouse-right-clicking in the
column header on the LHS. For example you could add „Num Rows‟ and sort by
table size.

8) ER Diagram Access our table specific Entity Relationship Diagram by selecting


the icon in the tables tab the represents 3 tables joined together. Once in the ERD,
you can choose to load up Toad Data Modeler (new for v9.6 and if you have Toad
Data Modeler installed) for a more complete logical data model of your selected
objects.
Query Builder (Formerly SQL Modeler) - allows for building queries visually
1) Select Tables From the VIEW menu select the OBJECT PALLETT this will
invoke a sliding/dockable window displaying Tables and Columns. Select one, all
or any subset in between of the tables or views necessary for the query and drag
them into the workspace on the left.
2) View Joins If the tables have relationships defined by Referential Integrity
Constraints (Foreign Keys), Toad will automatically detect these and you‟re your
tables/views. Double click on a link to view or change the join condition for your
query.

3) Choose Columns Double click in the check boxes of the columns desired for the
query
4) Add Where Clause Criteria Drag a selected column from the „SELECT‟ tree
area and drop it on the „WHERE‟ area. You can also mouse-right-click on a
column in the tree and select „Include in Where Clause.‟ This will open the
„Where Definition‟ window. Click on the ellipsis button to see distinct values for
the selected field to help you build a meaningful where condition.
5) View Generated Query View the SQL by looking at bottom of the screen.
6) Run Generated Query Run the query with the F9 key or the green play button to
return a data set.
7) Explain Plan View the explain plan by clicking on the ambulance icon on the
second of the top two icon bars
8) Create a model from existing Query- From the Editor right click and select
“Send to Query Builder” to reverse-engineer your selected query to a Query
Builder model.

Editor the former SQL Editor, PLSQL Editor, and offline editors have been condensed to
a single window for all of your SQL, PL/SQL, anonymous block, SQL*Plus script, XML,
etc editing and ad hoc querying the database.
1. SQL Recall Access previously executed SQL by selecting F8. This will put a
“Slide in slide out” SQL recall button on the left side of the Editor. The user can
filter the list by adding to “Personal SQLs” or take it a step further by adding to
“Named SQL” both of which are found under the SQL Editor menu option. To
select Personal and Named SQL, right click the statement and select “Change to
Personal” or “Change to Named.”
a. Named SQL Giving your SQL Statements a name allows you to recall
your query by context versus obscure SQL you may have wrote 6 months
ago. If you spend more than 30 seconds writing a SQL statement, give it a
name. You can now recall w/o using the F8 dialog giving you more room
to type in the editor. Use <CNTRL>+N to popup a list of named SQL
statements. Selecting one will put the SQL in your editor.
b. Quick Browse You can cycle through your list of previously written SQL
statements using <ALT>+<Up Arrow> or <ALT>+<Down Arrow>. You
can do this on selected text to do a limited replacement.

2. Table and Column Windows From the VIEW menu select the „Object Pallete‟
- this will invoke a sliding/dockable window displaying Tables and Columns.
Once these windows are slid into view, drag and drop or double-click mouse
functionality can be fully utilized. Another manner for retrieving table names is
by selecting the first letter or letters of the table and hitting
<CTRL>+<Period>. To access a table, or ANY other object description, place
the cursor on the text and hit F4.
3. SQL Function Templates From the VIEW menu select the CODE SNIPPETS
this will invoke a sliding/dockable window displaying code templates. A drop
down let‟s us see all of the different Function Types from which we can select
templates. Drag and drop can also be utilized from this dockable window.
4. Make Code Statements TOAD supports 6 different programming languages
(C++, Delphi, Perl, etc), chosen through the Options menu, for creating code
statements based on SQL, or for stripping non-SQL syntax from a code statement.
To take a SQL statement and automatically format it to be imbedded into a Java
program, for example, we need to simply select “Make CODE Statement” from
the Editor menu. This will copy the current window‟s statement to the clipboard
in whichever language‟s syntax the user has chosen. The next step is to paste the
formatted SQL call into the code. You can extend this feature to the
programming language of your choice by adding it manually in the Options
dialog.
5. Format Code To instantly transform chaotic, untidy code into easily managed
aesthetically pleasing code by right clicking in the editor and selecting the icon
showing two yellow arrows. Under the menu option “View”, select “Formatting
Options” to customize how the code will be formatted.

6. Auto Replace To access the auto replace, right-mouse-click from the editor and
select “Editing Options”. From there choose “Auto Replace” to set what the user
wants replaced and with what to replace it.
7. Code Templates You can customize the pre-written code templates by right-
clicking in the Editor and choosing “Editing Options.” From there you will
default into the behavior portion of the Editor options. From the Language area,
choose edit, and you will see a number of templates to edit. Select Templates to
see, add and edit you templates. Toad provides many templates but the user can
also add their own templates from here. To access the Templates from the Editor
simultaneously press <CTRL> and the Space Bar. The user can also memorize the
shortcut name, type one and hit CRTL/Space to retrieve the Template.

8. Code Insight Toad can help you write your SQL and/or PL/SQL statements. The
Code Insight feature has been remarkably improved for the 9.6 release. As you
may remember from Toad v 9.5, Code Insight (<ctrl>+<Period> from the editor)
allows you to quickly browse and select tables in the editor. Now in 9.6, Code
Insight has the ability to see the following object types:
a. Tables
b. Views
c. Aliases
d. Functions|Procedures|Packages (with methods)
e. Types (with attributes and methods)
f. Java Source
g. Sequences
h. Users
i. Public Synonymns

Code Insight can now be initiated by <CNTRL><Period> and


<CNTRL><T> (<CNTRLl><Period> for wild-carding , <CNTRL><T> to
list all, <SHIFT><TAB> to auto fill).

Any child nodes of an object will be displayed when „.‟ is used after the
insight window has been opened.
j. Special Note: for performance reasons, not all of the above are enabled by
default, in particular the public synonym type.

9. Tune the SQL Statement- ( See page 13)

Editing PLSQL- from the Editor window


1) Customizing Procedure Templates Toad has templates for Procedures,
Functions, Triggers and Packages, which are fully customizable. To modify a
template select proc templates from Toad options.
2) Execution Profiling Toad allows you to record your PL/SQL execution to
determine where any execution bottlenecks are occurring, e.g. „Why is my
program taking so long to run?‟ To execute a profiler run, toggle „on‟ the
„stopwatch‟ button next to the „debug‟ toggle. Then execute your PL/SQL
program from the Editor. After it is finished, pull up the record from the
„Profiler‟ tab. With version 9.6 and higher, you can now automatically pull up the
visual chart representations of your PL/SQL runs by clicking on the „Details‟
button.

Quickly determine which line of code is taking the most time to run.

Toggle on the ‘Details’ view to see a graphical representation.


3) Debugger– A developer‟s best friend for figuring out why your program isn‟t
behaving as expected. Run your program line-by-line, by „stepping‟ through the
code.
a) Set Breakpointss To set execution breaks in the code leave the cursor on
the line on which you wish the code to break and hit F5. Set conditional
breaks by double clicking the break in the “Break and Watch view
window.” Make sure to only add breakpoints that are „executable.‟
These are marked by little blue dots in the editor gutter for each line.
Non-executable lines will not have their breakpoints honored by Oracle.
b) Add Watch To add a watch on a variable, leave the cursor blinking on the
variable on which the watch is desired and click the eyeglasses icon.
New for v9.5, you can see the values of all of your code variables by using
the „Enable Smart Watches‟ feature.

4) Modifying Variable Values While Debugging To artificially change the value


of one of your PL/SQL variables, highlight the variable in the watch window and
hit the calculator on the icon bar which, once moused over will read
“Evaluate/Modify Watch”
5) Automated PL/SQL Code Review (Toad for Oracle Professional)- Run your
programs through our CodeXpert feature. With more than 100 Rules for Best
Practices (provided by Steven Feuerstein!),

Toad can even detect poorly written SQL code that could affect performance in
production environments!

Querying Databases other than Oracle- Introducing Toad for Data Analysis
1. Connect natively to the following non-Oracle databases:
a. IBM‟s DB2, LUW and z/OS
b. Microsoft SQL Server
c. MySQL
d. Sybase ASE
2. Connect via ODBC to other databases, including:
a. Terradata
b. Informix
c. PostreSQL
d. Any datasource that supports the ODBC v3 protocol
3. Quick connect to MS Access and MS Excel w/o ODBC configuration for
querying, reporting, and exports/imports!
4. Build queries visually or use the familiar Toad editor to get to your data
5. Browse the contents of the database using a single Browser (just like Toad for
Oracle!)
6. Compare and Synch DATA between different databases
7. Rich MS Excel integration, build pivot tables and ODBC linked queries on the
fly!

Toad for Oracle now includes Toad for Data Analysis which extends our powerful
browsing and querying technology to other RDBMS platforms!

Notes regarding this feature:


Toad for Data Analysis is available for any Toad for Oracle user that is current on
maintenance.
If you need to perform database administration or application development tasks,
then be aware Quest has specific Toad IDE‟s for those platforms, e.g. Toad for
MySQL, Toad for DB2, Toad for SQL Server.
Your Toad for Data Analysis license is provided via Toad for Oracle and cannot
be transferred to another person
Toad for Oracle remains your „Go To‟ tool for anything Oracle. Toad for Data
Analysis is provided here to give you access to the data in sources other than
Oracle.
Toad for Oracle Professional Edition Features
Generate Test Data for one or more tables automatically!

Toad’s Professional edition allows you to select one or more tables and generate
test data. Toad will even honor your foreign key relationships when creating key
values.
Generate functional tests for your PL/SQL without writing any PL/SQL code

Describe in plain English the behavior of your PL/SQL program, and let Toad
generate and manage your test code. Run a regression test anytime you make a
change to your program. This feature is available with the Toad Development
Suite for Oracle.

Also included with the Professional Edition:


1. Code Xpert, Toad‟s revolutionary SQL and PL/SQL Automated Code Review
2. Export File Browser – Toad can read your Oracle .DMP files just like a live
databse
3. IMPORT/EXPORT wizards. Run an Export, Import, or DataPump session to
move your data between instances.
Tuning SQL w/Toad OR ‘Making SQL Go Faster by
Clicking the ‘Easy Button’

Toad for Oracle‟s Xpert Edition includes a comprehensive SQL Tuning solution which
will identify problematic SQL, Optimize statements automatically, suggest index
alternatives, and even provide impact analysis when making changes that affect the
database.

Wherever you encounter SQL in Toad, you can also invoke a tuning session for that
statement by simply pressing the “Optimize SQL” button.

Tuning Current Statement from the Editor


When handling a problematic SQL statement in the Editor in Toad, it is very easy to
move the statement into our tuning lab. Just select the SQL you want to tune, and hit the
„Optimize SQL‟ button. Again, it is the Yellow Beaker with the Tuning fork (Found on
the right of the printer button.) You will then be prompted to send the SQL code to the
Tuning Lab or the Batch Optimizer.

Batch Optimizer- The tuning technology now allows a user to send multiple
tuning jobs (any collection of SQL or any embedded SQL found in a set of PL/SQL
programs) to a tuning queue. Each section of code will be evaluated. Any „problematic‟
SQL code will be automatically tuned. You will be informed what SQL the tuner was
able to generate that will allow your query to run faster, and by how much!

Toad’s Batch Optimizer can take a collection of poorly performing SQL statements and
tune them in batch. We’ll provide the new queries and show you then increased
performance and before and after execution plans.
The tuning technology was updated for v9.5 of Toad. Starting with version 9.6, when
starting a new tuning scenario, users will be prompted to add their SQL to the Batch
Optimizer Queue, or by starting a new Tuning Lab session. The Tuning Lab session will
allow the user to tune the SQL by hand just like it worked in versions 7-9.1 of Toad.

Tuning Lab- The Tuning Lab, or the „classic Tuning window‟, guides the user
through analyzing the current execution plan and then to generating SQL query rewrites
that will hopefully find a different execution plan that positively affects the execution
time. Toad offers an easy-to-understand execution plan which is automatically generated
when a statement is moved into the Tuning area.

Toad takes selected tuning techniques like syntax transformation, hints, where clause
order permutations, etc to generate new queries that force Oracle to consider new
execution plans for your queries.

Explain Plan- Toad offers an easy-to-understand execution plan which is


automatically generated when a statement is moved into the Tuning area. The Explain
Plan displays a numbered layout to show the order of operations. An English breakdown
as to what each step of the explain means can be found right below the plan itself. This
simplified execution plan is now offered directly in the Toad editor.
Optimize - This is the “make it go faster” button. It is an icon represented by a
blue tuning fork in the top left of the tuning window. This will rewrite the statement in as
ways that generate a unique execution plans.
Execute – This button will run the selected query re-writes so we can see which
one runs the fastest as compared to the original statement.
Resolution – After the re-writes are finished executing, click on the „Resolution‟
tab to see the „winning‟ query re-write.
Indexing – The indexing feature will analyze a collection of SQL statements to
see which tables and views are being queries, and then will look at the existing set of
indexes. It will then generate a list of alternative indexes you can evaluate for optimal
execution of your original SQL statements. We recommend the SQL Query re-write
tuning methodology whenever possible as adding indexes to your system can affect the
performance of other SQL queries found in your code and views. If you need to create a
new index, then be sure to use our Impact Analysis technology.

Impact Analyzer – Whenever you add one or more indexes to the database,
the execution plans for your applications‟ embedded SQL can be dramatically impacted.
The Impact Analyzer allows you to model these proposed system changes so you can see
exactly how your new index affects everything else in the database. We generate the new
theoretical index and the new execution plans for each of your production SQL
statements. You can see what the before and after ramifications are to your system
whenever you propose a change.

Identify key SQL code, propose a change to the system (a new index?), then see how that
change affects the execution plans for your SQL code.
Database Management Made Easy via the DB Admin
Module
Any copy of Toad can be upgraded to include Toad‟s advanced database object
management features with the DB Admin module. Whether you need to create test
environments based on existing instances, manage database resources, or compare and
synchronize different instance, the DB Admin module may be right up your alley. This
portion of the document will take you through some of the more helpful features.

Health Check (Database > Diagnose > Health Check)


Wouldn‟t it be nice to give each of your instances a thorough medical checkup? With
Toad‟s Health Check, now you can! Select the instances you want inspected, select the
scenarios you want evaluated, and hit the play button. This feature can be scheduled and
you can have the results automatically emailed to you so can see what‟s what in each of
your managed instances. For instance, we can automatically inspect for ORA-600 Alert
Logs or look for synonyms that point to non-existent objects.

Easily create multiple types of health check scans that run on selected instances on given
days of the week and email the results to the DBAs responsible for those
instances/database tasks.

Database Browser (Database > Monitor > Database Browser)


Most users will rely on the Schema Browser for poking around the database, but for
DBAs, Toad offers the Database Browser for more effective instance management.
Toad‟s Database Browser allows you to connect to all of your databases and interact at
the database level (users, roles, tablespaces, system privileges, etc.) You can select
multiple instances and see the parameters set for each side-by-side, or you can drill down
into the objects of the database just like you can for the Schema Browser.

The Database Browser serves as your entry point to running most of the database level
utilities in Toad. Start a health check, look for the most expensive sessions, startup or
shutdown the instance, all with a single click. New for version 9.7, Toad now offers the
ability to setup and run your database backups with our Recover Manager (RMAN)
integration.

Statspack Browser (Database > Monitor > Statspack Browser)


Statspack allows you to see what was happening in your database for a specific period of
time. For example, what tablespaces were most frequently read and written to in the last
24 hours? Toad allows you to answer this question in a few seconds. Additionally, you
can use Toad to manage the Statspack statistics collection jobs and the snapshots it
queries from.
Zooming into a chart allows you to highlight chart lines or export the data to MS Excel.

Trace File Browser (Database > Diagnose > Trace File Browser)
Tired of using TKprof to analyze your trace files to see what is causing your database to
run at less than peak performance? New for Toad v9.7, you can now visually inspect the
contents of your Trace files. See immediately all of the queries captured with their binds,
waits, and performance profiles.

Click on a query to see the binds variables and the values passed for execution.
Toad will show the number of queries that run under specific amounts of time. Drill
down to an individual statement to see the Execution vs Parse vs Fetch vs Wait times so
you know EXACTLY how to approach a tuning scenario.

DBAs, do you need even more help?


Ask your Quest Account Manager how you can get access to our award winning tools for
performing:
Real-time diagnostics with Spotlight on Oracle
Database activity replays under load with Benchmark Factory for Oracle
Reverse-engineers of existing databases for rich ER Diagrams or creating new
physical or logical models from scratch.

All of the following are available with Toad in our Toad DBA Suite for Oracle.

Where can I get more help with Toad?


Toad for Oracle has more than a decade‟s worth of feature development and investment
by Quest Software. It has features that can‟t be adequately covered or discussed in a
single 20 page Word document. For more help, please consult the following resources 
1. Your Quest Sales representative - He or she is dedicated to keeping you and your
company happy with its investment in the Toad family. They can get your
questions answered, provide insight on solutions at Quest that address your
problems, help you with getting evaluation copies of our software, and even help
you manage your relationship with Quest Support.
2. Quest.Com - Toad Product Page
3. ToadWorld - Online Toad User Community
4. AskToad - Toad's own Wiki site for FAQs and troubleshooting
5. Yahoo! Groups - 7,000+ toad users worldwide answer each others questions
THANK YOU!

You might also like