CERN IT Department CH-1211 Genève 23 Switzerland www.cern.ch/i t Database tools for developers Jacek Wojcieszuk, IT-DM Database Developers’ Workshop July.

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

The Architecture of Oracle
DB2 Tools Pertemuan 3 Matakuliah: T0413 Tahun: 2009.
Copyright © 2011 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are trademarks of Accenture. SQL Workshop Day 4.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
MSc IT UFIE8K-10-M Data Management Prakash Chatterjee Room 3P16
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
Oracle SQL*plus John Ortiz. Lecture 10SQL: Overview2 Overview  SQL: Structured Query Language, pronounced S. Q. L. or sequel.  A standard language for.
Gavin Payne Oracle for SQL Server DBAs. Why Oracle? Installation Physical Storage Backup and Recovery 20 slides in 50 minutes Inside the database Programmability.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
CERN IT Department CH-1211 Genève 23 Switzerland t Streams new features in 11g Zbigniew Baranowski.
Talend 5.4 Architecture Adam Pemble Talend Professional Services.
Oracle Developer Tools for Visual Studio.NET Christian Shay Principal Product Manager Oracle Corporation Prerequisites for presentation:
Oracle Developer Tools for Visual Studio.NET Curtis Rempe.
SQL Tuning Ohio Oracle User’s Group October 2002 © Copyright, Kris T. Mason, 2002.
CERN IT Department CH-1211 Geneva 23 Switzerland t Mariusz Piorkowski, Dr. Andrea Valassi, Sebastien Ponce, Zbigniew Baranowski, Jose Carlos.
6/1/2001 Supplementing Aleph Reports Using The Crystal Reports Web Component Server Presented by Bob Gerrity Head.
1 INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team OracleWorld Session
Oracle for Software Developers. What is a relational database? Data is represented as a set of two- dimensional tables. (rows and columns) One or more.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Oracle9 i JDeveloper for Database Developers and DBAs Brian Fry Principal Product Manager Oracle JDeveloper Oracle Corporation.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Chapter 6 Additional Database Objects
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Chapter 2: SQL – The Basics Objectives: 1.The SQL execution environment 2.SELECT statement 3.SQL Developer & SQL*Plus.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 9: Database Administration Jerry Post Copyright © 2003.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
Using Procedures & Functions Oracle Database PL/SQL 10g Programming Chapter 9.
CERN - IT Department CH-1211 Genève 23 Switzerland t DB Development Tools Benthic SQL Developer Application Express WLCG Service Reliability.
Mark Inman U.S. Navy (Naval Sea Logistics Center) Session #213 Analytic SQL for Beginners.
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
6/1/2001 Supplementing Aleph Reports Using The Crystal Reports Web Component Server Presented by Bob Gerrity Head.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
© 2006 Altova GmbH. All Rights Reserved. Altova ® Product Line Overview.
SQLXPress Make the most of NonStop SQL with a comprehensive set of easy to use productivity tools.
CERN IT Department CH-1211 Genève 23 Switzerland t DBA Experience in a multiple RAC environment DM Technical Meeting, Feb 2008 Miguel Anjo.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Commercial RDBMSs: Office Access and Oracle Pertemuan 13 Matakuliah: M0564 /Pengantar Sistem Basis Data Tahun : 2008.
CHAPTER 10 PHP MySQL Database
Introduction to Teradata Client Tools. 2 Introduction to Teradata SQL  OBJECTIVES :  Teradata Product Components.  Accessing Teradata – Database /
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
15 Copyright © 2004, Oracle. All rights reserved. Debugging Triggers.
Level 1-2 Trigger Data Base development Current status and overview Myron Campbell, Alexei Varganov, Stephen Miller University of Michigan August 17, 2000.
LAB: Web-scale Data Management on a Cloud Lab 11. Query Execution Plan 2011/05/27.
E Copyright © 2006, Oracle. All rights reserved. Using SQL Developer.
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
SQLcl: A Modern Command Line Interface to the Oracle Database
Database System Concepts and Architecture
ISC440: Web Programming 2 Server-side Scripting PHP 3
Using JDeveloper.
Tutorial 6 PHP & MySQL Li Xu
Presentation transcript:

CERN IT Department CH-1211 Genève 23 Switzerland t Database tools for developers Jacek Wojcieszuk, IT-DM Database Developers’ Workshop July 8 th, 2008

CERN IT Department CH-1211 Genève 23 Switzerland t Outline Most useful tools: –SQL*Plus –Benthic –SQL Developer –JDeveloper –Session Manager –Weekly reports Typical use-cases: –My query is slow –My application is slower than it used to –My DML statement got stuck

CERN IT Department CH-1211 Genève 23 Switzerland t Most useful tools

