Top 10 Queries in Database...

Hello Guys,
My boss wants to know the database queries ran in last 10 days. What is the best way to get this informatiom.
He also wants to know the top 10 heavy quries that took the most cpu resources and time.
We have database 10g release 2 and OEM is working.
Please help.
Regards, Imran

This information is not available. Oracle does not keep a log of queries. Perhaps it would have been good if you boss had come to you and asked for all of the queries that run over the next 10 days -- that would be more doable.
Some of the info may be available from grid control. To get the top 10 queries, you can use statspack to take a snapshot, then some time later, take another and run the report. The top 10 queries for that time interval, by various measures, will be in the report.

Similar Messages

  • How to find top queries in database for past 15 days period

    I need to know the top resource consuming sql queries in my database (9.2.0.7) for past 15 days.
    please suggest me the method by which i can get the result.
    What i know is we can generate the statspack report and analyze it for top sql statements. but this will give for that particular period of time (betwwen two snaps).
    can we generate a report for past 15 days period. If yes then how much time will it take.
    (my database is up and running since past 6 months)
    thanks in advance :)

    What i know is we can generate the statspack report and analyze it for top sql statements. but this will give for that particular period of time (betwwen two snaps).Does this mean you haven'tbeen running statspack snapshots on a regular basis for the last six months?
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • SharePoint 2013 search analytics reports - 'query text' column value is empty in 'top queries by month' report

    Hi,
    We are using ContentBySearchWebPart to facilitate search through the site.
    We have used display template to format the results. We are deploying the web part on the desired page through a feature. We have below markup for web part in the elements.xml file to add the web part -
    <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
    <type name="Microsoft.Office.Server.Search.WebControls.ContentBySearchWebPart, Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
    <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
    </metaData>
    <data>
    <properties>
    <property name="StatesJson" type="string">{}</property>
    <property name="UseSharedDataProvider" type="bool">False</property>
    <property name="UseSimplifiedQueryBuilder" type="bool">False</property>
    <property name="QueryGroupName" type="string">f5646507-4a7a-4d75-b5c4-d435b9128e2a</property>
    <property name="LogAnalyticsViewEvent" type="bool">True</property>
    <property name="SelectedPropertiesJson" type="string">["Title","Path","Description"]</property>
    <property name="PropertyMappings" type="string" />
    <property name="ShowAdvancedLink" type="bool">True</property>
    <property name="NumberOfItems" type="int">10</property>
    <property name="EmitStyleReference" type="bool">True</property>
    <property name="ShowPreferencesLink" type="bool">True</property>
    <property name="ServerIncludeScriptsJson" type="string">null</property>
    <property name="IncludeResultTypeConstraint" type="bool">False</property>
    <property name="Height" type="string" />
    <property name="MaxPagesBeforeCurrent" type="int">4</property>
    <property name="ResultType" type="string" />
    <property name="ShowDidYouMean" type="bool">False</property>
    <property name="StartingItemIndex" type="int">1</property>
    <property name="AlwaysRenderOnServer" type="bool">False</property>
    <property name="GroupTemplateId" type="string">&#126;sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Group_Content.js</property>
    <property name="ResultTypeId" type="string" />
    <property name="ItemTemplateId" type="string">&#126;sitecollection/_catalogs/masterpage/Display Templates/Search/Item_LearningGroup.js</property>
    <property name="AllowConnect" type="bool">True</property>
    <property name="HelpUrl" type="string" />
    <property name="ResultsPerPage" type="int">10</property>
    <property name="RenderTemplateId" type="string">&#126;sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/ListWithPaging.js</property>
    <property name="AllowEdit" type="bool">True</property>
    <property name="AllowZoneChange" type="bool">True</property>
    <property name="AddSEOPropertiesFromSearch" type="bool">False</property>
    <property name="AdvancedSearchPageAddress" type="string">advanced.aspx</property>
    <property name="HitHighlightedPropertiesJson" type="string">["Title","Path","Author","SectionNames","SiteDescription"]</property>
    <property name="TitleUrl" type="string" />
    <property name="EmptyMessage" type="string" />
    <property name="ShowBestBets" type="bool">False</property>
    <property name="ShowViewDuplicates" type="bool">False</property>
    <property name="AllowHide" type="bool">True</property>
    <property name="BypassResultTypes" type="bool">True</property>
    <property name="Description" type="string">Content Search Web Part will allow you to show items that are results of a search query you specify. When you add it to the page, this Web Part will show recently modified items from the current site. You can change this setting to show items from another site or list by editing the Web Part and changing its search criteria.As new content is discovered by search, this Web Part will display an updated list of items each time the page is viewed.</property>
    <property name="ShowSortOptions" type="bool">False</property>
    <property name="ExportMode" type="exportmode">All</property>
    <property name="AllowMinimize" type="bool">True</property>
    <property name="ShowPersonalFavorites" type="bool">False</property>
    <property name="ChromeType" type="chrometype">None</property>
    <property name="ShowPaging" type="bool">True</property>
    <property name="ChromeState" type="chromestate">Normal</property>
    <property name="CatalogIconImageUrl" type="string" />
    <property name="HelpMode" type="helpmode">Modeless</property>
    <property name="TitleIconImageUrl" type="string" />
    <property name="ItemBodyTemplateId" type="string" />
    <property name="AlternateErrorMessage" type="string" null="true" />
    <property name="Hidden" type="bool">False</property>
    <property name="TargetResultTable" type="string">RelevantResults</property>
    <property name="AllowClose" type="bool">True</property>
    <property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
    <property name="ShowResultCount" type="bool">True</property>
    <property name="ShowLanguageOptions" type="bool">True</property>
    <property name="ShowUpScopeMessage" type="bool">False</property>
    <property name="Width" type="string" />
    <property name="RepositionLanguageDropDown" type="bool">False</property>
    <property name="Title" type="string">Search Learning Groups</property>
    <property name="ScrollToTopOnRedraw" type="bool">False</property>
    <property name="ShowResults" type="bool">True</property>
    <property name="ShowAlertMe" type="bool">False</property>
    <property name="OverwriteResultPath" type="bool">True</property>
    <property name="PreloadedItemTemplateIdsJson" type="string">null</property>
    <property name="MaxPagesAfterCurrent" type="int">1</property>
    <property name="ShowDefinitions" type="bool">False</property>
    <property name="ShouldHideControlWhenEmpty" type="bool">False</property>
    <property name="AvailableSortsJson" type="string">null</property>
    <property name="DataProviderJSON" type="string">{"QueryGroupName":"f5646507-4a7a-4d75-b5c4-d435b9128e2a","QueryPropertiesTemplateUrl":"sitesearch://webroot","IgnoreQueryPropertiesTemplateUrl":false,"SourceID":"8413cd39-2156-4e00-b54d-11efd9abdb89","SourceName":"Local SharePoint Results","SourceLevel":"Ssa","CollapseSpecification":"","QueryTemplate":"Path:{SiteCollection.URL} AND :{SearchBoxQuery} ","FallbackSort":[],"FallbackSortJson":"[]","RankRules":[],"RankRulesJson":"[]","AsynchronousResultRetrieval":false,"SendContentBeforeQuery":true,"BatchClientQuery":true,"FallbackLanguage":-1,"FallbackRankingModelID":"","EnableStemming":true,"EnablePhonetic":false,"EnableNicknames":false,"EnableInterleaving":false,"EnableQueryRules":true,"EnableOrderingHitHighlightedProperty":false,"HitHighlightedMultivaluePropertyLimit":-1,"IgnoreContextualScope":true,"ScopeResultsToCurrentSite":false,"TrimDuplicates":false,"Properties":{"TryCache":true,"Scope":"{Site.URL}","UpdateLinksForCatalogItems":true,"EnableStacking":true,"ListId":"60ae8593-eddc-45e0-802a-27f78059ce26","ListItemId":4},"PropertiesJson":"{\"TryCache\":true,\"Scope\":\"{Site.URL}\",\"UpdateLinksForCatalogItems\":true,\"EnableStacking\":true,\"ListId\":\"60ae8593-eddc-45e0-802a-27f78059ce26\",\"ListItemId\":4}","ClientType":"ContentSearchRegular","UpdateAjaxNavigate":true,"SummaryLength":180,"DesiredSnippetLength":90,"PersonalizedQuery":false,"FallbackRefinementFilters":null,"IgnoreStaleServerQuery":false,"RenderTemplateId":"DefaultDataProvider","AlternateErrorMessage":null,"Title":""}</property>
    <property name="Direction" type="direction">NotSet</property>
    </properties>
    </data>
    </webPart>
    When we are downloading the 'Top Queries by Month' or 'Top Queries by Day' report, while we see numbers in 'Total Queries' and '% of all queries' columns, we are not finding anything in 'Query Text' column, its empty. Not sure while the analytics is
    not able to fetch/report the 'Query Text' itself - the report doesnt make any sense without 'Query Text' information.
    Is there anything in the web part markup I pasted above- is any of the property value is affecting this?
    Or it can be some configuration/error with the logging/analytics process?
    Please suggest. Thanks in advance.
    Regards,
    Mahavir
    MOSS programmer

    Hi,
    Hope you are doing well. Would you help to try to run the script to start the timer job manually:
    Run the script to start the timer job:
    ==================
    $ua = Get-SPTimerJob -Type Microsoft.Office.Server.Search.Analytics.UsageAnalyticsJobDefinition
    $ua.GetAnalysisInfo()
    $ua = get-sptimerjob -type microsoft.office.server.search.analytics.usageanalyticsjobdefinition
    $ua.DisableTimerJobSchedule()
    $ua.StartAnalysis()
    $ua.EnableTimerJobSchedule()
    $ua = Get-SPTimerJob -Identity ("job-usage-log-file-import")
    $ua.RunNow()
    ==================
    2.  Please install the SharePoint 2013 March update if our version is before this:
    SharePoint 2013 March update:
    http://support.microsoft.com/kb/2767999
    Best Regards,
    Dats Luo

  • Queries on DATABASE OPEN RESETLOGS and lost Control Files

    Hi I have some queries on RESETLOGS I would be keen to hear some answers on
    Q1. If I am doing a PITR and I end in ALTER DATABASE OPEN RESETLOGS, what happens about any Archived Redo Log files ( still in situ ) that were from the original source database but were at a future point in time ? Are they just ignored by any future restore ( since their log sequence number will be different ? ) and eventually over written or purged out ?
    Q2. When you create a new incarnation using RESETLOGS can you Flashback Database to before this ?
    Q3. If I have lost all my Control Files and have not created a backup control file or done a backup to trace of the control file, can I simply restore one of the actual control files from my last backup and use RECOVER DATABASE USING BACKUP CONTROLFILE AUTO; or will this only work with a bonafide backup control file ( i.e. one created via ALTER DATABASE BACKUP CONTROLFILE TO ‘<file spec>’; )
    Q4. When I issue RECOVER DATABASE USING BACKUP CONTROLFILE AUTO;
    Do I have to ALTER DATABASE OPEN RESETLOGS at the end of the recovery ? I have seen this documented but I am not sure why I would need to reset the redo logs and instead simply open the database ?
    Q5. If I am running the CREATE CONTROL FILE command from an ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
    Do I need to use the NORESETLOGS or RESETLOGS ? How do I know which to use ?
    thanks,
    Jim

    Jimbo wrote:
    Hi I have some queries on RESETLOGS I would be keen to hear some answers on
    Q1. If I am doing a PITR and I end in ALTER DATABASE OPEN RESETLOGS, what happens about any Archived Redo Log files ( still in situ ) that were from the original source database but were at a future point in time ? Are they just ignored by any future restore ( since their log sequence number will be different ? ) and eventually over written or purged out ?
    what happens when you try it?
    Q2. When you create a new incarnation using RESETLOGS can you Flashback Database to before this ?
    what happens when you try it?
    Q3. If I have lost all my Control Files and have not created a backup control file or done a backup to trace of the control file, can I simply restore one of the actual control files from my last backup and use RECOVER DATABASE USING BACKUP CONTROLFILE AUTO; or will this only work with a bonafide backup control file ( i.e. one created via ALTER DATABASE BACKUP CONTROLFILE TO ‘<file spec>’; )
    what happens when you try it?
    Q4. When I issue RECOVER DATABASE USING BACKUP CONTROLFILE AUTO;
    Do I have to ALTER DATABASE OPEN RESETLOGS at the end of the recovery ? I have seen this documented but I am not sure why I would need to reset the redo logs and instead simply open the database ?
    what happens when you try it?
    Q5. If I am running the CREATE CONTROL FILE command from an ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
    Do I need to use the NORESETLOGS or RESETLOGS ? How do I know which to use ?
    what happens when you try it?

  • Sql queries - slow database

    hi all,
    is there a general but specific way to generate a list of sql queries that are consuming most resources and resulting in slow database performance?
    thanks.

    There are very few ways in this world that are "general but specific".
    You can use "general" tools like StatsPack and AWR.
    You can write "general" queries on V$SQL, V$SQLAREA, V$SQLSTATS.
    You can use "specific" methods like Tracing.
    You can use "specific" methods like Client side (or Application Server side) Logs.

  • Storing SQL queries in database itself.

    I want to store SQL queries in 9i database itself so that I just need to pass the parameters from VB.NET front end and the query will execute. How can I do this?

    Possibly make use of Stored packages/procedures/functions?
    Back in 97/98 I had worked with VB (version 6 at that time) application for which I had written stored procedures to do exactly that... (except for select) VB application would pass parameter values to these procedures for doing inserts/updates/deletes. No application user was given direct insert/update/delete privileges.
    Also I had triggers written for each of the table involved to keep footprint (user id and date/time) for last update/insert for each of the row.
    I don't remember for sure if the application deleted rows from the DB. I think the application handled delete by actually updating a flag (active/inactive) again with a foot print so that you can track back the "deletes".
    my 1/2 cent worth of thought
    Message was edited by:
    user551318

  • How to connect top level domain database to subdomains

    Created subdomains for the top level domains. Need to learn
    how can we connect centralized database in the top level domain
    with the subdomains code in coldfusion.

    If you're using EOP and your goal is to block stuff coming from a certain geographic area then you need to go to your exchange admin center select Protection>content filter>Default Policy>International Spam>Filter email messages sent from the
    following countries or regions

  • Sql queries in database adapter

    Hi,
    I want to write, say, 2 select statements in the database adapter. How can I accomadate using "execute pure sql"?
    Regards,
    Aasta

    maybe these links will help you :
    Urgent : Fault Policies in 11g
    http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10226/soacompapp_mang.htm
    http://www.it-eye.nl/weblog/2009/12/10/using-fault-management-framework-in-oracle-11g/
    http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10224/med_faulthandling.htm#SOASE274

  • Initiating Global creation activity by quering a database table.

    Hi,
    I want to start the BPM process using
    a) Use a query result for the initial global creation activity. ( -- I have an catalogued object which returns 'docNo' and 'status' column values from a database query already.)
    How do I do this piece wherein I call the automatic activity from the global creation activity.
    I want the
    b) User clicks on the Review Claim link to pull up the claim to approve the claim. -- secondary part ( use the docNo to pull up claim detail from the database and present in the form for approval)
    So there are 2 parts, List the claims awaiting approval and then the individual approval.
    How do I get the user to log into a BPM workspace ( login screen) and get a list of claims for approval.
    Example:
    doc1#, amount, <Approve ReportLink>
    doc2#, amount, <Approve ReportLink>
    doc3#, amount, <Approve ReportLink>
    Angelo

    Hi Angelo,
    Looks like part of your thread was cut off. This is mostly to see if I might be able to fill in the blanks.
    I'm guessing you are thinking about using a Global Creation activity to perhaps bring up a list of claims and that the row or rows returned from the database could each create a separate new work item instance. Did I get that right?
    If that's correct, don't use a Global Creation. Instead use a Global Interactive to display the rows. For each row approved an new work item instance might then be created in the process for each one you approved. You'd use a Screenflow behind the Global Interactive. Inside the screenflow you'd have an automatic task to retrieve the rows from the database. This would then flow to a Interactive task inside the screenflow that has been assigned a BPM Object presentation to display the rows inside a Group. You'd then follow this with another automatic task that looks at the Group (array) of items selected in the UI and then programmatically create a work item instance for each one selected.
    Hope this helps,
    Dan

  • Quering the database using Client Object Model

    Hi,
    I have to fetch the list items from a list named "Project Status" and display it in a table using
    Client Object model.
    The equivalent server side code is:
    SPWeb web = SPContext.Current.Web;
    SPList list = web.Lists["Project Status"];
    DataTable dt1 = new DataTable();
    try
    if (list.ItemCount > 0)
    DataColumn dc;
    DataColumn dc1;
    dc = new DataColumn("ProjectId", Type.GetType("System.String"));
    dc1 = new DataColumn("Project Name", Type.GetType("System.String"));
    dt1.Columns.Add(dc);
    dt1.Columns.Add(dc1);
    DataRow dr;
    foreach (SPListItem item in list.Items)
    dr = dt1.NewRow();
    dr["ProjectId"] = item["ProjectId"];
    dr["Project Name"] = item["Project Name"];
    dt1.Rows.Add(dr);
    Repeater1.DataSource = dt1;
    Repeater1.DataBind();
    catch (Exception Ex)
    throw Ex;
    1 more issue what i face is providing two links in the Visual WebPart and their navigate url is based on a condition that is fetched from the database. This corresponding code has to be converted to
    Client Object Model.
    string user = web.CurrentUser.LoginName;
    string userID = user.Split(new char[] { '\\' })[1];
    string connString = @"Data Source=NorthWind;Initial Catalog=EmployeeDB;User ID=sa;Password=Newuser123";
    string query = "select * from EMPLOYEE_PROFILE";
    SqlConnection conn = new SqlConnection(connString);
    SqlCommand cmd = new SqlCommand(query, conn);
    try
    conn.Open();
    DataTable t1 = new DataTable();
    using (SqlDataAdapter a = new SqlDataAdapter(cmd))
    a.Fill(t1);
    DataRow[] dr = t1.Select("PsNo = '" + userID + "'"); //This will select all rows where the Name Column has current user
    foreach (DataRow r in dr)
    string bU = r["DeputedBU"].ToString();
    if (bU == "INS" || bU == "BFS")
    lnkPM.NavigateUrl = web.Site.WebApplication.Sites[0].Url + "/Dashboard.aspx";
    lnkSummary.NavigateUrl = web.Site.WebApplication.Sites[0].Url + "/DashboardWithHyperlinks.aspx";
    else
    lnkPM.Visible = false;
    lnkSummary.Visible = false;
    catch (Exception)
    throw;
    finally
    conn.Close();
    Any help would be appreciated.

    Hi,
    According to your post, there would be two questions in this single thread.
    It is recommended to post one question in one single thread which will make others easier to focus on one question in one thread.
    For the first question, you want to fetch list items and put into a DataTable object using Client Object Model.
    To fetch list items from a list using Client Object Model, you can take a look at the code snippet below from MSDN:
    http://msdn.microsoft.com/en-us/library/office/ee534956(v=office.14).aspx
    For the second question, you might need to retrieve the User object and site collections object using Client Object Model.
    However, if you can develop a Visual Web Part for your site, it means that you will be able to access the SharePoint Object Model which has more powerful APIs, so there is no
    need to use Client Object Model in a Visual Web Part.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Crystal Reports against Infoset on top of logical database

    Are there any issues wth using a Infoset based on a logical database in Crystal? I'm getting an error when attempting to use an Infoset that is based on a logical database.

    HI,
    no issues
    ingo

  • Queries regarding Database adapter ...

    Hello,
    I have a scenario where i need to query few tables which are not related to each other and i am having different queries for each table. I tried creating a single DB adapter and imported all the tables in it. But i got struck at two places where i was asked to define a root table and also to define a select query.
    I have following doubts reagrding this:
    1. Do i need to need create different DB adapter for each table?
    2. What is the significance of root db table?
    Regards
    Lokesh

    Yes, you would create 3 different partner links using the DB adapter.
    In theory yes you would create a new partner link using the DB adapter for each table that is unrelated. If you want to select PO_HEADERS_ALL and PO_LINES, this can be done in one call as they are related.
    This advice is based on the fact that you are selecting batch data, not single lines of data. If you are receiving 1 row from multiple unrelated table this could be achieved via a custome procedure / package. I don't want to steer you down the wrong path so I would need to know more of your use case. In most senerios in Oracle apps you are calling APIs / packages.
    If you could provide more information of your use case(s) I will try and provide better advice
    cheers
    James

  • Top 5 queries  - One of them is sequence.nextval from dual !!!!!

    Hi All,
    I am using ORACLE DATABASE 11g and Oracle Linux 5.
    My intentions are to get the top resource consuming or time consuming queries from database in the particular time frame. I formed the below query to get the same :-
    select a.SQL_FULLTEXT,
                 s.module,
                 s.cpu_time_total / 1000000,
                 s.iowait_total / 1000000,
                 s.fetches_total,
                 s.sorts_total,
                 s.executions_total,
                 s.loads_total,
                 s.disk_reads_total /
                 DECODE(s.executions_total, 0, 1, s.executions_total) reads_per_execution,
                 s.disk_reads_total,
                 s.direct_writes_total / 1024,
                 s.buffer_gets_total / 1204,
                 s.rows_processed_total,
                 s.elapsed_time_total / 1000000,
                 s.apwait_total / 1000000,
                 s.ccwait_total / 1000000,
                 s.plsexec_time_total / 1000000,
                 s.javexec_time_total / 1000000
            from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT h, v$sqlarea a
           where s.parsing_schema_name = 'ST'
             and s.executions_total != 0
             and s.snap_id = h.snap_id
             and a.SQL_ID = s.sql_id
             and h.begin_interval_time > '03-NOV-11 09.30.00.000 AM'
             and h.end_interval_time < ''03-NOV-11 12.30.59.999 PM'
             and rownum <= 5
           order by 15 desc;I assume that above query will give me top 5 sql or pl/sql queries which are consuming most resource or time. Please correct me if am wrong with the query.
    The surprising fact is that I got the below query as the top most resource consuming query :-
    SELECT REF_SEQ.NEXTVAL AS VAL FROM DUALI searched for all the code in the database and I was not able to find this line in any code. The fact is that this query should not take more than 1 second as we know that sequence nextval from dual table is very fast so, how can i get this as resource consuming query.
    The output is as follows :- ( I have modified the output to show all the facts in detail. Here you can see that it shows the execution time as 10.002467 Seconds. In real this will get execute in less than a second.)
    MODULE NAME := Banking
    TOTAL CPU TIME := 8.299744 Seconds.
    TOTAL IO WAIT TIME := .915287 Seconds.
    TOTAL RECORDS FETCHED := 41128 Rows.
    SORT OPERATION(S) := 0
    TOTAL NO. OF EXECUTION(s) := 41128 Times.
    TOTAL NO. OF TIME(S) OBJECT/QUERY LOADED/RELOADED := 5
    DATA READ PER EXECUTION := .002139661544446605718731764248200739155806 KB.
    TOTAL DISK READS := 88 KB.
    TOTAL DISK WRITES := 0 KB.
    TOTAL BUFFER READS := 4.92441860465116279069767441860465116279 KB.
    TOTAL NO. OF ROW(S) PROCESSED := 41128
    TOTAL EXECUTION TIME FOR ONE TRANSACTION := 10.002467 Seconds.
    APPLICATION WAIT TIME := 0 Seconds.
    CONCURRENCY WAIT TIME := .344575 Seconds.
    PL/SQL EXECUTION TIME := 0 Seconds.
    JAVA EXECUTION TIME := 0 Seconds.Please guide me for this method. How to understand the presence of this sequence.nextval query here.
    The base requirement is I want a query which will give me top 5 resource/time consuming queries. I have took the help of AWR views in my logic. If you have any better idea let me know.
    Thanks in advance.

    Try this
    select *
    from
    select a.SQL_FULLTEXT,
                 s.module,
                 s.cpu_time_total / 1000000,
                 s.iowait_total / 1000000,
                 s.fetches_total,
                 s.sorts_total,
                 s.executions_total,
                 s.loads_total,
                 s.disk_reads_total /
                 DECODE(s.executions_total, 0, 1, s.executions_total) reads_per_execution,
                 s.disk_reads_total,
                 s.direct_writes_total / 1024,
                 s.buffer_gets_total / 1204,
                 s.rows_processed_total,
                 s.elapsed_time_total / 1000000,
                 s.apwait_total / 1000000,
                 s.ccwait_total / 1000000,
                 s.plsexec_time_total / 1000000,
                 s.javexec_time_total / 1000000
            from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT h, v$sqlarea a
           where s.parsing_schema_name = 'ST'
             and s.executions_total != 0
             and s.snap_id = h.snap_id
             and a.SQL_ID = s.sql_id
             and h.begin_interval_time > '03-NOV-11 09.30.00.000 AM'
             and h.end_interval_time < '03-NOV-11 12.30.59.999 PM'
             order by 15 desc
    )where rownum <= 5

  • Top 10 queries in oracle 9i

    Hi,
    how to get top 10 queries.. then which query is cosuming more cpu.

    I would suggest using statspack (free of cost ! ) and using SQL ordered by gets section to find the top queries consuming maximum CPu. To read about it more refer to performance tuning guide in 9i docs or check spdoc.txt in oracle-home/rdbms/admin
    Regards
    Amit

  • How to use database control to execute sql queries which change at run time

    Hi all,
    I need to execute sql queries using database controls , where the sql changes
    at run time
    based on some condition. For eg. based on the condition , I can add some where
    condition.
    Eg. sql = select id,name from emp where id = ?.
    based on some condition , I can add the following condition .
    and location = ?.
    Have anybody had this kind of situation.
    thanks,
    sathish

    From the perspective of the database control, you've got two options:
    1) use the sql: keyword to do parameter substitution. Your observation
    about {foo} style sbustitution is correct -- this is like using a
    PreparedStatement. To do substitution into the rest of the SQL
    statement, you can use the {sql: foo} substitution syntax which was
    undocumented in GA but is documented in SP2. Then, you can build up
    the filter clause String yourself in a JPF / JWS / etc and pass it into
    the DB control.
    For example:
    * @jc:sql statement="select * from product {sql: filter}"
    public Product[] getProducts(String filter) throws SQLException;
    This will substitute the String filter directly into the statement that
    is executed. The filter string could be null, "", "WHERE ID=12345", etc.
    2) you can use the DatabaseFilter object to build up a set of custom
    sorts and filters and pass that object into the DB control method.
    There have been other posts here about doing this, look for the subject
    "DatabaseFilter example".
    Hope that helps...
    Eddie
    Dan Hayes wrote:
    "Sathish Venkatesan" <[email protected]> wrote:
    Hi Maruthi,
    The parameter substituion , I guess is used like setting the values for
    prepared
    statements.
    What I'm trying to do , is change the sql at run time based on some condition.
    For example ,
    consider the following query :
    select col1,col2 from table t where t.col3 > 1
    At run time , based on some condition , I need to add one more and condition.
    i.e. select col1,col2 from table t where t.col3 > 1 and t.col4 < 10.
    This MAY not address your issue but if you are trying to add "optional" parameters
    you may try including ALL the possible parameters in the SQL but send in null
    for those params that you don't want to filter on in any particular case. Then,
    if you word your query
    as follows:
    select col1, col2 from table t where t.col3 > 1 and (t.col4 = {col4param} or
    {col4param} is null) and (t.col5 = {col5param} or {col5param} is null) ...
    you will get "dynamic" filters. In other words, col4 and col5 will only be
    filtered if you send in non-null parameters for those arguments.
    I have not tried this in a WL Workshop database control but I've used
    this strategy dozens of times in stored procedures or jdbc prepared statements.
    Good luck,
    Dan

