Top 10 SQL
Helloon the 11g R2, excluding AWR report
There are queries that return of:
10 SQL albums when the excution
10 high CPU load SQL
10 SQL albums by number of day
On ORACLE_HOME/rdbms/admin?
Or somewhere else?
Where can I find them?
Thank you.
select c.* from
(select disk_reads,
buffer_gets,
rows_processed,
executions,
first_load_time,
sql_text
from v$sqlarea
where parsing_user_id !=0
order by
buffer_gets/decode(executions,null,1,0,1,executions) desc ) c
where rownum < 11;
select c.* from
(select disk_reads,
buffer_gets,
rows_processed,
executions,
first_load_time,
sql_text
from v$sqlarea
order by
disk_reads/decode(rows_processed,null,1,0,1,rows_processed) desc ) c
where rownum <11;
--Top 10 by Buffer Gets:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
buffer_gets, executions, buffer_gets/executions "Gets/Exec",
hash_value,address
FROM V$SQLAREA
WHERE buffer_gets > 10000
ORDER BY buffer_gets DESC)
WHERE rownum <= 10
;
--Top 10 by Physical Reads:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
disk_reads, executions, disk_reads/executions "Reads/Exec",
hash_value,address
FROM V$SQLAREA
WHERE disk_reads > 1000
ORDER BY disk_reads DESC)
WHERE rownum <= 10
;
--Top 10 by Executions:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
executions, rows_processed, rows_processed/executions "Rows/Exec",
hash_value,address
FROM V$SQLAREA
WHERE executions > 100
ORDER BY executions DESC)
WHERE rownum <= 10
;
--Top 10 by Parse Calls:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
parse_calls, executions, hash_value,address
FROM V$SQLAREA
WHERE parse_calls > 1000
ORDER BY parse_calls DESC)
WHERE rownum <= 10
;
--Top 10 by Sharable Memory:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
sharable_mem, executions, hash_value,address
FROM V$SQLAREA
WHERE sharable_mem > 1048576
ORDER BY sharable_mem DESC)
WHERE rownum <= 10
;
--Top 10 by Version Count:
set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
version_count, executions, hash_value,address
FROM V$SQLAREA
WHERE version_count > 20
ORDER BY version_count DESC)
WHERE rownum <= 10
;
Tags: Database
Similar Questions
-
Hello
How can I find the 10 top sql queries which many high IO, CPU. in oracle db.
I do it in a way that using the command TOP trying to get the PID then I get the sql query by applying the hash value in v$ sqlarea.
Y there is it possible to get directly high consumed IO and CPU with see PID in TOP command.
ThanksHello
try something along the lines of
select c.* from (select disk_reads, buffer_gets, rows_processed, executions, first_load_time, sql_text from v$sqlarea where parsing_user_id !=0 order by buffer_gets/decode(executions,null,1,0,1,executions) desc ) c where rownum < 11; select c.* from (select disk_reads, buffer_gets, rows_processed, executions, first_load_time, sql_text from v$sqlarea order by disk_reads/decode(rows_processed,null,1,0,1,rows_processed) desc ) c where rownum <11;
or even
--Top 10 by Buffer Gets: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, buffer_gets, executions, buffer_gets/executions "Gets/Exec", hash_value,address FROM V$SQLAREA WHERE buffer_gets > 10000 ORDER BY buffer_gets DESC) WHERE rownum <= 10 ; --Top 10 by Physical Reads: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, disk_reads, executions, disk_reads/executions "Reads/Exec", hash_value,address FROM V$SQLAREA WHERE disk_reads > 1000 ORDER BY disk_reads DESC) WHERE rownum <= 10 ; --Top 10 by Executions: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, executions, rows_processed, rows_processed/executions "Rows/Exec", hash_value,address FROM V$SQLAREA WHERE executions > 100 ORDER BY executions DESC) WHERE rownum <= 10 ; --Top 10 by Parse Calls: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, parse_calls, executions, hash_value,address FROM V$SQLAREA WHERE parse_calls > 1000 ORDER BY parse_calls DESC) WHERE rownum <= 10 ; --Top 10 by Sharable Memory: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, sharable_mem, executions, hash_value,address FROM V$SQLAREA WHERE sharable_mem > 1048576 ORDER BY sharable_mem DESC) WHERE rownum <= 10 ; --Top 10 by Version Count: set linesize 100 set pagesize 100 SELECT * FROM (SELECT substr(sql_text,1,40) sql, version_count, executions, hash_value,address FROM V$SQLAREA WHERE version_count > 20 ORDER BY version_count DESC) WHERE rownum <= 10 ;
You may need to play with the column formatting a bit to show the best results
concerning
Alan
Published by: alanm on December 22, 2008 16:01
-
top 10 SQL only for PeopleSoft
Hello
on HRCM91, tools 8.52 on Oracle DB 11 G R2,.
How to query the Oracle DB to have 10 albums SQL only for PeopleSoft?
There are actually in v$ sqlarea all text in sql. How to choose only those of PeopleSoft?
Thank you.You can use CWA and ADDM reports. That would be advice you which ran for schema SYSADM (PeopleSoft) since the record names. you will find many other details as well.
Thank you
-
Dear experts,
Version of Oracle - 11.1.0.7
Do we not have a way to draw 10 albums SQL (physical readings) for a period of 24 hours based on the AWR data or other points of view V$.
Thank youDBA_HIST_SQLSTAT, all you can say is that was the user of the analysis.
Not the user running.DBA_HIST_SQLSTAT is therefore insufficient for queries that are executed several times by several users, and there is not a lot of solution.
You could have a glance in the underlying data from the ASHES - V$ ACTIVE_SESSION_HISTORY and DBA_HIST_ACTIVE_SESS_HISTORY which is respectively sampled data and a sample of a sample and it could give an indication of who is running.
Published by: Dom Brooks on July 19, 2012 10:18
Part of sentence was missing -
SQL Server 2012 and NUMA - practical implications
Hello
I read up on top of SQL Server and NUMA, with ESXi 5.1 in mind. I read that I should use the same NUMA architecture on hosts - this means in practice, I should use the same type, RAM speed, etc. when my guests? I want to know if my HP servers have the same NUMA architecture, but so far I was not able to find much information about it.
I think just buying identical hardware to make sure that I understand.
Thank you
Hardware identical is certainly a big plus when your guest has related to NUMA optimizations, and your comments and request can take advantage of them. With vNUMA, the optimization level and the benefits provided by the latter depends on the guest, as well as the material, so have the same host NUMA architecture will provide the most benefits. The performance guide (http://www.vmware.com/pdf/Perf_Best_Practices_vSphere5.1.pdf)
has additional details.
-KjB
-
Dear expert operator SQL Set,
I have 5 queries that run in the database lists top 15 SQL ID, based on the highest - physical reads, buffer gets, executions Total, elapsed time and Cluster waiting respectively by each of the query. There will be a few common SQL identifiers that will appear in the result set of multiple queries. I would like to examine all 5 applications together and report SQL ID, sorted by number of appearances desc hight. How can this be achieved?
If we consider 2 sets of results, a simple "INTERSECT" operator will do the job. What happened in my case? All thoughts... appreciate your help.
Thank you.I just used the clause to generate data, given that I don't have something practical to use than real queries. If you want the sentence using the clause instead of views online, it's like:
with reads as ( select * from (select sql_id from dba_maint.DB_HIST_SQLSTATS where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 ) group by sql_id order by sum(disk_reads_delta) desc) where rownum < 16), gets as ( select * from (select sql_id from dba_maint.DB_HIST_SQLSTATS where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 ) group by sql_id order by sum(buffer_gets_delta) desc) where rownum < 16) select sql_id , count(*) from (select sql_id from reads union all select sql_id from gets) group by sql_id order by 2 desc;
Each
as block is actually a view online, to separate from the main logic of the request for clarity (personal or lifestyle preference :-))) You could also easily do without the with as:
select sql_id , count(*) from (select * from (select sql_id from dba_maint.DB_HIST_SQLSTATS where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 ) group by sql_id order by sum(disk_reads_delta) desc) where rownum < 16 union all select * from (select sql_id from dba_maint.DB_HIST_SQLSTATS where PARSING_SCHEMA_NAME in ('GLOGDBA','SNIOTM','OEM_READ') and trunc(BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1 ) group by sql_id order by sum(buffer_gets_delta) desc) where rownum < 16) group by sql_id order by 2 desc;
John
-
Difference between SQL and PL/SQL
Hello
Wrong if I say:
SQL only access the database (under the hood)
PL/SQL is a layer on top of SQL.
Correct me if I'm wrong
Thank youuser12045475 wrote:
Try to understand, it is true what I write below?
What exactly is BC ? Cache buffers?
SQL:
Select *...
data-online BC-online client memory fileAll SQL are analyzed as a SQL cursors. A handful of customer for this SQL cursor is returned to the caller. In the APIs such as ODBC, it is a statement handle. In PL/SQL, this is called a variable from PL/SQL cursor for example.
The client now called the interface extraction (using this handle) for this SQL cursor. The data moves from the (buffer cache/LMS) database to the client variables that will receive this output cursor.
If the client is remote, the data moves over TCP. If the client is local, that data travels via IPC (since the process of the Oracle server to the client process).
If this customer is the PL/SQL, the data moves from area (SGA) memory to another (PGA) within the same server process. This is the fundamental reason why PL/SQL will always be better than other clients as the travel itinerary data from the SQL cursor for the client variables/extraction buffer is very short.
Insert * select
data-online BC-online data file fileSame process as above. Only, the customer data from the database. It retrieves data from a table and inserts the data into another table - in the same cursor. The SELECTION of this slider component sends not all selected customer lines.
This highlights a fundamental approach to Oracle called SQL maximize and minimize the PL/SQLdevelopment.
The SELECT could be done via a dedicated slider. With the client by pulling all lines so that the database in the memory of the client. So, the INSERT could be done (also a dedicated slider) and the same data that is pushed back to the database.
So for this approach, data will be make to the customer, then from the client to the database database. It's quite a detour for travel. The same same thing could be done using a simple SQL cursor (as opposed to two dedicated sliders). And this slider could make reading and writing lines, without sending the data via a detour through the memory of the client.
The underlying concept is to optimize the use of SQL - solve both the problem of data processing in SQL itself. And if it is not really feasible using only SQL, then consider using the PL/SQL.
PL/SQL:
Select * in...
data file => BC-online PGA? -online client memorySee the answer in the upper part of the 1st sample you posted. This is no different. A SQL cursor is created (called a PL/SQL implicit cursor). The output of this slider is extracted and stored in local client variables (which reside in the PGA for PL/SQL code).
-
AWR time model statistics vs SQL Statistics
Looking at an AWR report took on a unique snapshot interval, I note the following:
In time model statistics, DB time is listed as 161,47 seconds, with sql execute represents the time of 127,83 seconds.
When I DBA_HIST_SQLSTAT to queries on the same cliché and summarize all the elapsed_time_delta of each SQL stored in AWR, I find that it's 132,05 seconds, even after filtering of all PL/SQL (command_type 47) and each SQL with parsing_schema_name SYS.
If anything, I expect this sum less than that contained in the statistics of the model time, thinking that only the top n sql is included in DBA_HISSQLSTAT.
Does anyone know where my reasoning was an error?KDeWeerd wrote:
Detailed analysis of an environment, trying to give meaning to all the numbers and to explain things to people doesn't make not easier if you can not all numbers that collects Oracle corresponding to some how.Yes, I understand. Here you can not because the statistical statement have no knowledge of what what call. This is probably why Oracle introduced the chronological model: it gives information that you can't derive from other sources.
Any timed operation will be buffer at most 5 seconds of time data. This means that if a timed (such as the SQL execution) takes a long period of time to perform, the data published to this point of view lack maximum 5 seconds of the time accumulated for the operation.
Can't really make sense of interpretation which
means that the value may be missed for 5 seconds for each running of instruction.
-
in the dynamic chain of the clause
Select all_group_id in the iolm_subelementgrp where type = "connect";
ALL_GROUP_ID
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3,4,5
requirement:
Select * from iolm_linkthresholdgrp
where group_id in (3,4,5); -How can I put values 'to' article like this dynamically, which is a discount on top of SQL?
Select * from iolm_linkthresholdgrp
where group_id in (select all_group_id in the iolm_subelementgrp where type = 'Connect');
ORA-01722: invalid number
01722 00000 - "invalid number."
* Cause:
* Action:
Happy!
Select regexp_substr('1,20,300','[^,]+',1,level)
of the double
connect by level<=>=>
First see how it works!
It should work-
Select *.
of iolm_linkthresholdgrp
where group_id in)
Select regexp_substr(all_group_id,'[^,]+',1,level)
of iolm_subelementgrp
When type = "sign in".
connect by level<=>=>
);
I hope this helps!
-
SQL_ID in different tables
Hello
on the 11g R2,.
I wonder if there is no common SQL_ID in the following tables:
If yes there is no SQL_ID located at least two of these tables what would be the reason?select sql_id from DBA_HIST_SQLTEXT intersect select sql_id from DBA_HIST_SQLSTAT intersect select sql_id from DBA_HIST_ACTIVE_SESS_HISTORY; no row selected
Thank youIf yes there is no SQL_ID located at least two of these tables what would be the reason?
You combine two tables AWR with a table of repository of ASHES.
It is reaonable to require that all instructions in DBA_HIST_SQLSTAT are stored in DBA_HIST_SQLTEXT.
Here are the tables in AWR and it is reasonable that any sql statement that is in the top N should have the preserved text.But DBA_HIST_ACTIVE_SESS_HISTORY is the repository of ASHES.
The buffer in memory V$ ACTIVE_SESSION_HISTORY is once every second 'snapshot' of all active sessions.
DBA_HIST_ACTIVE_SESS_HISTORY is once every 10 second sample of this snapshot.If SQL N albums directions are a snapshot of the active sessions every 10 seconds so is down to coincidence and circumstance and not something you should read too much into.
Bugs despise or other oddities, it just suggests that your top N SQL instructions do not have tend to be long.
-
Recently I have been thrust into a role of DBA (kicking and screaming). My supervisor put me through the Oracle Sys Admin I & II workshops, but it's a starting point; It seems that many of the features that have been addressed are not used in our environment (ASM, AMM, RMAN, EM) that makes my life less funny!
My job now is to monitor the database for all performance issues, the prevention of proactive failure, the backup and restore (BU / R is managed by NetBackup/BCV with Symmetrix disk mirrored between).
I was an admin systems for many years, and I've been able to generate scripts a few sanitary controls outside the DB; at the level of the BONE. I'm starting to look at some of the views v$ that allow me to see what is happening in our system.
I have a few generalized questions, I would ask (if I need a separate thread for each of the questions let me know and I'll repost):
1. How can I determine what features are used by the database (outside the features mentioned above)?
2. what should be followed on a base < interval > (hourly, daily, monthly)?
3. what should I look for when I followed him? (right now I look at the alert log every day for entries "ORA" - and send alerts...)
I'm sure I'll have many more questions, but these are ones I have on my mind right now.
I apologize for the generality of my questions, I'm sure we'll get more accurate that the discussion continues.
We had the following:
Oracle 11 g 2 HA (Veritas Cluster NOT oracle cluster or grid control) mode running on Solaris 10...
Thanks in advance for helping me understand this complex beast!Hello
1. How can I determine what features are used by the database (outside the features mentioned above)?
A >Under query will give the features that are currently enabled on your database.
Select * option $ v where the VALUE = 'TRUE '.This will give you the details usage report features db if used
Select * from DBA_FEATURE_USAGE_STATISTICS where CURRENTLY_USED = 'TRUE '.
2. what should be followed on a basis
(hourly, daily, monthly)?
A >
S/n should be followed always schedule/carefully, but you can't be human control grid or cronjobs (with automatic e-mail alerts) should be programmed.
AWR/ADDM features are available that allows you to go back in time & see what was going on in DB giving excellent statistics of the DB3. what should I look for when I followed him? (right now I look at the alert log every day for entries "ORA" - and send alerts...)
A >
As grid needs licenses the simplest to be a SYSTEM administrator is to make some shell scripts and place a few jobs long life in cron
This cron so captured ORA-, err, corrupted fail, warning, down, stop channels alerts log
Apart from this you can also have scripts in place for session locking/blocking in DB, cpu/memory/IO TOP consuming SQL at the request to ship you once use Server metrics goes high
One of the most important is alert, space free OS space, tablespace space free sql must always be runing in cron every minThank you
Ajay more
http://moreajays.blogspot.com -
Run to analyze very small... already implemented standard tips
Hi all
I have on my Oracle DB performance problems, checking the AWR I noticed execution parse is very low. I looked into the present and other forums to find a possible root cause for her, but it seems still miss me something. I have already implemented the standard stuff, like optimizing SQL with bind, checking the size of the shared memory and using 'FORCED' as a value of cursor variables. However, I did get no improvement.
AWR shows:
Instance efficiency percentage (target 100%)
My results of the Shared Pool are:Buffer Nowait %: 100.00 Redo NoWait %: 100.00 Buffer Hit %: 99.96 In-mem Sort %: 100.00 Library Hit %: 96.36 Soft Parse %: 98.74 Exe. to Parse %: 9.38 Latch Hit %: 96.86 Parse CPU to Parse Elapsd %:35.17 Non-Parse CPU: 98.41
Which means (I guess) maybe I lose the memory, but not that I'm not short on this subject.Memory Usage %: 55.11 55.71 % SQL with executions>1: 77.53 34.35 % Memory for SQL w/exec>1: 60.21 17.57
When I look in the top ten SQL sorted by Parse calls, I find statements like:
For each of them, "Analyze calls" is very close to "Executions".1) select to_char(sysdate, 'YYYY-MM-DD hh24:mi:ss') into :b0 from DUAL 2) select lib_infospec into :b0 from table where ((field1=:b1 and field2=:b2) and field3='X') 3) select SOME_THING.item into :b0 from DUAL 4) select something from table where ((field1=:b0 and field2=:b1) and field3=:b2)
My questions:
-I'm looking for the correct indicators? Do you have any other suggestions?
-Why the two select statements double is always re-analysis? which can be avoided? How?
-Since my cursor_sharing = force, why field3 = 'X' instead of a host variable in SQL statement nr.2?
-Why SQL instruction nr. 4, which seems optimized for me, is re-arsed every time?
Unfortunately, I can't post the full CWA, but I'll be happy to provide any additional information.
Thanks in advance for your help,Welcome to the forum.
Do you or developers use prepared statements?
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:952783600346103200 #1643762500346954286
-
Is it possible under the ORDER BY clause to not have null values climb on top
Examples:
SQL code...
ORDER BY
BL / / DESC
~*~*~*~*~*~*~*~
RESULT
bl*
(null)
8675309
--------------------------------------
ORDER BY
BL CSA
RESULT
bl*
(null)
8675309
Any thoughts?Yes, you can
select * from emp order by comm NULLS LAST ; OR select * from emp order by comm NULLS FIRST;
SS
-
In SQL Server, I can do something like the following:
Select top 1 * from [table] by id asc;
He would return the first record in the table after the results had been ascending order. I know I can use ROWNUM to get something to use command 'top' of SQL Server, but I remember hearing that Oracle will ignore my ORDER BY clause and simply return the first record, regardless of the order. What is the best way to get the same result that SQL Server would return?
In addition, where it's important, it will be to a 9i database.Use online viewing:
select * from (select * from table order by id asc) where rownum =1;
-
How can I fix this error? Thank you.
SQL server installation is either corrupt or has been tampered with. Please uninstall and run again together at the top.Hi DMarie125,
The question you have posted is better suited to the MSDN forums. You can ask your question in the help link.
http://social.msdn.Microsoft.com/forums/en/category/SQLServer/
Hope the helps of information.
Maybe you are looking for
-
Pavilion 550z: is the A6 AMD processor - 8550 Quad Core or not?
I am mixes signals that the AMD a6-8550 processor is Quad Core or not. As I read the document of AMD for this processor, I see that it contains 2 CPU and 4 GPU (a "APU" using architecture HSA). But in the announcement of HP, it explicitly says "Qua
-
Qosmio X 870-need driver graphic udpate due to gambling problems
Hello I want to update my driver, because most of the games do not work as expected. I installed 295.55 version.Toshiba offer own display driver for my laptop, but I saw many of you is nvidia mobile driver. While we can use? I need to update my graph
-
.shtml association to HTML documents
HelloI am running Windows XP on an Equium A100. In my 'files types,' SHTML files are associated by txt document and are open with Notepad. I need to be associated with HTML files and open with Internet Explorer, the SHTML files.I tried to use the inf
-
ListBox with visible horizontal scrolling
Hello We all know that a listbox control comes with a default vertical scroll bar (which can be selected or deselected). I have attached a vi that has the list box with visible horizontal scroll bar. Now, I did my self by playing with custom control
-
I've installed a registry cleaner but was taken aback. vacuuming has highlighted a suggestion that it requires a resolution of 1024 x 700, and the highest resolution for Intel GMA 3600 is 1024 x 600. I want to create a resolution custom above in supp