CERN IT Department CH-1211 Genève 23 Switzerland t SQL*Plus SQL*Plus is the primary tool to access an Oracle database –You can be sure to find it wherever Oracle software is installed It is a traditional line-mode tool to execute SQL: –Scripting and formatting facilities Can generate quite good reports –Some SQL optimization functionality But –Formatting the output is not an easy task –No command history on Unix Use rlwrap tool to make SQL*Plus more user friendly

CERN IT Department CH-1211 Genève 23 Switzerland t Setting up SQL*plus To start using SQL*Plus from lxplus run: –For tcsh: source /afs/cern.ch/project/oracle/script/setoraenv.csh –s client_ver –For bash: source afs/cern.ch/project/oracle/script/setoraenv.sh –s client_ver Some useful formating commands: –set linesize xxx – number of characters per line –set pagesize xxx – number of rows per page –col column_name for... – specified the way contents of the column are printed e.g: col name for a50; col salary for –set long xxx – number of characters printed for LOB columns If you create login.sql script, it will be run automatically when you connect with SQL*Plus –Use SQLPATH environment variable to indicate the patch to your SQL scripts.

CERN IT Department CH-1211 Genève 23 Switzerland t Checking query execution plans with SQL*Plus SQL*Plus can be used for SQL debugging purposes. It can provide information on: –Actual query execution plan –Query execution statistics SET AUTOTRACE TRACEONLY Comprehensive SQL*Plus documentation can be found here: documentation.web.cern.ch/oracle- documentation/10gr2doc/server.102/b14357 /toc.htmhttp://oracle- documentation.web.cern.ch/oracle- documentation/10gr2doc/server.102/b14357 /toc.htm