Maybe you are looking for

  • How can I have 2 icloud accounts on one computer?

    My wife and I both have Iphones and only one computer.  We were curious if it is possible to setup up two icloud accounts on the one computer?  This would be so we can have the photostream setup up on the computer so we don't always have to sign in a

  • Returns for cash desk(check) payments

    Hi All, I posted a check payment( Feb10th 2011) through cash desk FPCJ against a receivable $47   , cash desk is closed and then trying to post returns lot for the check payment on Feb 15th 2011, the returns item is automatically going to clarificati

  • The programm doesn't let me open a document I did yesterday because it says there's no compatibility

    I've been working with the same version all time, I didn't dowload or made any chances in the programm and now I try to open the file I've been working on the whole week, it says that there's no compatibility. I searched for the reason, and even trie

  • Aperture syncs photos taken with iPT4 with smaller resolution

    Hello, I've got a problem. Currently, I'm using the newest version of Aperture to organize my photos. If I import my photos taken with my iPod touch 4th generation, I'll find them in my library with a resolution of 960x720 - exactly how it's supposed

  • How to configure Custom Queues in B2B

    Hi B2B Gurus, Could any one tell us how to configure coustom queues in B2B 1. I created a AQ's in B2B database using scripts , could any one tell us how to configure these in B2B. Please elobrate step by step 2.In 10 G , document protocol parametrs w