SQL Monitoring using SQL Queries

Hi
I am using Oracle 10 g DB. I have an application which has Oracle as DB. Its a multiuser application. During the testing of one of the page we found that saving couple of records takes huge time (50-60 seconds). I dont have access to the logic written in application code to know which all queries gets executed when user click on save button.
I know that there is SQL Monitoring available in OEM why which you can find out the queries which got executed and also the execution time for those queries.
However I dont have OEM access.
Can you please let me know teh set of queries which probably will use few of teh V$ data dictionary views and provide me the same details as generated in the Monitoting report generated by OEM ?
I want to see all the queries which got executed in last defined time (say 10 mins, 1 hr etc) , same way as it is done in OEM and not just the last sql.
TIA
Regards
Arun

Hi,
I recommend you to install STATSPACK - it's a free tool that can be used instead of the Automatic Workload Repository (that is used in OEM).
This tool creates snapshots of V$ views in defined time period, so it enables you to see long runing queries in history.
If I were you I would run SQL trace just before the problematic part and then stop it just as it has finished. It would be better to run trace only for the problematic session or module - not for the whole database. SQL trace generates a file with all the executed queries, explain plans, stats, ...
In extreme case just create copy of v$sql before and after the problematic part and compare them (new sql_id, elapsed_time delta, ...)

