oraclesqldeveloper slides

Upload: aurel-ciotea

Post on 03-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 OracleSQLDeveloper Slides

    1/57

    Copyright @ 2007, John Jay King 1

    John Jay King

    King Training [email protected]

    Download this paper and code examples from:

    http://www.kingtraining.com

    Introducing

    Oracles SQL Developer

  • 8/11/2019 OracleSQLDeveloper Slides

    2/57

    Copyright @ 2007, John Jay King 2

    Session Objectives

    Become aware of Oracles SQL Developerproduct and its features

    Be able to create, modify, and test both SQL andPL/SQL using SQL Developer

    Use SQL Developers Object Browser to examineand/or alter existing objects and to create new

    objects Debug stored PL/SQL Procedures and Functions

    using SQL Developer

    Customize SQL Developer to your personalpreferences

  • 8/11/2019 OracleSQLDeveloper Slides

    3/57

    Copyright @ 2007, John Jay King 3

    Oracle SQL Developer Oracle has released the free SQL Developer tool

    (formerly known as Project Raptor) and it is super! If you have ever used the Free Toad tool or PL/SQL

    Developer this tool will feel familiar; plus it has more

    features and supports Oracle 10g too! SQL Developer is a Java-based GUI tool

    (works in Windows, Unix, and Linux) Power of SQL*Plus without a local Oracle client installation

    Intuitive software; not completely new, based upon JDeveloper Provides features often found only in expensive third-partysoftware including:

    GUI browsing of database objects, creation, deletion, alteration Debugging complete with breakpoints

    Query execution Database reporting Multiple connections Tuning features

  • 8/11/2019 OracleSQLDeveloper Slides

    4/57

    Copyright @ 2007, John Jay King 4

    Where Can I Get It?

    SQL Developer is freely downloadable fromOracle using the following URL:

    http://www.oracle.com/technology/products/

    database/sql_developer/index.html Current release as of March 2007 is 1.1.2

    Release 1.2 scheduled for mid-2007

    Two versions are available: Product with Java 1.5 embedded (about 65mb)

    Product using installed Java 1.5 (about 39mb)

  • 8/11/2019 OracleSQLDeveloper Slides

    5/57

  • 8/11/2019 OracleSQLDeveloper Slides

    6/57

    Copyright @ 2007, John Jay King 6

    Major Features

    Major features of SQL Developer include: SQL Worksheet for writing/testing SQL, PL/SQL,

    and script files

    GUI object navigator allowing creation, deletion,and alteration of Oracle objects(yours and those you have access to)

    PL/SQL debugging including breakpoints andmanipulation of variables

    Multiple connections

    Explain Plan

  • 8/11/2019 OracleSQLDeveloper Slides

    7/57

    Copyright @ 2007, John Jay King 7

    Starting SQL Developer

    Execute the sqldeveloper.exe program

    (found in the unzipped sqldeveloper directory)

    Requires Java 1.5 (or later) for execution

    Excellent tutorials and help are part of the install and also available on

    Oracles website First execution asks if you want to migrate settings from earlier installation

    First execution also asks which file types to associate with SQL Developer

  • 8/11/2019 OracleSQLDeveloper Slides

    8/57

    Copyright @ 2007, John Jay King 8

    Initial Screen

    Upon entry the screen above appears Right-click on Connections and choose

    New Database Connection

  • 8/11/2019 OracleSQLDeveloper Slides

    9/57

    Copyright @ 2007, John Jay King 9

    New Connection Dialog

    Enter a connection name (you choose)

    Enter Userid and Password (if shop security permits)

    Enter Hostname, Port, and SID/Service name (get from DBA)

    Choose Test to test, then Connect

  • 8/11/2019 OracleSQLDeveloper Slides

    10/57

    Copyright @ 2007, John Jay King 10

    SQL Developer Options

    After logging in to a connection, SQL Developer shows three subpanels: Expandable list of the objects associated with the connected Schema/Userid

    SQL Worksheet

    Results area

  • 8/11/2019 OracleSQLDeveloper Slides

    11/57

    Copyright @ 2007, John Jay King 11

    SQL Worksheet

    The SQL Worksheet area has a dialog box where SQL may be keyed,viewed, and modified along with an expandable snippets panel providingcode fragments

    Note the pull-down showing the Connection that will be used to execute

    any SQL, PL/SQL, or script in the Worksheet

  • 8/11/2019 OracleSQLDeveloper Slides

    12/57

    Copyright @ 2007, John Jay King 12

    Testing SQL

    Enter SQL to test

    SQL Toolbar Execute Statement (F9)

    Run Script (F5)

    Commit (F2)

    Rollback (F3)

    Cancel (Ctrl+Q)

    SQL History (F9)

    Execute Explain Plan (F6)

    Clear (Ctrl+D)

    Current Connection

    pulldown(if no Connection isselected, other iconsare disabled/grayed-

    out)

  • 8/11/2019 OracleSQLDeveloper Slides

    13/57

    Copyright @ 2007, John Jay King 13

    Execute Statement If only one statement is in SQL Worksheet, select Execute Statement to

    run it

    If more than one statement is coded, position the cursor in the statementto be executed (or highlight the statement), then select Execute

    Statement

    To expand the SQL area to a full-screen; double-click theConnection tab (double-click again to shrink back)

  • 8/11/2019 OracleSQLDeveloper Slides

    14/57

    Copyright @ 2007, John Jay King 14

    Statement Execution Results

    The Results tab shows the results of a single-statementexecution

  • 8/11/2019 OracleSQLDeveloper Slides

    15/57

    Copyright @ 2007, John Jay King 15

    Snippets

    SQL Developer provides many snippets of code that may beincluded via drag & drop or code completion

  • 8/11/2019 OracleSQLDeveloper Slides

    16/57

    Copyright @ 2007, John Jay King 16

    Run Script

    If multiple SQL, PL/SQL, or script statements are to beexecuted together, select Run Script

    Results show up in the Script Output tab

  • 8/11/2019 OracleSQLDeveloper Slides

    17/57

    Copyright @ 2007, John Jay King 17

    Script Output

    When a script is executed, the results show up in the ScriptOutput tab

  • 8/11/2019 OracleSQLDeveloper Slides

    18/57

    Copyright @ 2007, John Jay King 18

    DBMS_OUTPUT.PUT_LINE

    If DBMS_OUTPUT.PUT_LINE was used in executed SQL(or a script) it will show up in the DBMS_OUTPUT tab

    DBMS_OUTPUT must be enabled prior to running your test

    (you may wish to increase the buffer size too)

  • 8/11/2019 OracleSQLDeveloper Slides

    19/57

    Copyright @ 2007, John Jay King 19

    OWA Output

    OWA output will show up in the OWA OUTPUT tab

    OWA OUTPUT must be enabled prior to running your test

  • 8/11/2019 OracleSQLDeveloper Slides

    20/57

    Copyright @ 2007, John Jay King 20

    Connection Objects

    The objects accessible to theUserid/Schema used to makea connection are availablefor browsing via the

    object navigator This navigator follows the

    usual pattern Expand

    Contract

    Objects available are thosebelonging to the connectionUserid/Schema (user_) andobjects available in some wayto the Userid/Schema (all_)

  • 8/11/2019 OracleSQLDeveloper Slides

    21/57

    Copyright @ 2007, John Jay King 21

    Browsing a Table

    Selecting an object (EMP table below) displays a multi-tabpanel containing various bits of information about the table

    Columns

    Data

    Indexes

    Constraints

    Grants

    Statistics

    Column Statistics

    Triggers

    Dependencies

    Details

    SQL

    (double-click Table Name (EMP) tab to expand/contract display)

  • 8/11/2019 OracleSQLDeveloper Slides

    22/57

    Copyright @ 2007, John Jay King 22

    Object Context Menu

    Right-click on an object to display itsContext Menu (table menu shown)

    The Edit option opens a dialog

    to view/modify the table definition Other options open additional

    menus allowing the user to issuecommands graphically rather thanfrom the command line

  • 8/11/2019 OracleSQLDeveloper Slides

    23/57

    Copyright @ 2007, John Jay King 23

    Table Edit Panel

  • 8/11/2019 OracleSQLDeveloper Slides

    24/57

    Copyright @ 2007, John Jay King 24

    Table Options

    Choose Table to see the list of table manipulation options

  • 8/11/2019 OracleSQLDeveloper Slides

    25/57

    Copyright @ 2007, John Jay King 25

    Export Options

    Choose Export Data to list table export options

  • 8/11/2019 OracleSQLDeveloper Slides

    26/57

    Copyright @ 2007, John Jay King 26

    Index Options

    Choose Index to create or modify indexes

  • 8/11/2019 OracleSQLDeveloper Slides

    27/57

    Copyright @ 2007, John Jay King 27

    Statistics Option

    Choose Statistics to use DBMS_STATS to gather statisticsor validate structures

    After choosing Gather Statistics a dialog appears allowing you tochange the sample size and view/copy the PL/SQL code

  • 8/11/2019 OracleSQLDeveloper Slides

    28/57

    Copyright @ 2007, John Jay King 28

    Constraints Option

    Choose Constraint to view or alter table constraints

  • 8/11/2019 OracleSQLDeveloper Slides

    29/57

    Copyright @ 2007, John Jay King 29

    Triggers Option

    Choose Triggers to build or alter table triggers(builds skeleton DDL that may be modified in SQL Workspace)

  • 8/11/2019 OracleSQLDeveloper Slides

    30/57

    Copyright @ 2007, John Jay King 30

    Object Type Context Menu

    Right-click on an object type to display its Context Menu

    Here is the Context Menu for Tables

  • 8/11/2019 OracleSQLDeveloper Slides

    31/57

    Copyright @ 2007, John Jay King 31

    Create Table (Simple)

    Choose Create Tableto display a panel forcreating a standardtable

    Choose Add Columnor Remove Columnas desired

  • 8/11/2019 OracleSQLDeveloper Slides

    32/57

    Copyright @ 2007, John Jay King 32

    Create Table (Advanced)

    Choose Create Tableto display a panel forcreating a standardtable, then mark theAdvanced box to

    display other optionsincluding: External tables

    IOT

    Global TemporaryTable

    (panel changes foreach table type)

  • 8/11/2019 OracleSQLDeveloper Slides

    33/57

    O h U S ff

  • 8/11/2019 OracleSQLDeveloper Slides

    34/57

    Copyright @ 2007, John Jay King 34

    Other Users Stuff

    At the bottom of the objectnavigator, the Other Usersoption lists the Userid/Schema

    names that have one or moreobjects available to you

    Expand a Userid/Schema to seethe objects exposed to you

    St d PL/SQL

  • 8/11/2019 OracleSQLDeveloper Slides

    35/57

    Copyright @ 2007, John Jay King 35

    Stored PL/SQL

    As you might imagine, selecting Packages, Procedures,Functions, or Triggers allows you to display and/or alterexisting stored PL/SQL

    Context menus for each type of stored PL/SQL allow you tocreate new objects using the same paint by the numbersapproach used for Tables and Materialized Views

    S l t E i ti PL/SQL

  • 8/11/2019 OracleSQLDeveloper Slides

    36/57

    Copyright @ 2007, John Jay King 36

    Select Existing PL/SQL

    PL/SQL C t t M

  • 8/11/2019 OracleSQLDeveloper Slides

    37/57

    Copyright @ 2007, John Jay King 37

    PL/SQL Context Menu

    Right-Click on a PL/SQL object to display the followingcontext menu

  • 8/11/2019 OracleSQLDeveloper Slides

    38/57

  • 8/11/2019 OracleSQLDeveloper Slides

    39/57

    Debugging Run Dialog

  • 8/11/2019 OracleSQLDeveloper Slides

    40/57

    Copyright @ 2007, John Jay King 40

    Debugging Run Dialog

    The debugging Runoption creates an

    anonymous PL/SQL totest the selectedPL/SQL

    Parameter values are

    initially set to null soyou must provide thevalues you wish to test

    Debugging Display

  • 8/11/2019 OracleSQLDeveloper Slides

    41/57

    Copyright @ 2007, John Jay King 41

    Debugging Display

    Debug Subpanels

  • 8/11/2019 OracleSQLDeveloper Slides

    42/57

    Copyright @ 2007, John Jay King 42

    Debug Subpanels

    The debugging pane shows four importantsubpanels Breakpoints Displays breakpoints,

    context menu allowsnew breakpoints

    Smart Data Displays breakpoint variables

    (double-click value to alter) Data Displays all variables

    (double-click value to alter)

    Watches Displays or add "watches"

    Debug Menu

  • 8/11/2019 OracleSQLDeveloper Slides

    43/57

    Copyright @ 2007, John Jay King 43

    Debug Menu

    When editing or testing PL/SQL compiledfor debugging, the Debug menu optionappears

    Debugging Icons

  • 8/11/2019 OracleSQLDeveloper Slides

    44/57

    Copyright @ 2007, John Jay King 44

    Debugging Icons

    The Debugging tab provides a set of icons for controllingthe debug session

    Find Execution Point

    Resume

    Step Over

    Step Into Step to End of Method

    Pause

    Terminate Garbage Collection

  • 8/11/2019 OracleSQLDeveloper Slides

    45/57

    Data Modification

  • 8/11/2019 OracleSQLDeveloper Slides

    46/57

    Copyright @ 2007, John Jay King 46

    Data Modification

    Smart Data and Data panels allowviewing and/or alteration of values

    Double-click on a variables valueto display the alteration dialog

    Data Context

  • 8/11/2019 OracleSQLDeveloper Slides

    47/57

    Copyright @ 2007, John Jay King 47

    Data Context

    Instead of double-clicking on a data item, right-click to displaythe context menu

    Explain Plan

  • 8/11/2019 OracleSQLDeveloper Slides

    48/57

    Copyright @ 2007, John Jay King 48

    Explain Plan

    Use the Explain Plan icon or menu option to showthe proposed plan for a statement

    Built-In Reports

  • 8/11/2019 OracleSQLDeveloper Slides

    49/57

    Copyright @ 2007, John Jay King 49

    Built In Reports

    Oracle has built many ofthe types of reportsroutinely created from the

    catalog and V$ views intoSQL Developer Some DBA-oriented

    Some Developer-oriented Before you create your

    own reports, look to see

    whats available here first!

    Tons of Docs

  • 8/11/2019 OracleSQLDeveloper Slides

    50/57

    Copyright @ 2007, John Jay King 50

    Tons of Docs

    SQL Developer provides: Great context-oriented help (F1 key)

    Via the Help menu a comprehensive discussion ofSQL Developer

    Via the Help menu excellent references for SQLand PL/SQL

    Online documentation and support via the Oraclewebsite and many blogs

  • 8/11/2019 OracleSQLDeveloper Slides

    51/57

    Should Others Worry?

  • 8/11/2019 OracleSQLDeveloper Slides

    52/57

    Copyright @ 2007, John Jay King 52

    Should Others Worry?

    Free products should worry lots, Oracles SQL Developer: Supports current SQL & PL/SQL Provides unlimited free licenses Licenses do not die periodically Supports many features usually

    available only in pay for products:e.g. PL/SQL debugging, custom

    reporting, and more!

    The better pay-for products are probably safe for a while

    This product needs a logo!

    Wrapping it all Up

  • 8/11/2019 OracleSQLDeveloper Slides

    53/57

    Copyright @ 2007, John Jay King 53

    pp g p

    Oracles SQL Developer tool is an excellentaddition to every Oracle DBA or Developers toolbelt

    If Oracle keeps improving this product and keeps itfree -- it may put some other products out ofbusiness

  • 8/11/2019 OracleSQLDeveloper Slides

    54/57

    Copyright @ 2007, John Jay King 54

    Training Days 2008

    Mark your calendar for:

    February 13-14, 2008!

  • 8/11/2019 OracleSQLDeveloper Slides

    55/57

    Copyright @ 2007, John Jay King 55For more information visi t www.odtug.com or call 910-452-7444

    ODTUG KaleidoscopeJune 18 21, 2007

    Pre-conference Hands-on Training - June 16 17

    Hilton Daytona Beach Oceanfront Resort

    Daytona, FloridaWOW-Wide Open World, Wide Open Web!

    IOUG-Collaborate 2008

  • 8/11/2019 OracleSQLDeveloper Slides

    56/57

    Copyright @ 2007, John Jay King 56

    IOUG-Collaborate in Denver, April 2008

    Start Planning for Next Year!

    Please fil l out session Evaluations

  • 8/11/2019 OracleSQLDeveloper Slides

    57/57

    Copyright @ 2007, John Jay King 57

    Introducing Oracles SQL Developer

    To contact the author:John King

    King Training Resources

    6341 South Williams Street

    Littleton, CO 80121-2627 USA

    1.800.252.0652 - 1.303.798.5727

    Email:[email protected]

    Todays slides and examples are on the web:Todays slides and examples are on the web:http://www.kingtraining.com

    Thanks for your attention!