CERN IT Department CH-1211 Genève 23 Switzerland t Example SQL> set autotrace traceonly SQL> var :b1 number; SQL> exec :b1 := 3423 SQL> SELECT file_state FROM lcg_fts_prod.t_file WHERE file_id = :B1; | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | | 0 | SELECT STATEMENT | | 1 | 11 | 1 (0)| 00:00:01 | | 1 | TABLE ACCESS BY INDEX ROWID| T_FILE | 1 | 11 | 1 (0)| 00:00:01 | |* 2 | INDEX UNIQUE SCAN | FILE_FILE_ID_PK | 1 | | 0 (0)| 00:00:01 | Predicate Information (identified by operation id): access("FILE_ID“=TO_NUMBER(:B1)) Statistics recursive calls 0 db block gets 1 consistent gets 1 physical reads 0 redo size 279 bytes sent via SQL*Net to client 385 bytes received via SQL*Net from client 1 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 0 rows processed

CERN IT Department CH-1211 Genève 23 Switzerland t Query execution statistics StatisticsMeaning Recursive callsnumber of SQL statements executed on behalf of the query Db block gets, consistent getsnumber of blocks read from the cache Physical readsnumber of physical reads from datafiles into the cache Redo sizeTotal amount of redo generated Bytes sent/received via SQL*Net to/from client amount of data sent between the client to the server SQL*Net roundtrips to/from client total number of messages exchanged between the client and the server Sorts (memory)sorts done in the sessions memory Sorts (disk)sorts done on disk (in the temporary tablespace) Rows processednumber of rows modified or returned by executed SQL statement

CERN IT Department CH-1211 Genève 23 Switzerland t Benthic Benthic applications provide GUI for writing queries, running scripts, developing PL/SQL code and browsing schema objects –Benthic Golden is a querying and scripting tool –Benthic PLEdit is PL/SQL code editor –Benthic GoldView is a schema structure browser Benthic is available for Windows OS only Benthic can be downloaded from It is commercial software, the license keys are located at DFS, can be used by anybody on the CERN site

CERN IT Department CH-1211 Genève 23 Switzerland t Benthic Golden Benthic Golden is an ad-hoc query and SQL scripting tool: –Allows editing and running multiple scripts simultaneously –Supports SQL*Plus variable prompting, bind variables and calling external scripts with parameter passing. –Supports SQL*Plus specific command EXEC, DESC and CONNECT. –Provides script and statement’s timing –Provides access to query execution plans –Contains various export/import options. –Allows editing of single table result sets –Supports colored syntax highlighting –Includes SQL builder tool – to quickly assemble desired SQL statement

CERN IT Department CH-1211 Genève 23 Switzerland t Benthic PLEdit Benthic PLEdit facilitates editing and compiling of PL/SQL code modules (stored procedures, functions, packages, triggers) –Supports editing of multiple modules simultaneously –Simplifies resolving compilation errors –Supports colored syntax highlighting –Includes SQL builder – for easier assembly of PL/SQL blocks –Includes some stored PL/SQL code management tools –Shows dependencies visually –Misses PL/SQL debugger

CERN IT Department CH-1211 Genève 23 Switzerland t Benthic GoldView GoldView is a schema structure browser –Offers a fast and easy way to find an information about the objects in a schema –It is a read-only tool Displays objects in all accessible schemas Shows detailed information on tables, views, triggers, indexes, synonyms, sequences, types and code modules Shows structure, keys, constraints, stored code, DDL and more!

CERN IT Department CH-1211 Genève 23 Switzerland t Benthic

CERN IT Department CH-1211 Genève 23 Switzerland t Oracle SQL Developer Oracle SQL Developer is a powerful GUI for database interaction and development. It has all the Benthic functionality and in addition: –Visual Query builder –Full PL/SQL debugging –Required DEBUG CONNECT SESSION and DEBUG ANY PROCEDURE privs –Pre-defined and user-defined reports –Full integration with CVS and Subversion –Integrated tool for migrating data from 3rd party database engines like MySQL, Microsoft SQL Server, Sybase Adaptive Server, or Microsoft Access Oracle SQL Developer is a Java-based application so it is fully portable between different platforms It is a free tool, can be downloaded from

CERN IT Department CH-1211 Genève 23 Switzerland t SQL Developer

CERN IT Department CH-1211 Genève 23 Switzerland t JDeveloper Complete and integrated Java, XML and Web Services development environment –Build/debug/tune/deploy –Full J2EE 1.4 and EJB 3.0 support (as of ) Very good integration with Oracle Database Server –Very similar functionality to what SQL Developer offers Good integration with several application servers (Oracle AS, JBoss, Tomcat, WebLogic) JDeveloper is a Java-based application

CERN IT Department CH-1211 Genève 23 Switzerland t JDeveloper Wizards to create your Servlets, JSP, EJB, WEB Services, XML… WYSIWYG editor for web pages UML diagrammer Support for Open Source projects like Junit, Apache Ant, Struts Support for CVS And all the functionality of SQL Developer... and much more

CERN IT Department CH-1211 Genève 23 Switzerland t JDeveloper

CERN IT Department CH-1211 Genève 23 Switzerland t Session Manager Home-grown tool to monitor and manage applications’ database sessions: Manager Installed and configured for all development, integration and production databases Offers a convenient way to: –Check who is connected –See database sessions’ details –Check what sessions are doing/waiting for –Investigate on locking conditions –Kill problematic sessions

CERN IT Department CH-1211 Genève 23 Switzerland t Session Manager

CERN IT Department CH-1211 Genève 23 Switzerland t Weekly reports Another home-grown tool Provides aggregated information on applications’ activity –Top resource consumers –Hourly applications’ activity stats Signalizes potential problems –Repeting queries without bind variables –Expiring/expired passwords –Invalid objects –Failing jobs –Fragmented tables –Connection errors

CERN IT Department CH-1211 Genève 23 Switzerland t Typical use-cases

CERN IT Department CH-1211 Genève 23 Switzerland t My query is slow SQL*Plus –Connect to the databse –Enable autotrace set autotrace traceonly –Run the query: keep bind variables –Study the execution plan, look for costly steps: TABEL ACCESS FULL usually means missing index MERGE JOIN CARTESIAN usually means missing WHERE predicates INDEX FULL SCAN operations also should be avoided –Check for existing indices and create missing ones: select * from user_ind_columns where table_name=‘name_of_the_table’;

CERN IT Department CH-1211 Genève 23 Switzerland t My query is slow (2) –Check if object statistics were collected recently, if not collect them: select table_name, last_analyzed from user_tables where table_name=‘name_of_the_table'; select index_name, last_analyzed from user_indexes where table_name=' name_of_the_table'; exec dbms_stats.gather_table_stats(user, ‘name_of_the_table’) exec dbms_stats.gather_index_stats(user, ' name_of_the_index') –Review query execution statistics returned by autotrace: Pay special attention to ‘recursive calls’, ‘physical reads’, ‘SQL*Net roundtrips’ and ‘sorts (disk)’ Or do the same with SQL Developer or Benthic

CERN IT Department CH-1211 Genève 23 Switzerland t My application is slower than it used to be If the application runs on a shared database have a look at the Weekly Report: –Check the load generated by your and other applications –Check the number of sessions –Compare with the previous Weekly Reports Check when application objects where last analyzed –Collect statistics if needed: exec dbms_stats.gather_schema_stats(null) Check if there were any recent changes of the schema and objects: select object_name, object_type, created, last_ddl_time from user_objects where created>sysdate-5 or last_ddl_time>sysdate- 5; Review execution plans of most important queries

CERN IT Department CH-1211 Genève 23 Switzerland t My DML statement got stuck This most likely means wait for resouces locked by other sessions –Go to the Session Manager –Find the session keeping resource your DML is waiting for –Either commit, rollback or kill the blocking session –Review the application to avoid similar problems in the future.

CERN IT Department CH-1211 Genève 23 Switzerland t Q&A