Similar Messages

  • Tuning sql automatic using SQL Tuning Advisor Tool

    I need to work on Automatic sql tuning..
    Please give suggestion for the below
    1) I have installed oracle11g client version. confirm this is okey for my project. because i heard we should have oracle enterprise edition for this.
    2) User with only sys privelage can work on this automatic sql tuning using sql tuning advisior tool.
    Please clarify above suggestions.
    ALso suggest me best way to proceed further
    S

    Sunny kichloo wrote:
    This docs will help
    http://www.oracle-base.com/articles/10g/automatic-sql-tuning-10g.php
    http://www.oracle-base.com/articles/11g/automatic-sql-tuning-11gr1.php
    Thanks for your link. i already seen this link.
    Could u pls answer my question on above with " Yes" or "No"
    Kindly reply
    S

  • Demonstrating PL/SQL Functions Using SQL Developer

    Good afternoon,
    I'm starting to write some PL/SQL functions to replace some of the SQL that I use most frequently.  A couple of very simple examples would be:
    create or replace function func_test (p_1 number) return number
    is
    x number;
    y number;
    begin
    x :=1;
    y :=2;
    return p_1 * x * y;
    end func_test;
    create or replace function func_test2 (p_1 varchar2) return varchar2
    is
    return_val varchar2(10);
    begin
    select p_1 into return_val from dual;
    return return_val;
    end func_test2;
    However, at my workplace I haven't been granted create function privileges yet until I can demonstrate some examples, which is understandable.
    For the time being, without these privileges, is there a way I can build/test functions in principle locally using SQL Developer without the need to write the functions to our database? I.e. can I demonstrate the above in SQL Developer, but without wrapping in create or replace syntax?
    I hope this isn't too vague.
    Using Oracle 11gR2 (not logged in to workplace database at the moment for specific version no.)
    SQL Developer 3.4
    Thanks,
    TP

    sb92075 02-Nov-2013 19:12 (in response to TinyPenguin)
    populating test DB with data is a solvable problem.
    You don't need client data to test code (functions).
    You only need sample test data; which generally is less than a few dozen records per table.
    Absolutely, of course. Our client database is pretty messy though, and includes data prior to the implementation of more recent business rules that I need to take account of. Useful perspective though, thanks.
    rp0428 02-Nov-2013 19:14 (in response to TinyPenguin)
    Sure, but then I wouldn't have access to all the data in our client database to test functions under various circumstances.
    Huh? Why not? It's your database so what keeps you from creating a database link to your client database where all the data is?
    Also, I suppose it's not good practice to constantly write/replace/drop functions to/from a database when developing them? Better to test the function in principle and then write to the database?
    Huh? Why not? What you think a dev database is for if not for development?
    Based on your two posts so far in this thread it's understandable why they don't want to give you privileges yet. Those sample 'functions' you posted are NOT a good use for functions.
    In sql developer you can just create and save the queries you use most often. There is no need to create functions for that.
    But if you do need an anonymous function now and then just create one using sql*plus syntax:
    Our IT department are pretty sensitive about how they allow access, even to the dev environment. As you've identified, I'm not naturally a programmer so the option to play around with the data to develop some representative examples about how we can simplify and devolve SQL reporting to more members of staff is useful to me. I just wrote those two function quickly for the purpose of posting some sample data, which I thought would be helpful. Thanks for illustrating how to return their output using an anonymous block.
    FrankKulash 02-Nov-2013 19:13 (in response to TinyPenguin)
    Hi,
    The obvious solution is to get the privileges.  If your employer really wants you to do something, they need to give you the necessary privileges to do it.  It's silly for them to tell you to do something, but refuse to let you do it.
    Failing that, you can install Oracle on your own machine, as suggested above.  It's free and legitimate if you're only using it for learning and developing.  Oracle Express Edition is very easy to install.
    As a last resort, you can write functions and procedures that are local to an anonymous block, like this:
    Thanks Frank. Yeah I'm going to speak with our DBA next week about privileges. I've got XE/SQL Developer installed on my own computer - I wrote those sample functions using them - I just wasn't sure how to call/return anonymous blocks as both you and rp identified to develop at work as an interim solution.
    Thanks a lot All,
    TP.

  • Dynamic SQL without using SQL

    I have a variable that contains a formula, eg.
    V_FORMULA varchar2(200) := '5 * 50 + 200';
    I want to assign the result of the formula into another variable, without using a DB call with SQL.
    eg.
    V_RESULT number;
    V_RESULT := DBMS_surprise_package(V_FORMULA);
    I want V_RESULT to be 450 after the statement is executed.
    Is that possible?? Is there such a package in PLSQL?
    I think the Forms NAME_IN package did something similar.

    970779 wrote:
    I guess I'll just have to rewrite it using execute immediate with bind variables to stop the shared pool getting filled up with thousands of these statements, since none of you have a non-db solution.Write your own if the expressions are simple enough...
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    l_formula varchar2(200) := '5 * 50 + 200';
      3    l_result  number := 0;
      4    tok       varchar2(100);
      5    op        varchar2(100);
      6    function get_token(str in out varchar2) return varchar2 is
      7    begin
      8      tok := trim(regexp_substr(str,'^[0-9]+|[^0-9]+'));
      9      str := trim(regexp_replace(str,'^([0-9]+|[^0-9]+)'));
    10      return tok;
    11    end;
    12  begin
    13    loop
    14      tok := get_token(l_formula);
    15      exit when tok is null;
    16      if tok in ('*','+','-','/') then
    17        op := tok;
    18      else
    19        case op when '*' then l_result := l_result * to_number(tok);
    20                when '+' then l_result := l_result + to_number(tok);
    21                when '-' then l_result := l_result - to_number(tok);
    22                when '/' then l_result := l_result / to_number(tok);
    23        else l_result := to_number(tok);
    24        end case;
    25      end if;
    26    end loop;
    27    dbms_output.put_line(l_result);
    28* end;
    SQL> /
    450
    PL/SQL procedure successfully completed.:D

  • Get the Last Value of Status Field from SQL TABLE using SQL 2008

    I have a table with Fields such as
    UploadstartTime, UploadEndtime, STATUS From TBLA.
    The STATUS Field, has values =7 and 11 are failed and 12 is SUCCESS. I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get STATUS For that record. How can I do that using 1 SQL Query?
    My current code is: The issue is
    select
      TBLNAME
    MaxUploadstarttime
    =
    max(UploadStartTime),
    MaxUploadEndtime
    =
    max(UpLoadEndTime),
         Status=max(status)
    from  DB.DBO.LOGTABLE
    p1

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed! Temporal
    data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I have a table with Fields such as <<
    Fields are not columns! There is no generic status in RDBMS. Putting “tbl-” in a table name is called tibbling and we make fun of people who do it (Google Phil Factor's humor columns. If you were polite is this what you wanted to post? 
    CREATE TABLE Something_Uploads
    (upload_source_name CHAR(15) NOT NULL,
     upload_start_timestamp DATETIME2(0) NOT NULL,
     PRIMARY KEY (upload_source_name, upload_start_timestamp),
     upload_end_timestamp DATETIME2(0),
     CHECK(upload_start_timestamp < upload_end_timestamp),
     upload_status INTEGER NOT NULL 
       CHECK (upload_status IN (7,11,12, ..))
    >> I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get upload_status For that record [sic]. How can I do that using 1 SQL Query?  <<
    Since you told us nothing and gave no sample data, want to correct this postign? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Sql loader using sql statement

    Hi All ,
    May i know any way used sql loader refer sql statement e.g "select a from test"
    import data into other table ?
    if you have any sample or link , please let me know , thanks a lot

    If you are using the database steps, the answer is yes. I've done it by creating a data source that uses the Microsoft Text Driver in the ODBC administrator. The Open Database step is then configured like any other ODBC database. In the .csv file, I have the first line define the column names (i.e. column1, column2) and the SQL statement I use is "SELECT * FROM junk.txt". I haven't tried anything with a WHERE clause but that should work as well.

  • How to access SQL server using SQL toolkit from LabVIEW

    I 'm using Labview SQL toolkit to read from data base
    it is Okay for dBase but for SQL server we couldn't
    as we could read only the numeric fields but no longer for character fields

    Check to see if the text fields are defined as nvarchar or nchar. If I remember right, the old toolkit had some problems with these data types.

  • Error while runing SQL Monitoring new OEM 11.1.0.7 feature

    I am running OEM Database control with the new 11g version, Oracle 11.1.0.7. I am trying to work with the new feature SQL Monitoring, but I am getting the following error:
    Loading data error:
    Did someone saw that feature actually working? I only saw it in the OOW Demo.
    I am getting the error both in Windows and Linux installations. Any idea why this error happen and how to overcome it?
    Best,
    Merav

    Hi Merav
    select version from v$timezone_file;
    VERSION
    4
    If you get 4 from that query use MetaLink Note 568125.1.
    Have you installed Database Vault ? that might be related to your issue.
    Can you please send us more details on the error?
    Would you please investigate also :
    -STATISTICS_LEVEL initialization parameter is either set to ALL or TYPICAL (the default value)
    -CONTROL_MANAGEMENT_PACK_ACCESS parameter must be set to DIAGNOSTIC+TUNING (the default value)
    Control also that :
    select /*+MONITOR*/ * from dba_objects;
    Please read that also:
    http://structureddata.org/2008/01/06/oracle-11g-real-time-sql-monitoring-using-dbms_sqltunereport_sql_monitor/
    Thanks
    Edited by: Hub on Nov 20, 2008 10:59 AM
    Edited by: Hub on Nov 20, 2008 11:01 AM

  • Why the SQL Monitor report do not display?

    Why the SQL Monitor report do not display?
    SQL> set serveroutput on
    SQL> variable my_rept CLOB;
    SQL> BEGIN
      2  :my_rept :=DBMS_SQLTUNE.REPORT_SQL_MONITOR();
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.93
    SQL> print :my_rept
    MY_REPT
    SQL Monitoring Report
    SQL>

    You can you hint /*+MONITOR*/, and then use this procedure to display the monitor report:
    SQL> select /*+ monitor */ *from hr.employees where salary>10000;
    SQL> variable my_rept CLOB;
    SQL> BEGIN
      2  :my_rept :=DBMS_SQLTUNE.REPORT_SQL_MONITOR();
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.21
    SQL> print :my_rept
    MY_REPT
    SQL Monitoring Report
    SQL Text
    select /*+ monitor */ *from hr.employees where salary>10000
    Global Information
    Status              :  DONE (ALL ROWS)
    Instance ID         :  1
    Session ID          :  170
    MY_REPT
    SQL ID              :  4tj5p5m6qrkmp
    SQL Execution ID    :  16777216
    Plan Hash Value     :  1445457117
    Execution Started   :  04/30/2010 10:51:23
    First Refresh Time  :  04/30/2010 10:51:23
    Last Refresh Time   :  04/30/2010 10:51:23
    | Elapsed |  Other   | Fetch | Buffer |
    | Time(s) | Waits(s) | Calls |  Gets  |
    ...

  • External Content Type Using SQL

    I’m trying to setup an external content type using just SharePoint designer. 
    I will need to be able to show other individual within the organization how to create these content types so getting it to work with just SharePoint designer is the goal. 
    No Programming involved please.
    Abbreviated Steps I have taken
    The account that we will use to connect to 2012 SQL server has been created and the correct permissions have been granted to the database.
    The secure store service account has been created and setup
    Go into SharePoint designer 2010 to create the external content type using
    Impersonated Custom Identity and inputting in the username and password that was setup in SQL server and added to the secure store credentials for the secure store service. I receive error cannot login with the provided credentials.
    I have searched the web trying to correct this issue and cannot find anything that will assist. 
    Everything either shows you to connect with windows identity (not an option) or breezes past this issue.

    To connect as an impersonated custom identity you have to:
    1. Be sure SQL login on SQL Server uses SQL authentication
    (not Windows one!)
    2. Create target application in Secure Store with:
      a. Target app type - "Group"
      b. Field types - Username and
    Password
    3. Don't forget to grant required permission to a new Traget Application.
    Here is a good guide (look at steps 4-8):
    http://lightningtools.com/bcs_meta_man/sharepoint-2010-secure-store-service-and-oracle/

  • Error message using SQL import and Export Wizard with Excel spread sheet

    I am trying to import an Excel spreadsheet using the Import export wizard that is provided with SQL 2014.  
    Everything seems to set up OK but then when I go to do the transfer "error message" comes up saying:
    External Table is not in the expected format.(Microsoft Jet Database Engine).   
    This is a spreadsheet and there is no database, that is why I want to import it into a database!!  So the reference to JET is a tad disappointing.
    So why the error and how do I fix the problem?
    As there are over 100 variables in the spread sheet rows, it would be great to have this automatically create the database and populate the fields.
    I am using SQL 2014  Express and Office Excel 2013.
    Thank you in  advance for taking the time to read this, and hopefully sheading some light on the issue.

    Hi AWlcurrent,
    When import a .xlsx file to SQL Server using SQL Server Import and Export Wizard, you see a “External Table is not in the expected format.(Microsoft Jet Database Engine).” error message. This error message seems that the Microsoft JET Database Engine is
    unable to handle something that is contained in the file.
    So please make sure there is no unsupported content in the Excel file. Alternatively, we can use ‘Microsoft Excel’ as the Data Source, then Select ‘Microsoft Excel 2007’ as the Excel version to import the excel file.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • How to connect java database using sql....????

    Hey guys,
    I am a novice in Java Programming.Could someone help me out in connecting to sql.Im using Sql 2000 edition.
    Thanks.

    Google for "Sun JDBC tutorial" and go through it.
    %

  • Typing SQL in an SQL field in CR always generates error message

    Hello,
    I am working with Crystal Reports 2008 (CR Developer, Version 12.1.0.892) Product Type: Full. This software is locally installed on my working computer, running on a Windows 7 system. The database I use is Progress version 10.2B01. I connect through an ODBC connection to the database.
    As a software developer, developing reports in CR is not my primary task, yet I have done some good work up to this date in Crystal. I have only one major problem:
    I can not create any SQL fields in the report, e.g. despite how I write the expression in the SQL language, it would not compile. The following error message appears: (I couldn't copy the error dialog into this message)
    Error in compiling SQL Expression:
    Database Connector Error: 'DAO Error Code: 0x03
    Source: DAO.Database
    Description: Syntaxerror in queryexpression 'SELECT
       Customer.'Customer Name".'.
    To make it as easy and basic as possible, I have tried the above excercise using C:\Program Files\Business Objects\Crystal Reports 12.0\Samples\En\DB\xtreme.mdb database. The SQL just won't work! Not even the most basic SELECT. I have really tried and searched Crystal Reports Online Help. A college of mine gets the same error message.
    I would be greatful if someone could give me a hint, what could be wrong. You may post me a simple SQL query which works together with the xtreme.mdb database. (Drawing fields with the mouse onto the report creates nice output - but I really want to accomplish output by creating and inserting an SQL field using SQL!).
    Greetings from Karlstad in Sweden!  Ivo K. (@inport.com)

    Hi
    Try to see what all tables are accessed by data source. and see if there is any lock on that..
    If some other job is accessing that table - then there might be lock on that which is causing failure..
    1) Try looking at ST22 dump also..
    2) Try to do RSA3 in R/3 and if see if its is fetching any records or not..
    Hoep it helps
    --SA

  • Capture @@ROWCOUNT for all QUERIES using SQL AUDIT

    I have a requirement where the customer wants to audit all SELECT queries made to a specific table  and also capture
    "No of rows returned" for these queries made to the table. I was able to capture various SELECT queries happening in the database /Table using SQL AUDIT, Wondering if anybody can suggest how to capture no of rows affected along
    with it, Since we have numerous stored procedures in the system we wont be able to modify existing stored procedures.

    Good day Vish_SQL,
    There are several options that you can use, which fit different cases. for example:
    1. Using extended events (My prefered solution for most cases like this)
    2. Using profiler (older option)
    3. Using view (with the same name as the table, and rename the tables related to the issue) instead of the original table, adding to the view a simple function or SP (CLR for example). the function return the
    column value, but behind the  screen write information to another table. It is a very rare case that you need this option, and I can't recommend
    it.
    4. using applications like GREENSQL which give another level between the application and the SQL Server. The users connect to the server but the server do not listen to remote connection but the external app dose.
    In this case the app get the query and send it t the server (after security or monitoring if you need)
    * it was much simpler if you want to monitor delete, update, or insert for example, since in those cases you could work with AFTER trigger.
    ** I highly recommend you to monitor the application that connect to the SQL Server rather than the SQL Server. if you can.
    Check this:
    http://solutioncenter.apexsql.com/auditing-select-statements-on-sql-server/
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • How to use SQL functions in the queries

    hey guys i wanna know how to use SQL functions in the queries is it possible or not .

    Hi,
    Wat exactly that set values are?
    those from sql query?
    How to use count():
    The COUNT() function returns the number of rows that matches a specified criteria.
    SQL COUNT(column_name) Syntax
    The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column:
    SELECT COUNT(column_name) FROM table_name
    SQL COUNT(*) Syntax
    The COUNT(*) function returns the number of records in a table:
    SELECT COUNT(*) FROM table_name
    SQL COUNT(DISTINCT column_name) Syntax
    The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column:
    SELECT COUNT(DISTINCT column_name) FROM table_name
    The IN function helps reduce the need to use multiple OR conditions.
    The syntax for the IN function is:
    SELECT columns
    FROM tables
    WHERE column1 in (value1, value2, .... value_n);

Maybe you are looking for

  • If I can buy apps on the iPhone 4, and then I want the same apps I bought it in the new iPhone that I have. Can or not?

    If I can buy apps on the iPhone 4, and then I want the same apps I bought it in the new iPhone that I have. Can or not?

  • Is it possible to call web services in adobe connect application?

    I have facing one security issue  in adobe connect Error Description is "Security error accessing url Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://xxxxxx/WebService.asmx?wsdl)" Is it possible to ca

  • Adapter Modules - EJB3

    Hi all, why can't EJB3 compliant Session Beans be used in PI7.1 instead of the J2EE 1.4 Session Beans. It's much easier to develop EJB3 Session Bean, as you can use annotations and dependency injection. PI 7.1 is running on top of a JavaEE5 compliant

  • Can not see title bar

    I am not able to see the title bar. I have Firefox 16.01. I have Android 4.03. This is a fresh install. Has not been visible since installation. I can not find an option to turn this on or off in the settings.

  • Terminal Stops Echoing Input

    I've been using Terminal (OS X Lion) to ssh into a Linux server (itself running in a virtual machine) to do development work, and have been doing this on this system for the past half year. A few days ago my Mac crashed and I had to restore it (and t