Last Query Monitor
We have a windows application that uses 3rd party tools to access the database. The 3rd party tool is created by DevExpress.
We need something that will let us know what the queries are that are being executed against the database.
We are having trouble with the query being to slow against a certain setup:
- I have a table that is partitioned by month.
- Each month has about 8 - 10 million records in it.
Initially to do the query against the data, it was taking about 10 seconds with the application. But if I used SQL Tools or SQL Developer, the same query would take about 0.002 seconds.
I decided to take all the data from one partition and create its own temporary table. After doing this, I also created the same indexes on it, that the other table had as well. Testing the application and the SQL tools both returned in a timely manner.
One thing that I did do to the large partitioned database was run the following on it:
ANALYZE table "cust_positions" compute statistics;
After doing that, the query time for the application went from 10 seconds to about 4-6 seconds.
One thing that I have found is that SQL Developer will give hints on what indexes the database should use to get the data. The 3rd party tools don’t do this, and if it does, i have not figured out how to do it.
What I would like to be able to see is, what are the 3rd party tools actually querying on, is the Oracle optimizer actually doing anything? (Not really sure on a lot for how the optimizer works, I looked at the oracle documentation for it, and there is just too much to read)
I would like to make sure that the query being run by my 3rd party tools is using the indexes.
Thanks
Chad
Chad, what is the full Oracle version?
You should be able to use the sql trace option to trace a session and get the raw trace of the session activity. You can feed the trace file to tkprof to format it for you if you do not have experience working with trace files.
Also you can look in the v$open_cursor to see some of the SQL executed by a session. You can then run explain plan on the SQL and look for the SQL in v$sql_plan view to see what Oracle actually did with the SQL.
See your Performance and Tuning manual for information on Statspack/AWR which can be used to look at the db as a whole and which also capture heavy hitter SQL.
HTH -- Mark D Powell --
Similar Messages
-
Error while Opening any Query from Query Monitor and Query Designer.
Hill All,
I was trying activate activate the Web templates for SRM, all the templates are activated and i am landed in a new problem. when ever i am trying to open a qery thru query Monitor(RSRT), i am popped with the Short dump.
Short Dump Description:
What happened?
Error in the ABAP Application Program
The current ABAP program "CL_RS_PERS_PHK================CP" had to be
terminated because it has
come across a statement that unfortunately cannot be executed.
The following syntax error occurred in program "GP48WGGNR675NB9JBTAGV72K4CT "
in include "GP48WGGNR675NB9JBTAGV72K4CT " in
line 29:
"The type "/BI0/APERS_BOD00" is unknown."
The include has been created and last changed by:
Created by: "CBI_BALAJID "
Last changed by: "CBI_BALAJID "
and when i try to debug the program "GP48WGGNR675NB9JBTAGV72K4CT"
the error is shown at the code level:
form pers_read
tables e_t_data structure RSPER_S_RETSTRU_BOD
using i_maxrows type i
i_t_sel type rsper_t_select
changing e_subrc type sy-subrc.
data: l_t_data type /BI0/APERS_BOD00 occurs 0.
data: l_s_ft like /BI0/APERS_BOD00.
data: l_s_sel type rsper_s_select.
field-symbols: <l_s_data> type /BI0/APERS_BOD00.
i am unable to find the info object APERS_BOD00. where as the error is pointing to sid table of the object.
that's urgent,Some one Plese resolve the issue.Points will be rewarded for the usefull answers.
Thanks in advance
Balaji Donepudi.
098266-89888Hi,
Check for the consistency of the info object in RSRV.
Check the info object status in cube like any data is available or not for that info object.
Also check any parralel load is taking place in that particular cube.
Please let me know if u face probelm
Thanks
Kind Regards,
Shanbagavalli.S -
How can i now the number of rows afected by the last query?
how can i now the number of rows afected by the last query?
For example:
i made this update :
update trl_trial set status = 1 /* Validation */
where trial_id = cobject_id
and status = 0; /* Initial */
if NUMBERS_OF_ROWS = 0 then
end if;
how can i do this?
thank u!!!!how can i now the number of rows afected by the last query?
For example:
i made this update :
update trl_trial set status = 1 /* Validation */
where trial_id = cobject_id
and status = 0; /* Initial */
if NUMBERS_OF_ROWS = 0 then
end if;
how can i do this?
thank u!!!! Do the following :
update trl_trial set status = 1 /* Validation */
where trial_id = cobject_id
and status = 0; /* Initial */
if(SQL%ROWCOUNT = 0 ) then
else
end if;
you can also declare a variable and do
myvar := SQL%ROWCOUNT;
SQL%ROWCOUNT returna the # of rows afected by any sql
statement, like DELETE, UPDATE -
Get the last query from the current user
Is there a way to get the last query of the current user, so every query could be log with a database trigger?
Let's just say I execute:
DELETE xxxx;
I tried :
SELECT T.SQL_TEXT FROM V$SQLAREA T where ADDRESS=(SELECT prev_sql_addr FROM v$session where audsid=userenv('sessionid'));
But the result of this query is :
'SELECT T.SQL_TEXT FROM V$SQLAREA T where ADDRESS=(SELECT prev_sql_addr FROM v$session where audsid=userenv('sessionid'))'
Is there a way to execute a query that would return :
'DELETE xxxx'
ThanksYou could join SQL_ADDR in v$session with ADDRESS in v$sqlarea to determine the SID that executed that SQL statement last. Note that PREV_SQL_ADDR in v$session will indicate the previous SQL he executed. Though you would have to look at these tables very often to get all SQL statements issued. One note here, I think if a different user ran the SAME SQL with just bind var differences the SQL_AREA will only show the last userâs information that executed it.
BTW - it will show deletes also... -
Hi,
Can anybody help me step by step how to use last query
I have like this
I have a form .So user can search records based on query
i have like this
EMPNO EMPNAME LAST_YEAR
10 a 1991
10 B 1991
20 C 1994
If user queries on EMPNO = 10
EMPNO EMPNAME LAST_YEAR
10 a 1991
10 B 1991
I have a button name UPDATE LAST YEAR
when user press the button
EMPNO --10
from 1991 TO--1994
OK CANCEL
When user press the OK button i need to update the lastyear from 1991 to 1994
i can do this its working fine
My cocern here is when user press the OK button
It should bring up the records with 10 and update year
I mean to use the last query
Any help step by step
I user default_where it is not working
Thanks for your helpCREATE OR REPLACE PROCEDURE demo(salary IN NUMBER) AS
cursor_name INTEGER;
rows_processed INTEGER;
BEGIN
cursor_name := dbms_sql.open_cursor;
DBMS_SQL.PARSE(cursor_name, 'DELETE FROM emp WHERE sal > :x',
dbms_sql.native);
DBMS_SQL.BIND_VARIABLE(cursor_name, ':x', salary);
rows_processed := dbms_sql.execute(cursor_name);
DBMS_SQL.close_cursor(cursor_name);
EXCEPTION
WHEN OTHERS THEN
DBMS_SQL.CLOSE_CURSOR(cursor_name);
END;
You find the complete information in the 'Oracle8i Supplied PL/SQL Packages Reference' of the oradoc816 docs.
If you give me your email address, I can send you a pdf file with this information.
Martine. -
It is required to get the result set from the last query.
I need this SP to return the result set from the last query.
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
alter proc spQ_GetASCBillingRateIDs2
@ScheduleID CHAR(15),
@startdate smalldatetime,
@enddate smalldatetime
as
set nocount on
truncate table tbltmpgroup
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tbltmptbltest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tbltmptbltest]
exec sp_CreateTblTmpGroup
insert into tbltmpgroup
SELECT DISTINCT
case when pd.billparent = 'N' then org.eligibleorgid
else isnull(af.parentid, org.eligibleorgid) end as billorgid,
pd.individualbill , pd.cobrabill, pd.billparent,
org.eligibleorgid, org.polid, org.orgpolicyid,
pp.planid, pp.rateid,
ps.ascinvoicedate,
case when ps.ascclaimfromdate > @startdate then ps.ascclaimfromdate
else @startdate end as premiumrundayFrom,
case when ps.ascclaimtodate < @enddate then ps.ascclaimtodate
else @enddate end as premiumrundayTo,
fts.effdate, fts.termdate,
case when fts.effdate > @startdate then fts.EffDate
else @startdate end as ascStartDate,
case when fts.termdate < @enddate then fts.termdate
else @enddate end as ascEndDate
FROM premiumschedule ps (nolock)
inner join orgpolicy org (nolock)
on org.ascinvoicerungroup between ps.premiumrundayfrom and ps.premiumrundayto
inner join FundingTypeStatus fts
on fts.orgpolicyid = org.orgpolicyid
and fts.fundtype = 'ASC'
and ((fts.effdate between @startdate and @enddate)
or (fts.termdate between @startdate and @enddate)
or (fts.effdate < @startdate and fts.termdate > @enddate))
inner join eligibilityorg o (nolock)
on org.eligibleorgid = o.eligibleorgid
inner join policydef pd (nolock)
on pd.polid = org.polid
inner join policyplans pp (nolock)
on pp.polid = org.polid
inner join program p (nolock)
on pd.programid = p.programid
left join orgaffiliation af with (nolock)
on org.eligibleorgid = af.childid
WHERE ps.premiumscheduleid = @ScheduleID
AND org.orgpolicyid <> ''
go
SELECT DISTINCT z.rateid, e.enrollid, z.ascstartdate, z.ascenddate
into tbltmptbltest FROM enrollment E (nolock)
inner join tbltmpgroup z
on e.rateid = z.rateid
go
CREATE UNIQUE CLUSTERED INDEX IDXTempTable ON tbltmptbltest(enrollid)
create index IDXTemptableDates on tbltmptbltest(ascstartdate,ascenddate)
go
select distinct t.*
from tbltmpgroup t
where rateid in (
select distinct t.rateid from VW_ASC_Billing)
order by billorgid
set nocount off
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GOPlease 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 have no idea).
Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
What you did post is bad SQL.
The prefix “tbl-” is a design flaw called tibbling and we do not do it. We seldom use temp tables in RDBMS; it is how magnetic tape file programmers fake scratch tapes.
If the schema is correct, then SELECT DISTINCT is almost never used.
Your “bill_parent” looks like a assembly language bit flag; we never use those flags in SQL.
“Funding_Type_Status” is an absurd name for a table. A status is a state of being, not an entity. A type is an attribute property. So this table ought to be column that is either a “funding_type” or “funding_status” (with the time period for the state of being
shown in other columns). But this hybrid is not possible in a valid data model.
Want to try again, with DDL and some specs?
--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 -
Last query refresh failde due to internal errors ?
Hi gurus
we are working on SRM 7.0 with PPS,
when Bidder tries to open his login page and wants to see the Rfx raised against him, He is getting error message,
" Last query refresh failed due to internal error" , some time this is due to another session witht he same query is open , but
I am getting the same error in the following situation,
suppose bidder has submittted his response and after submission he is trying to change the response and couldn't submit before the submission dead line then the version of the response will be c1, and which is not interpreted by the system, and so the error is .
Any help or advice on the issue is highly appreciated.
Regards
NITIN
Edited by: nitinkk on Jan 12, 2012 7:55 AMDear Rahul,
Thanks for replay,
I have checked it but the issue comes with the discribe procedure.
and we have solved it now.
Regards
NITIN -
How to find last query executed?
Hi All
Can anyone tell as to how can we view the last query executed?
Do we need to write any script for it?
Cheers
Sudhir> connect to sys user then type this script
Brilliant.
SQL> select sql_text from v$sql where first_load_time=(select max(first_load_time) from v$sql) ;
SQL_TEXT
select sql_text from v$sql where first_load_time=(select max(first_load_time) from v$sql)
SQL> -
Hi,
I am new to sap bi. I know we can check the performance of the query through query monitor through rsrt. But by looking at which field we will come to know that query performance is slow in the query monitor
Thanks in advance
krishHi,
Goto RSRT transaction --> Give query name --> Query Disply as "HTML" > Execte + Debug> --> Continue. Qury will be executed.
Follow below steps to find out the query execution time:
Now goto SE11 > Give table name as RSDDSTAT_DM or RSDDSTAT_OLAP in BI7.0 or RSDDSTAT in BW3.x.> Display -> Contents-> Give from date and to date values as today, user name as your user ID, and give the query name in the Object name field--> execute.
Now u'll get a list with fields like Object anme(Report anme), Time read, Infoprovider name(Multiprovider), Partprovider name (Cube), Aggregate name... etc.
The time read represents the time taken to execute the query.
If the time read is less than 100,000,000 (100 sec) is acceptable. If the time read is more than 100 sec then we take decision to create Aggregates for that query to increase performance.
Hope it helps you...
With Regards
kulwinder -
Query cache,query monitor
Hi
wt is the purpose of Query monitor and query cache.. can u plz.. explain
ponts assured*
Regards
RekhaAs the verbeage indicates, query monitor is to monitor the runtime performance of BW queries. Query monitor is one of the tools in BW to monitor the query performance. The transaction to run query monitor is RSRT.
In RSRT, you can exceute queries in various modes and you can to some extent enforece a query to be executed in a certain path; For example, you can simulate the execution of q query without using a aggregate, without using cache, etc.
In monitor you can also view how the query is getting executed and diagnose the possible causes as to why a query is running slow.
Caching is to store the query results in the memory of the BW system's application server. If you cache a query, the run time performance will improve considerably, because the result ste is stored in the meonry and every time when the query is run, the OLAP engine will not have to read the data base to fetch the records.
The query caching has some limitations; if the query result changes, the cache will not help, because the new result set has to be again read from database and presented.
You can get more on this in help.sap.com
Ravi Thothadri -
Displaying the Last Query Refresh date/time
Hello,
on a Webi report, is there a way to display the date/time that the underlying info provider was refreshed?
Thanks,
Nikhi1.- Create Formula in Query (columns - Create Formula)
2.- Create Formula Variable for this Formula (Type Customer EXIT) as individual and optional.
3.- Define the code for customer exits for variables.
*-- To get Timestamp for last load of data to cube
WHEN 'ZLSTLOADDT'.
DATA: lt_tab_1 TYPE TABLE OF rsdcubemulti,
ls_tab_1 TYPE rsdcubemulti,
lt_tab_2 TYPE TABLE OF rsmonicdp,
ls_tab_2 TYPE rsmonicdp.
DATA: l_calday TYPE d,
l_time TYPE sy-uzeit,
l_tzone TYPE ttzz-tzone,
l_string TYPE char20.
SELECT * FROM rsdcubemulti INTO TABLE lt_tab_1
WHERE infocube = i_s_cob_pro-infoprov
AND objvers = 'A'.
SORT lt_tab_1 DESCENDING.
CLEAR ls_tab_1.
READ TABLE lt_tab_1 INTO ls_tab_1 INDEX 1.
REFRESH lt_tab_2.
SELECT * FROM rsmonicdp INTO TABLE lt_tab_2
WHERE icube = ls_tab_1-partcube.
SORT lt_tab_2 DESCENDING.
CLEAR ls_tab_2.
READ TABLE lt_tab_2 INTO ls_tab_2 INDEX 1.
l_tzone = 'INDIA'. "CET, UTC...
CONVERT TIME STAMP ls_tab_2-timestamp TIME ZONE l_tzone
INTO DATE l_calday "aaaammdd
TIME l_time. "hhmmss
l_s_range-low = l_calday.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
EXIT.
WHEN 'ZLSTLOADTM'.
DATA: lt_tab_1 TYPE TABLE OF rsdcubemulti,
ls_tab_1 TYPE rsdcubemulti,
lt_tab_2 TYPE TABLE OF rsmonicdp,
ls_tab_2 TYPE rsmonicdp.
DATA: l_calday TYPE d,
l_time TYPE sy-uzeit,
l_tzone TYPE ttzz-tzone,
l_string TYPE char20.
SELECT * FROM rsdcubemulti INTO TABLE lt_tab_1
WHERE infocube = i_s_cob_pro-infoprov
AND objvers = 'A'.
SORT lt_tab_1 DESCENDING.
CLEAR ls_tab_1.
READ TABLE lt_tab_1 INTO ls_tab_1 INDEX 1.
REFRESH lt_tab_2.
SELECT * FROM rsmonicdp INTO TABLE lt_tab_2
WHERE icube = ls_tab_1-partcube.
SORT lt_tab_2 DESCENDING.
CLEAR ls_tab_2.
READ TABLE lt_tab_2 INTO ls_tab_2 INDEX 1.
l_tzone = 'INDIA'. "CET, UTC...
CONVERT TIME STAMP ls_tab_2-timestamp TIME ZONE l_tzone
INTO DATE l_calday "aaaammdd
TIME l_time. "hhmmss
l_s_range-low = l_time.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
EXIT. -
Hi,is it possible to get the number of records of the last SQL-Query inside a Stored Procedure.
I´m trying to get my Stored Procedure faster and the problem is, that there are many code snippets like the following:
--check if there are any records
Select count(*) INTO v_cnt FROM XXX WHERE XXXX=XXXX;
--if there are records
IF v_cnt > 0 THEN
--get the data of this records
SELECT a,b,c INTO v_a,v_b,v_c FROM XXX WHERE XXXX=XXXX;
END IF;
Now i want to solve this with one SQL-Statement.
BEGIN
SELECT a,b,c INTO v_a,v_b,v_c FROM XXX WHERE XXXX=XXXX;
--Catch the "No data found"-Exception
EXCEPTION WHEN OTHERS THEN
NULL;
END;
IF (??theglobalvariablethatisearch??) > 0 THEN
END IF;
Is there such a "global Variable" in Oracle SQL??
ThanksWhy not eliminate the IF altogether? If NO_DATA_FOUND isn't raised, the number of rows must be > 0
BEGIN
SELECT a,b,c
INTO v_a,v_b,v_c
FROM XXX
WHERE XXXX=XXXX;
<<contents of the THEN clause of your IF statement>>
--Catch the "No data found"-Exception
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Script to query / monitor logins to Servers
Not sure if I'm in the right forum, apologies if I'm not. Not sure where this should go ... anyway, is it possible to query username logins to Windows Server 2008?
Information needed:
1) Username
2) date / time login
3) date / time logoff
Preferably, a way to query multiple servers at one go into an Excel file or something. And not using some freeware or additional installs.
ThanksYou'll need to turn on some auditing. This one may help.
http://support.microsoft.com/en-us/kb/556015
As far as scripting something here may work.
https://gallery.technet.microsoft.com/scriptcenter
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights. -
Hi all,
DB version : 11.2.0
OS version : RHEL 5.5
I have enabled auditing at the database level. Can anyone let me know how could i find out which query was executed by the user 2 hours before. I am not sure how could i find the query using AUDIT. Just able to see all the trace files generated in AUDIT file destination.
Thanks in advance....
Regards,
Imran Khanif AUDIT_TRAIL is DB ,use below query
COLUMN username FORMAT A10
COLUMN owner FORMAT A10
COLUMN obj_name FORMAT A10
COLUMN extended_timestamp FORMAT A35
SELECT username,
extended_timestamp,
owner,
obj_name,
action_name
FROM dba_audit_trail
WHERE owner = '&ENTER_USERNAME'
ORDER BY timestamp;if audit trail is XML,trybelow
COLUMN db_user FORMAT A10
COLUMN object_schema FORMAT A10
COLUMN object_name FORMAT A10
COLUMN extended_timestamp FORMAT A35
SELECT db_user,
extended_timestamp,
object_schema,
object_name,
action
FROM v$xml_audit_trail
WHERE object_schema = '&ENTER_USERNAME'
ORDER BY extended_timestamp; -
Growing query size while appending last query.
Hi!
I've got few blocks on my ORACLE FORMS form. Blocks A and B are connected by the master-detail relation. I've got table of records from B and above the table I've got buttons which sort this table. It's done by setting order by clause and then calling EXECUTE_QUERY.
Before I call execute_query I want to rewrite last_query not to lose previously set filters. I know that last_query contains default_where so not to have it repeated many times in a query I replace default_query with last_query before execute_query and revert after it.
My case is like this:
Block SPRAWY with item ID is master for block SPAWY_TYT with item ID_WNIOSKI.
On block SPRAWY_TYT I've got 'default where' set to ID_WNIOSKI = :SPRAWY.ID.
When I call my sort procedure (click button) I'm getting last_query's (from block SPRAWY_TYT) where clause like: "ID_WNIOSKI='9' AND (ID_WNIOSKI='9')".
After next click last_query looks like: "ID_WNIOSKI='9' AND (ID_WNIOSKI='9') AND (ID_WNIOSKI='9')" and it's growing with each click.
Final question:
Where this part "(ID_WNIOSKI='9')" comes from and how can I remove it from last_query (I mean universal solution not depending on particular item or relatioin name)?
Regards,
ArturHi, Amrit,
Do you just want 9 copies of the selected rows from mth_dim_hierarchy, each with all the columns the same except for level_num?
If so, cross-join mth_dim_hierarchy with a Counter Table , that is, any table (or, as in this case, result set) with 9 rows. For example:
WITH cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 9
SELECT c.n AS LEVEL_NUM
, To_Date ('01-JAN-1900','DD-MON-YYYY') AS EFFECTIVE_DATE
, -99999 AS LEVEL_KEY
, 'Unassigned' AS LEVEL_NAME
, -99999 AS PARENT_KEY
, 'Unassigned' AS PARENT_NAME
, MDH.HIERARCHY_ID
FROM MTH_DIM_HIERARCHY MDH
CROSS JOIN cntr c
WHERE MDH.CREATION_DATE >= v_log_from_date
AND MDH.DIMENSION_NAME = 'EQUIPMENT'
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
In the case of a DML operation (such as MERGE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
Explain, using specific examples, how you get those results from that data.
Simplify the prole, if possible. If you can show what you need to do with 3 distinct values of level_num, don't post a problem with 9 distinct values.
Always say what version of Oracle you're using.
Maybe you are looking for
-
A different way to deal with "unknown" user after upgrade from Tiger.
It's a known issue that doing upgrade and install or archive and install from Tiger to Leopard, produces a lot of folders with "unknown" group in their "get info" panel. This has to do with a different group structure in Tiger and Leopard. In Tiger,
-
How do I define server-side spam rules with Yosemite & Server 4
Really surprised that this isn't functionality available in the server UI. Poking around in the dovecot/spamassassin docs imply this is possible using sieve, but the configuration looks more complex than I'd like to have to figure out on my own. It s
-
OK, i have to do a project that has to be done SOON, so the faster the response, the better. Is there any way for me to make the fps larger but keep the time the same? e.g.: a 30 second clip at 10 fps, but changing it to 30 fps while still maintainin
-
h:column attribute??
heya :) are there any attibutes that I can add to this tag? for example i would need it: <h:column rendered="#{mybean.showUp}" something here to load from database <h:column/> other wise i have to reuse the whole <h:dataTable> structure twice (have i
-
Hello, I need to calculate a list of people, who got some services more that 2 times with the same service koda (pas_kodas) to the same person (zmo_kodas). It should not depend on report number. http://www.gentoo.lt/sql.jpg What I get is in green (se