Regarding query to be tunedd in database

how can i find in my database that which are the queries that needed ...which output of awr shows that..
i need to find in general that what are all the queries that are taking much time,resources and needed to be tuned

Hello,
The queries execution time vary according to many metrics.those metrics are:
1) Logical IO's per execution?
2) Cpu usage?
3) Physical IO's per execution?
4) Elapsed time used?
5) Based on number of parse calls?
6) Size consumed in shared pool?
7) Number of executions?
8) Based on Wait time?In your case i will start by queries that take much time and start generating plan for those queries to know where the cost of those queries are consumed.If you are using the Enterprise manager it will be also helpful to check to activity in the performance tab to have indication where the top activity is going.
Regards
Mohamed ELAzab
http://mohamedelazab.blogspot.com/

Similar Messages

  • Log SQL before query is sent to the database

    I have a query that hangs once it has been sent to the database. I'm looking for a way to log the SQL before it is sent to the DB. The SQL logging channel only logs the sql once the query has returned from the database. While the QUERY logging channel will log the QL before the query is executed, I still need the generated SQL to determine what is wrong.
    Is there a way to force SQL logging before the query is sent to the database. Alternatively is there a way to generate the sql from the current PersistenceManager or Query objects? I have tried using KodoQuery.getQueryString() but this returns the same output as the QUERY logging channel, i.e. the JDO QL.
    Kodo version 3.2.3 with SQL Server 2000
    Regards
    Nathan

    hi ,
    I am not sure of the answer , but i can explain what we will do to check the SQL that is being fired by the KODO to the database.
    We use log4j for logging purpose in our application. To generate SQL log file , we will keep an appender for the
    "com.solarmetric.kodo.impl.jdbc.SQL" with threshold value "ALL" . We get the skeleton prepaid statement as well as the query with values also.
    regards ,
    jill

  • Regarding Query/Where box in oracle forms

    Hi,
    I have a query regarding query/where box in oracle.
    When I enter ":" in one of the field query box pops up and when I enter some query and press F12 to execute query.
    The OK button has to be pressed twice to retrieve the result.
    Can anyone please let me know why this is happening, instead of retreiving results at one go by pressing OK once.
    When does query box pos up? I have to avoid hitting OK button on query box twice.
    Thanks for your advice in advance.
    Thanks,
    KLC
    Edited by: user5411765 on Nov 22, 2010 10:44 PM

    Hi,
    Were you able to get around this problem? I am facing the same and need help! :(
    Regards,
    Arun

  • POST-QUERY trigger cannot retrieve the database field in TEMPLATE.fmb

    I have tried to create a form using TEMPLATE.fmb in Oracle Apps R11i. I found that the POST-QUERY trigger cannot retrieve the database field (which is display item property) properly. Can anyone tell me how to retrieve the displayed database fields? Thanks for any helps.

    POST-QUERY would fire after the query has been executed, it does not do the actual data retrieve.
    See if the items you have put have the data source properties set and are not control items.
    btw, this forum is for OA users, you would get better response to your query if you post it in forms forum
    Thanks,
    Tapash

  • Query for UDT over different Databases on another Server

    Hi,
    i want to use via query an UDT from another Database on another Server...
    nomal Tables can be Used like this:
    select* from [SVR-Name].Database.dbo.OITM
    But if I try the same for an UDT:
    select* from [SVR-Name].Database.dbo.[@UDT]
    it doesn't work.
    Does anyone have an Idea for me ?
    Thx.
    Markus

    Thx for your replies,
    a query over different Databases on the same SQL-Server is no problem.
    ... but I want to select an UDT which is on another SAP-Server (other location) in a different Database.
    Servername = SVR
    Database = LIVE
    UDT = [@portfolio]
    select * from [SVR].LIVE.DBO.[@portfolio]
    doesn't work.
    (normal query to reach OITM for example:
    select * from [SVR].LIVE.DBO.OITM
    works fine !!

  • Query Data from other Oracle Database into current

    Hi all,
    I have to query data from another oracle database into the current oracle database. Because the customer has standard edition, I cannot use a pipe. I tried "SELECT column_name FROM external_oracle_db.schema.table WHERE column_name = 'column_value';" Unfortunately this does not work.
    Does anyone have a suggestion?
    Thanks
    Hans

    Have you tried with Database links?
    SELECT column_name FROM schema.table@external_oracle_db WHERE column_name = 'column_value';
    Satish

  • How to use unload query using JDBC with Informix database

    Hi friends,
    How can i use unload query using JDBC with Informix database?
    When i use it as "unload to 'abc.txt' select * from ........" it gives syntax error.I want to take the data of a table to a file.With dbaccess i can use it but i need to do it using jdbc.
    Thanks,
    Raneesh.

    To the best of my ability to tell, the right way to use this product from within Power Query would be to use its API. Unfortunately, we don't currently support either of the methods needed to be able to authenticate with the service (OAuth 2.0 and a relatively-custom
    digest-based method). Adding a mechanism to allow use of arbitrary OAuth-protected resources is a fairly high priority for us, and I hope we'll be able to deliver something before mid-2015.
    Scraping the website is very hard to do well -- both from an authentication and from a data discovery perspective.

  • Regarding Query and Logical database

    Hi All,
      I have one requirement to create a report which gives all selection fields of a query.I got the selection fields defined in the query,but some extra selection fields are coming from logical database,which query uses.These extra fields count is different for different queries using same logical data base.Please suggest me a solution.
    Regards
    Shibin

    Hi Jogeswara,
    Thanks for your inputs.
    But my question is, how can I filter the data which is being fetched by standard logical database. I cannot go inside the std. LDB and change internal tables of it. I tried coding in extras, but I think it works only if we want to add additional fields in output.
    At present, we are considering the option of creating a z LDB where we copy. std. LDB and also add the reqd. table which is not present in LDB.
    Is there any other option?
    Please provide your valuable inputs.
    Regards,
    Imran Kundan.

  • Query regarding Purchase Order Lines stored in database?

    Hi Friends,
    While i extract Purchase Order details ,i found that in demo database,some Purchase order lines are stored in seperate entries in POR1..
    eg: if <b>21</b> A00001 is ordered,then the purchase Order line for 20 item is stored in a row and purchase order for 1 item of that same item 'A00001' is stored in a seperate row in POR1..
    In wht criteria SAP B1 take it as a seperate row for a single item order while storing in POR1--Purchse Order Lines
    Thanks in Advance
    regards
    Sooriyakala.P

    Hi,
    Could be that 20 items come from a Sales Order (and line), and 1 from another one? If isn´t this data, could be any diffent one.
    Then in the SBO GUI there is a field in the left botton of the item matrix called "summary type" (or something similar, I´m translating). Here you can say to summ all the items in one row, or not to make any summary.
    Regards,
    Ibai Peñ

  • Suggestion regarding query

    Hi,
    I have a requirement to select two columns from 6 million rows which is one database, and go through the result set, take the one of the column value as the criteria and select another column from 10000 rows table.
    I have used two methods to work. Both are working but they are very slow.
    I am using jdbc for this.
    First method:
    Following is the pseudo code for the same
    --Select all rows from the table 1
    while (rs.next())
    String column1= rs.getString(1);
    String Query 2= "Select column2 from table 2 where my_field=column1";
    --prepare the statement1 using query2
    -- execute the statement1 and copy in to rs1
    -- while (rs1.next())
    do something
    Second method:
    In this one instead of querying the database for each row in the first resutl set, used a stored procedure which returns a ref cursor taking the array as the input string.
    create or replace type mylist as table of varchar2(20);
    create or replace type outlist as table of BLOB;
    create or replace package my_pkg
    as
    type rc is ref cursor;
    procedure p(myval_list in mylist, outcur OUT rc);
    end;
    create or replace package body my_pkg
    as
    PROCEDURE get_phonetype(myval_list IN imeilist,orefcur OUT rc )
    AS
    l_data outlist := outlist();
    tmp_profile BLOB;
    BEGIN
    --DBMS_OUTPUT.put_line(myval_list.COUNT);
    FOR i IN myval_list.FIRST .. myval_list.LAST
    LOOP
    BEGIN
    SELECT column1 INTO tmp_profile FROM table1 WHERE
    column2 IN (SELECT column2
    FROM table2
    WHERE (column3< myval_list(i) AND column4 > myval_list(i)));
    --DBMS_OUTPUT.put_line(tmp_phone);
    l_data.extend;
    l_data(i) := tmp_profile;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    END;
    END LOOP;
    open outcur for
    select * from TABLE( cast (l_data as outlist));
    END;
    END;
    in the java program:
    --Select all rows from the table 1
    while (rs.next())
    --loop few times to populate the column1 string arrays
    OracleCallableStatement stmt1=(OracleCallableStatement)conn.prepareCall("{call p(?,?)}");
    -- register the out parameter as ORACLETYPES.CURSOR
    --prepare the array descriptor for the array, set the array using column1 values
    -- set the first argument as array
    -- retrieve the result set
    --do something with the result set
    } //end of while
    I thought using the stored procedure would make my process faster, but the second approach deteriated the execution time.
    I could not understand where I did the mistake. FOr the 200000 rows for the first table, first approach executed in 10 minutes and the second was taking more than hours.
    Can some one help me in fine tuning the stored procedure or suggest an alternative best method.
    Regards,
    Syam

    Syam,
    Not knowing your table data or the whole of the queries you're making, this may not be feasible. But could you write this as either a single (albeit complex) query, or perhaps a PL/SQL block that uses a temp table or two, but still does all of the processing in Oracle as queries, not loops?
    From the examples you gave, it looks like putting it into one query would just involve a few table joins. But they look like you abbreviated some more complex processing...

  • Additional i/o fields to infoset query based on PNPCE logical database

    Hi All,
    I have a requirement to add two additional input and output fields "job function" and "job family" to a infoset query based on logical database PNPCE. I am new to writing code in infset query and there are so many code areas in infoset query. I am confused where to write code and how to limit the output list based on the user selection to the additional fields "Job function" and "job family". have any one done this in the past?. is there sample code somewhere to do something similar to this?
    Your help will be much appreciated with points! (as per our community guidelines)
    Regards,
    Arul

    Hello Arul,
    Your question would be better answered if you post it in on of the Business Intelligence Forums. Please close this thread and goto:
    Expert Forums » Business Intelligence
    or
    /community
    Regards,
    Manny

  • XMII query against a SAP NetWeaver database

    Hi all,
    I have set up a data server for a SAP NetWeaver MSSQL database (DX1 on SAPSRV03) for SAP Web AS 6.40. The status of this data source shows OK. I try to create a new query template. In the SQL Query details, I can see the list of the tables and the list of the columns from a selected table. However, the test result always shows an error: “A SQL Error has occurred on query, [SAPSRV03\DX1]Invalid object name 'TMP_PRD_LINES'” It does not work for any table from that database, so it seems that the error has nothing to do with the table name.
    If I change the database name of that data server to something else, like pubs or Northwind, on the same SQL server, the query works well with any table.
    I wonder whether there is any special parameters that I need to set up so that I can query against a NetWeaver database.
    I’ll appreciate any advice on this problem!
    Best regards,
    Hart

    Hart,
    We are able to query a Netweaver DB, but we needed to include a schema.
    Your query to the TMP_PRD_LINES table should look like the following:
    Select * from SAPDX1DB.TMP_PRD_LINES
    Working with you through support I know that this worked for you - I am just wanted to post the answer for everyone to see.
    Thanks,                                                                
    Joe

  • Need Help in with Querying Stored Procedures from UCCX Database

    Hi All
    We are trying to build a custom reporting solution using a BI tool and for which we have provided the ODBC connectivity to the UCCX database to our SQL server.
    We have installed the ODBC drivers on our SQL server and made a connection to UCCX version 10.0 successfully. we are using the username 'uccxhruser' to connect to the DSN.
    We want to query the stored procedure sp_csq_activity from the Microsoft SQL Server Management Studio. When we add the Linked Server in the SQL Server, we are able to see the Data Tables and also query them using the select statement. However, we are not able to see any of the Stored procedures within the Linked Server Tab.
    Can someone guide us in the right direction as to how to go about the process. Is calling the stored proedure the right way or we need to query the individual tables as mentioned in the Database Schema Guide and then once the historical tables our there in our server , then build the report.
    Any help will be much appreciated.
    Regards
    Abhinav

    Hi,
    what happens if you try to execute the above SP? They should be accessible AFAIK.
    G.

  • Query to find tables in database having maximum records or data

    hello
    how can i find 10 high volume tables in my database
    Regards

    Hi user;
    Please try below query:
    How many schema we have and their size
    set pages 999
    col "size MB" format 999,999,999
    col "Objects" format 999,999,999
    select obj.owner "Owner" ,
    obj_cnt "Objects" , decode(seg_size, NULL, 0, seg_size) "size MB" from
    (select owner, count(*) obj_cnt from dba_objects group by owner) obj ,
    (select owner, ceil(sum(bytes)/1024/1024) seg_size from dba_segments group by owner) seg where obj.owner = seg.owner(+) order by 3 desc ,2 desc, 1
    To find Ten bigest object on our db
    col owner format a15
    col segment_name format a30
    col segment_type format a15
    col mb format 999,999,999
    select owner , segment_name , segment_type , mb from (
    select owner , segment_name , segment_type , bytes / 1024 / 1024 "MB" from dba_segments
    order by bytes desc ) where rownum < 11
    Regard
    Helios

  • Single Query suddenly goes slow until database restart or query change

    Hello all,
    Configuration I'm using is Oracle 10g EE 10.1.0.4.0 on Windows 2003 Server
    I have performance issue with one single query. The query is called using dbExpress from Delphi application.
    Since a month, almost every week this query starts going VERY slow. Usually it executes in a 0.5-1 second, but when it's slowed down, it takes approx. 4-5 minutes to execute.
    The query runs on a single table (~4 000 000 rows) and runs on primary index. The index itself consists of 5 fields - the query uses the first 4 of them. I know it's not a good design but restructuring the table/index is out of question, AFAIK.
    Until now, I figured out two ways to speed things up. The first and obvious is to restart the server or shut/start the database. It works. For a week. Then we're back at first square.
    The second way is some kind of a mystery to me: If I change the query a little bit, never mind how - for example, adding 'and (1=1)' in the clause, after deploying the application, it starts running fast. Again for a week or so.
    I've attached an jpeg showing the explain plans on slow and fast executing queries. They look almost the same.
    I'm running out of ideas for now. It's very annoying (and unsafe) to restart the machine on a week basis. Thus any help is greatly appreciated.
    Things I've done so far:
    - installed last service packs from Oracle and Microsoft.
    - tried different versions of dbexpora.dll.
    - Regularly gathered and estimated statistics and analyzings.
    - Made sure that the server is not under heavy load (antiviruses, firewalls, archive loggers are stopped or uninstalled for a while).
    - made sure that there is enough free space on hard disks.
    - the disk array itself is in good health - defragmented, HDD tools doesn't find anything suspicious.
    Final thoughts: Maybe the sql cache is going overloaded and someway stops executing the query. That's why when I restart the machine or change the query clause insignificantly, it starts running fast. I took a peek on v$sql and v$sqlarea but there is nothing special, and honestly, I'm not very familiar reading the values in this view - I'm just comparing the values returned by this query with the others - they look similar.
    Anyway, if someone could help, it would be great.
    Regards,
    Ivan
    Screenshots showing the explain plans for slow and fast query:
    Image: !http://img254.imageshack.us/img254/6674/queryr.jpg!

    Sorry for the incomplete information. I tried to gather the mentioned in your second link additional data. Unfortunately, I cannot find the TKPROF utility - it's not in the bin directory, neither in any other folder. Guess it's not installed at all.
    About rewriting the query, suggested in the first link you gave: it's so simple and clear that it should not be rewriten. As I mentioned before, every time I change the query even a little bit, it starts running well for a couple of days.
    Anyway, here are the stats I've just gathered. Unfortunately, now the query performs well and I'm not able to give you stats, showing the slowed down query.
    These are the parameters relevant to the optimizer:
    SQL> show parameter optimizer
    NAME TYPE VALUE
    optimizer_dynamic_sampling integer 2
    optimizer_features_enable string 10.1.0.4
    optimizer_index_caching integer 0
    optimizer_index_cost_adj integer 100
    optimizer_mode string ALL_ROWS
    SQL> show parameter db_file_multi
    NAME TYPE VALUE
    db_file_multiblock_read_count integer 32
    SQL> show parameter db_block_size
    NAME TYPE VALUE
    db_block_size integer 8192
    SQL> show parameter cursor_sharing
    NAME TYPE VALUE
    cursor_sharing string EXACT
    Screenshots of explain plan is posted in my first post - both for fast and slow executed query.
    output of SQL_Plus AUTOTRACE including the TIMING information:
    SQL> set autotrace traceonly arraysize 1000
    SQL> SELECT * FROM "AOPERITEM"
    WHERE (FOPER = 201)
    AND (FCLIENT = 1)
    AND (FDATEOPER = '2009-10-28')
    AND (FNUMOPER = 95532)
    Execution Plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 1 | 132 | 5 (0)|
    | 1 | TABLE ACCESS BY INDEX ROWID| AOPERITEM | 1 | 132 | 5 (0)|
    | 2 | INDEX RANGE SCAN | AOPERITEM_IDX | 1 | | 4 (0)|
    Note
    - 'PLAN_TABLE' is old version
    Statistics
    1 recursive calls
    0 db block gets
    9 consistent gets
    0 physical reads
    0 redo size
    3098 bytes sent via SQL*Net to client
    369 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    4 rows processed
    The DBMS_XPLAN.DISPLAY_CURSOR output:
    SQL> select /*+ gather_plan_statistics */
    * FROM "AOPERITEM"
    WHERE (FOPER = 201)
    AND (FCLIENT = 1)
    AND (FDATEOPER = '2009-10-28')
    AND (FNUMOPER = 95532)
    Execution Plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 1 | 132 | 5 (0)|
    | 1 | TABLE ACCESS BY INDEX ROWID| AOPERITEM | 1 | 132 | 5 (0)|
    | 2 | INDEX RANGE SCAN | AOPERITEM_IDX | 1 | | 4 (0)|
    Note
    - 'PLAN_TABLE' is old version
    Statistics
    0 recursive calls
    0 db block gets
    9 consistent gets
    4 physical reads
    0 redo size
    2937 bytes sent via SQL*Net to client
    369 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    4 rows processed
    PS: I'm not a DBA myself, I'm just trying to find a solution to this problem.
    Thanks in advance.

Maybe you are looking for

  • When restoring new iPhone 4S from old iPhone 3GS, Siri is gone

    OK. so I brought home my new iPhone 4S. I plugged it in and answered the questions, the synced it. Nice, apps are there but no data. OK. so get online, figure out that I need to restore from the backup of my previous phone to get my data. So I do tha

  • Bluetooth connection problem since upgraded Centro software to 1.07 spnt

    I upgraded to 1.07 spnt and now when i connect via bluetooth the phone doesn't work.  Right when i turn my bluetooth headset off, the phone works again. I once again upgraded the software, and then I paired it with my bluetooth before i added any of

  • Music store & 100% CPU usage

    I've had this problem on my newly built computer, and my older machine. When I browse the iTunes music store, the status bar on the top will often move like it's opening the music store, but it'll do this for a long period of time (several minutes) a

  • How to show my iTunes podcast page in my facebook fanpage..

    Hi, I was wondering if anyone knows how to put their podcast page on iTunes onto the bandpage site on facebook..

  • I need suggestions for an online trading application

    Hi, I am going to develop an online trading application. I have decided to use JAVA EE 5 and I have read "The Java(tm) EE 5 Tutorial". Because I am a (C++) programmer and new to Java, I need suggestions to start development. Here is summary of the sy