Beruflich Dokumente
Kultur Dokumente
Written by
TECHNICAL BRIEF
2010 Quest Software, Inc. ALL RIGHTS RESERVED. This document contains proprietary information protected by copyright. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording for any purpose without the written permission of Quest Software, Inc. (Quest). The information in this document is provided in connection with Quest products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Quest products. EXCEPT AS SET FORTH IN QUEST'S TERMS AND CONDITIONS AS SPECIFIED IN THE LICENSE AGREEMENT FOR THIS PRODUCT, QUEST ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL QUEST BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF QUEST HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Quest makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Quest does not make any commitment to update the information contained in this document. If you have any questions regarding your potential use of this material, contact: Quest Software World Headquarters LEGAL Dept 5 Polaris Way Aliso Viejo, CA 92656 www.quest.com E-mail: legal@quest.com Refer to our Web site for regional and international office information.
Trademarks
Quest, Quest Software, the Quest Software logo, AccessManager, ActiveRoles, Aelita, Akonix, AppAssure, Benchmark Factory, Big Brother, BridgeAccess, BridgeAutoEscalate, BridgeSearch, BridgeTrak, BusinessInsight, ChangeAuditor, ChangeManager, Defender, DeployDirector, Desktop Authority, DirectoryAnalyzer, DirectoryTroubleshooter, DS Analyzer, DS Expert, Foglight, GPOADmin, Help Desk Authority, Imceda, IntelliProfile, InTrust, Invirtus, iToken, I/Watch, JClass, Jint, JProbe, LeccoTech, LiteSpeed, LiveReorg, LogADmin, MessageStats, Monosphere, MultSess, NBSpool, NetBase, NetControl, Npulse, NetPro, PassGo, PerformaSure, Point,Click,Done!, PowerGUI, Quest Central, Quest vToolkit, Quest vWorkSpace, ReportADmin, RestoreADmin, ScriptLogic, Security Lifecycle Map, SelfServiceADmin, SharePlex, Sitraka, SmartAlarm, Spotlight, SQL Navigator, SQL Watch, SQLab, Stat, StealthCollect, Storage Horizon, Tag and Follow, Toad, T.O.A.D., Toad World, vAutomator, vControl, vConverter, vFoglight, vOptimizer, vRanger, Vintela, Virtual DBA, VizionCore, Vizioncore vAutomation Suite, Vizioncore vBackup, Vizioncore vEssentials, Vizioncore vMigrator, Vizioncore vReplicator, WebDefender, Webthority, Xaffire, and XRT are trademarks and registered trademarks of Quest Software, Inc in the United States of America and other countries. Other trademarks and registered trademarks used in this guide are property of their respective owners.
Contents
Introduction.................................................................................................................................................... 3 Toad Editions ............................................................................................................................................. 4 Base (Standard) Edition ......................................................................................................................... 4 Editions for Developers .......................................................................................................................... 4 Editions for DBAs ................................................................................................................................... 5 Toad Treasures ............................................................................................................................................. 7 Project Manager ......................................................................................................................................... 7 Creating a Custom View with Project Manager ..................................................................................... 7 Project Manager Works Like the Schema Browser ............................................................................. 10 Project Manager Can Create Real Files .............................................................................................. 11 Customizing Project Manager .............................................................................................................. 12 Application Designer ................................................................................................................................ 13 Repeating or Scheduling a Task .......................................................................................................... 14 Running an Application ........................................................................................................................ 17 Data Import and Export ............................................................................................................................ 18 Using Export File Browser to Peek Inside a Dump File ....................................................................... 18 Viewing the Data in a Standard Toad Data Grid ................................................................................. 19 Code Xpert ............................................................................................................................................... 19 Helping Developers Find Problematic Code ........................................................................................ 19 Helping DBAs Track Down Performance Problems ............................................................................ 21 SQL Optimizer for Oracle......................................................................................................................... 21 Tuning a Problematic Query Automatically.......................................................................................... 21 Conclusion................................................................................................................................................... 23 About the Author ......................................................................................................................................... 24
Introduction
Quest Software has been selling Toad for nearly a decade now. Some interesting facts highlight Toads growth from its humble freeware beginnings:
Toad has over one million users worldwide Toad is considered the de facto standard Quest will soon be releasing version 10.0 of Toad
Surprisingly, people are always genuinely amazed by the depth and breadth of the product: even longtime users routinely find new things they never knew Toad could do. Its in that spiritunearthing Toad gemsthat this paper is written. The idea will be to present some useful tidbits for everyone, regardless of job function or Toad experience.
Toad Editions
Lets start by looking at how Toad is bundled and sold. Some bundles offer much more functionality than the base product, and youll want to find the right set of features for your needs.
These editions include key features not found in the base edition that professional database application developers and PL/SQL developers often need. If youre developing enterprise database applications, two great choices to help you write efficient code are Toad for Oracle Professional (which includes Code Xpert) and Toad for Oracle Xpert (which provides SQL optimization and what-if index analysis). If you need to test the functionality and scalability of your database applications as well, then the Toad Development Suite for Oracle best fits the bill, with Benchmark Factory for Databases and its PL/SQL code testing tool, Quest Code Tester for Oracle, from Steven Feuerstein Mr. PL/SQL himself.
The diagram below details the features of all three developer editions in comparison to the base edition:
The Toad DBA Suite for Oracle provides many advanced database administration features, including ASM manager, auditing, compare database, compare and sync schemas, database Health Check, database monitor, index monitor, and GUI interfaces to DBMS_FLASHBACK and DBMS_REDEFINITION. The Toad DBA Suite for Oracle also includes three other critical facilities for your tool belt:
Toad Data Modeler for professional database design Benchmark Factory for database load generation and stress testing A single database instance copy of Quests award winning Spotlight for Oracle database diagnostics to identify the root causes of performance issues
Toad Treasures
Now that you know which Toad edition suits your needs, lets look at some useful but oft en overlooked features. Lets dig up some Toad treasure! Below are five features truly worth your investigation. I will show you how each feature can enhance your productivity and hope that it will entice you to either dig further on your own or view the webcast, because its much more easier to relate to it when you see Toad in action.
Project Manager
Some time ago, Quest added a great new productivity enhancement to Toad for Oracle called Project Manager. Everyone who sees it says, Wow, cool! Thats going to make my work easier. But Project Manager remains underutilized, so Im going to explain its benefits and hope youll try it out.
Since I know Im going to be doing some PL/SQL coding on procedures, functions, and packages, Ill repeat this step for all the objects that I think Im going to need to work with for this task. Each time, Ill select the same project so that Ill build an interesting set to work with.
Figure 4. A Toad project with just the objects needed for a task
This example might seem rather trivial so far, but I now have a Toad project that contains only those objects I need to work with for this task. Unlike the Schema Browser, which can show either all the objects or some based upon basic filters, the Toad Project Manager lets me build my own custom view of the database object world.
10
11
What did that accomplish? To find out, lets drag and drop the CUSTOMER table to that directory. Ill be prompted for the name of a file to be created:
So what just happened? Obviously the file is going to show up in Project Manager as a file under the directory. But if I go out to the Windows Explorer and look, Ill find an actual file with the DDL to create that table and all of its supporting structures.
12
Application Designer
Toad has always had the ability to automate certain screens to run from the command line, but it required a little learning curve that frankly people seemed to feel was just too much. Many of them asked us to make a tool set for Toad that would allow them to create their own logical organization or workflow for basic, low-level tasks. Application Designer, available beginning in Toad for Oracle 9.7, does just that; it is robust and capable, but requires only a simple GUI interaction, with nothing else to learn. So lets dig deeper using a couple of examples.
13
14
Before we can continue, we need to define the following terms that are used in Toad:
ActionAn atomic chunk of Toad functionality that has been encapsulated for the purpose of executing, scheduling, sharing and building Toad applications AppOne or more Actions designed to work in unison as a mini Toad application App DesignerThe window used to create and manage applications
In this example, Ive simply defined the Save As for my editor query of Texas-only customers into an action called Save as Texas Customers and placed that into an application called Texas Customers. Now lets open App Designer to see the result.
I can now choose to run or schedule that application. If I choose to run it, Toad is simply executing the application within my currently running instance of Toad. That is, behind the scenes, it will execute the query and perform a Save As, but I wont see anything flash by; Ill just see a run status indicator such as the green Completed bar shown above. If I go into my C:\Temp directory, Ill find that file as expected.
15
If I schedule the application instead of running it, a wizard is invoked, as shown below.
I have now created a Windows task on my PC that will execute Toad in command-line mode in my C:\Temp directory, passing the necessary parameters so that it will run the application and all its actions as if it had been multi-action. Thats it: nothing to learn like before with the old command -line method.
16
So where can you do this? Basically on any screen that has the camera icon at the bottom, and the number of those screens is growing as we speak. What if I dont want to go into the actual screen, but instead I want to build the application and its actions right there in the App Designer screen? That is also an option. The tabs along the right side offer toolbar icons for the tasks weve already defined as actions. That list is also growing.
Running an Application
Now lets look at an example for a DBA, which will also introduce you to many other possibilities for using Toad Application Designer. The application shown belo w checks my database to see if its up. If it is, it runs a Health Check, which will e-mail me the results. If not, Ill start the database first, and then run the Health Check. The possibilities are nearly limitless.
17
Figure 13. Viewing the contents of a dump file and the DLL
18
Code Xpert
Developers want to write better code; DBAs want to find any code that doesnt perform well. Toad helps solve both of these challenges with Code Xpert.
19
How can we fix this horrible code? We can use Code Xpert, a utility inside the Toad Editor. Its like having a mentor review your work with the push of a button. By merely switching to the Code Xpert tab near the bottom of the Editor screen and clicking the Perform Code Review button, I get output like that shown here:
Code Xpert includes over one hundred programming rules that are defined by default, but it mercifully restricts itself to the top 20 as defined by industry experts. In this example, Code Xpert has found a GOTO and advises against using it. If you dont like the predefined rule sets, you can easily select the rules that youd like to check. You can even create your own custom rule sets. Additionally, the Reports tab shows several key items worth having access to:
A CRUD matrix of the tables referenced by the code Software Engineering Institute (SEI) standard metrics (i.e., Halstead Complexity Measure, MC Cabes Cyclomatic Complexity, and Maintainability Index) for the code A simple Toad color code of green, yellow, or red based upon the cumulative results from the standard metrics
Furthermore, Code Xpert rates all your SQL statements as simple, complex or problematic, with their explain plans if you like. That way you can focus on tuning just those statements that warrant it.
20
Figure 16. Code Xpert identifies code that causes performance problems
You can also use Code Xpert to create project deliverables related to overall code quality. If you work on government projects or are a consultant tasked with producing such items, batch mode Code Xpert can be a life saver. A quick demo of Code Xpert can be found on Toad World.
21
Figure 17. Quest SQL Optimizer automatically rewrites SQL and tests all the options
Once SQL Optimizer has identified all the possible scenarios that might result in better performance, it can run them all and report back on the best-performing SQL alternatives. In fact, lazy people like me just run SQL Optimizer and push two buttons: one to generate all the likely best re-writes and one to test them. It automatically displays the winner. So with practically no effort, even I can produce SQL code thats guaranteed to be the fastest possible. And I dont even really have to describe explain plans, outlines, hints, or any other advanced Oracle concepts. SQL Optimizer simply helps you find the best code possible as quickly as possible, regardless of your tuning and optimization skill set. A quick demo of SQL Optimizer can be found on Toad World.
22
Conclusion
I hope you found some of the features of Toad that Ive described interesting enough to warrant further inspection on your own. I believe all of them can increase your productivity and help you achieve maximum performance for minimum investment in time and effort, regardless of your role. Be sure to also visit the Toad World web site at www.toadworld.com; you will find numerous blogs, coffee break byte videos, technical papers, and presentations to help you to get the most from Toad for Oracle.
23
24
TECHNICAL BRIEF
800.306.9329 (United States and Canada) If you are located outside North America, you can find your local office information on our Web site. sales@quest.com Quest Software, Inc. World Headquarters 5 Polaris Way Aliso Viejo, CA 92656 USA
E-MAIL MAIL
5 Polaris Way, Aliso Viejo, CA 92656 | PHONE 800.306.9329 | WEB www.quest.com | E-MAIL sales@quest.com
If you are located outside North America, you can find local office information on our Web site.
2010 Quest Software, Inc. ALL RIGHTS RESERVED. Quest, Quest Software, the Quest Software logo and Toad are registered trademarks of Quest Software, Inc. in the U.S.A. and/or other countries. All other trademarks and registered trademarks are property of their respective owners. TBD_HiddenTreasures_Toad4Oracle_US_EC_20101103