How to get the sql which executing?
I want to know the query sql runing in timesten? how can I get it?
For example, in oracle 9i we can use below sql to get the query sql runinig in oracle.
1.select OSUSER, PROGRAM, USERNAME, SCHEMANAME, B.Cpu_Time, STATUS, B.SQL_TEXT
2. from V$SESSION A
3. LEFT JOIN V$SQL B ON A.SQL_ADDRESS = B.ADDRESS
4. AND A.SQL_HASH_VALUE = B.HASH_VALUE
5. order by b.cpu_time desc
thanks!
Sorry, there is no way to get this information in TimesTen. You can use internal tracing to see each SQL statement as it is executed but (a) the performance hit is severe and (b) there is no timing or CPU usage information available.
If you want to know how long a specific SQL statement takes to execute you need to add timing instrumentation to your application code.
Chris
Similar Messages
-
?How to get the SQL being executed
Hi, this is a 2 part question, note that I'm using 10.1.0.3:
1) When running queries against a ROLAP cube (using BI Beans or the Excel addin), how can I trace the SQL that is being executed?
2) When using a MOLAP cube, its no longer required to "enable" the cube for SQL access. However, my question is, if I want to query it using a standard SQL tool, how do I do this? It doesn't seem like there are any views, etc. that I can query against?
Thanks!
ScottHi Scott,
1) When running queries against a ROLAP cube (using BI Beans or the Excel addin), how can I trace the SQL that is being executed?
Tracing the SQL that is executed by a session is a fairly well documented process. Basically, you can either enable tracing for your own personal session, or you can enable tracing for someone else's session. See http://www.petefinnigan.com/ramblings/how_to_set_trace.htm for a pretty definitive writeup, or http://www.rittman.net/work_stuff/tracing_owb_mappings_pt1.htm for example of using trace with OWB (similar sort of concept)
2) When using a MOLAP cube, its no longer required to "enable" the cube for SQL access. However, my question is, if I want to query it using a standard SQL tool, how do I do this? It doesn't seem like there are any views, etc. that I can query against?
Best to check with Oracle, but my understanding is that 10.1.0.3A upwards enabled the cube for the OLAP API, not SQL access - the difference being that enabling for OLAP API creates the metadata that the OLAP API requires, which used to be ( < 10.1.0.3 ) stored in the OLAPSYS schema, and is now contained within objects in the AW itself. If you want to enable for SQL access, you'll have to create views using the OLAP_TABLE function as before, although I don't think you need to create the ADTs (abstract datatypes, the object definitions previously required) anymore.
HTH
Mark -
How to get the SQL which invoked a trigger
Hi,
I have a table from which the rows are getting deleted without our knowledge.
To track this I've put a trigger on delete of this table. I want to know which SQL is actually invoking this Delete trigger so that I can capture it inside the trigger and log it somewhere so that I can analyze from where this SQL is fired.
Please let me know if any one can help me regarding this.
Thanks,
MakrandIf possible try and explore the FGA (Fine Grained Auditing) option . You may not need to create any triggers on the table and look up V$ views.
Instead, define a RULE on the table. FGA will track the DML operation performed based on the RULE you defined
i.e Consider a policy/Rule defined on the table TEMP as follows.
begin
dbms_fga.add_policy (
object_schema => 'SCHEMA_NAME',
object_name => 'TEMP',
policy_name => 'TEMP_DELETE',
audit_column => NULL,
audit_condition => NULL,
statement_types => 'DELETE'
end;
DBA_FGA_AUDIT_TRAIL view can then give you all the information required.
You will need to have execute privilege on DBMS_FGA package.
FGA will help if you are on 10g. In 9i it has a limitation – It can only use SELECT and not the other DML operations. So if you are on 9i, follow what the other members have mentioned ‘cause FGA will not be of much help to you.
I[b] have not used this feature - Maybe you can give it a try and update the forum members. The limitation using FGA is that Auditing on the table is still enabled when ROLLBACK statement is issued.
My preference will be using this feature instead of writing triggers on the table.
Try using Google search and get more info on the FGA.. Good Luck !
Shailender Mehta -
How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"
How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"?
I have an install SQL scripts that creates a Linked Server. I want to put some security on the Linked Server and only grant the Agent Job Signon (the "Run As" or "Executed as User") access to the linked server. I need to retrieve the
Agent Job Signon (something like "NT SERVICE\SQLAgent$FIDEV360BI02").
I could query certain jobs and SUBSTRING the Message column - using some form of the query below, which would return "Executed as user: NT SERVICE\SQLAgent$SSDEVBI02. The step succeeded." But that is pretty imprecise.
use msdb
SELECT [JobName] = JOB.name,
[Step] = HIST.step_id,
[StepName] = HIST.step_name,
[Message] = HIST.message,
[Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
WHEN HIST.run_status = 1 THEN 'Succeeded'
WHEN HIST.run_status = 2 THEN 'Retry'
WHEN HIST.run_status = 3 THEN 'Canceled'
END,
[RunDate] = HIST.run_date,
[RunTime] = HIST.run_time,
[Duration] = HIST.run_duration,
[Retries] = HIST.retries_attempted
FROM sysjobs JOB
INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
-- CHANGE THIS
-- WHERE JOB.name like '%GroupMaster%' or Job.name like '%etlv%'
ORDER BY HIST.run_date, HIST.run_timeby default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
so, if it is null, it ran as sql server agent account.
so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
accurate information as the new account will show up though the job really ran as old account, to get this information, you need to get this from the logmessage column as you mentioned above.
try this code...
/*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
declare @sqlserveragentaccount varchar(2000)
select @sqlserveragentaccount= service_account
from sys.dm_server_services
where servicename like '%sql%server%agent%'
select message,isnull(name,@sqlserveragentaccount) as AccountName
from sysjobhistory a inner join sysjobsteps b
on a.step_id=b.step_id and a.job_id=b.job_id
left outer join sysproxies c on c.proxy_id=b.proxy_id
Hope it Helps!! -
How to identify the SQLs which are using the tables and new columns
Hi
I m using oracle 10G Database in windows. Developers have added some columns in some of the database tables and were asking to check whether there is some impact on performance or not. I have not done this performance tuning before. Kindly help me how to proceed further.
How to obtain the sqls which are touching the tables and the new columns? It would be really great if you can help me with this.
ThanksYou can try to use DBA_DEPENDENCIES to get PL/SQL objects using tables: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1041.htm#i1576452.
However if SQL code is not stored in database in a trigger, a procedure, a function, a package or a view, it is impossible to retrieve all SQL code referencing some table from database dictionary: for this you would have to analyze application source code. -
How to get the text which was clicked in a A href tag.
I am displaying the names from database in a page as hyperlink. When this hyperlink is clicked I want to display the corresponding address from DB. What the problem is when the link is clicked how to get the name which is clicked. I know only to link to a page using href. Now I want the text which has been clicked. Pls help.
Sorry to interrupt here!
For the code you suggested:
David,
if the target path is "http://localhost/testing.jsp", then
the code would become:
David.
So what would the difference between the code shown above and this code:
David
What is the function for these two symbols: "<<" and ">>"? -
How to get the records which has a specified x/y coordinates
Hi,
How to get the records which has a specified x/y coordinates. I have a table which has street data. And another table has a point data. Now I just want to get the records from street data which includes the points in the point data table. Can any one give your suggestions
Thanks and Regards
AravindanAravinda,
If you want to find the line segments which intersect the given
set of points, you can do that with SDO_RELATE.
siva -
How to get the Sql inside Omni SQL portlet.
Hi,
We are trying to find a table/view which stores/holds the Sql and Pl/Sql code of Omni Pl/sql portlets.
Thanks,
Ram.by default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
so, if it is null, it ran as sql server agent account.
so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
accurate information as the new account will show up though the job really ran as old account, to get this information, you need to get this from the logmessage column as you mentioned above.
try this code...
/*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
declare @sqlserveragentaccount varchar(2000)
select @sqlserveragentaccount= service_account
from sys.dm_server_services
where servicename like '%sql%server%agent%'
select message,isnull(name,@sqlserveragentaccount) as AccountName
from sysjobhistory a inner join sysjobsteps b
on a.step_id=b.step_id and a.job_id=b.job_id
left outer join sysproxies c on c.proxy_id=b.proxy_id
Hope it Helps!! -
How to get the SQL file name in SQL*plus
hi all,
I have created two sql file at C drive as "c:\Createtable.sql" and "c:\Deletetable.sql"
afterwards i open
C:\>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 30 11:37:10 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: scott/tiger
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @C:\Createtable.sql'
Table created.
SQL> @'C:\Deletetable.sql'
Table dropped.
SQL>My problem is to get the name of the file as "c:\createtable.sql" and "C:\Deletetable.sql" in sql*plus enviornment.
Thanks & Regards
SinghDear Damorgan,
>>your version number to three decimal places
My Oracle DB Version i have already stated in my previous post is 10.2.0.1.0
Actually my problem is to get the sql files name we run in sqlplus enviornment with @ symbol. like
i have created one sql file in c drive as
"C:\Createtable.sql"
afterwords i have connected to sqlplus as
sql> conn scott/tiger
sql>@c:\createtable.sql
Now i want some query to get the name of the file which is run.
In actual my problem is as
i have suppose 10 or more SQL files in some folder ( sql1.sql, sql2.sql, sql3.sql ....).
i created one file to call all the 10 sql files (main.sql)
i have also one track_table which will keep track that which sql file is runned.
I want some automated script which will insert the record in that track_table....... for that i need the name of sql file which is runned.
Hope this will help you.
Thanks & Regards
Singh -
How to get the SQL queries based on SQL_ID.
Hi Experts,
I want to get the SQL queries based on SQL_ID.
I have tried the following query,but I am not getting full query.
[code]SET linesize 132 pagesize 999
column sql_fulltext format a60 word_wrap
break on sql_text skip 1
SELECT REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
FROM dba_hist_sqltext s
WHERE s.sql_id = '7tvurftg8zryb';[/code]
One of my friend said use grid to get full query text.
Can you please help me how to use grid ,else any other method to get the full query based on SQL_ID.
Please help me.
Thanks in advance.You have these many options to set, if sql_text is really huge. But better use a tool(TOAD) as it's really helpful and easy to use instead! (See my previous comment).
column sql_text format A10000
set echo off
set head off
set feed off
set verify off
set termout off
set lines 10000
set long 1000000
set trimspool on
set pages 0
Thanks! -
I cannot figure how to get the text(SQL statement) from a system view(i guess it is in a system view... but witch??). 'Till now i have the sql_address and the sql_hash_value..
I know it is possible.. EM does it ... so i should be able to do the same..
ps:I use 9.2v$sql ?
-
How to get the SQL Execution Plan from complex Extractors ?
Hi
I am looking for a way to get the
SQL Execution Plan(s!)
from
Complex Extractors like 0CO_OM_CCA_9 ?
Anybody has got a suggestion ?
How to get this in SM50 ?
ThanXs
MartinIdentifying the query is the hard part. If you can identify it(based on table access or some such parameter, getting the execution plan is easy in ST04 .
-
How to get the time for executing an SQL statement?
hi all...
How can I get the total execution time for a given SQL statement to a ViewObject which is created dynamically for this SQL so that the end user knows it before hand and try to stop it or go further..?
Please post any ideas if you have got..!!!
thanx in advance..
grüss
K°viThis is not really a question for the JDeveloper forum, but rather for the DB forum.
Since Oracle9i there is a way to estimate how long a query will take, before executing it.
Check it out in the Oracle DB documentation or ask on the DB forum.
There is no built-in functionality for this in JDeveloper, but you should be able to call out to the DB from your Java code to get the estimate. -
How to get the sql id and sql text for the pid which is completed.
Hi All,
I like to know how the get the details of sql_id and sql_text using the proecess which is completed already (ie., no more showing in the top command).
But I have the details of the process id.
Database name: 11g
os: sun os
thanks
Edited by: user9354175 on Nov 8, 2010 10:42 AMIf the session is still connected you might try this:
- query v$process where spid = os-process-number
- then join v$process to v$session using ADDR (in process) to PADDR (in session)
- then look at PREV_SQL_ID in v$session.
- use that to get the SQL_TEXT in for instance V$SQLAREA.
Could work, if all info is still in the SGA... -
How to get the document which is associated with a process having specific Guid value?
when a PDF file is opened, AcroRd32.exe is started automatically, and we get the GUID value of that adobe reader.
In c#, can't we get the document associated with the GUID value, I mean the total PDF file which is opened in adobe reader at runtime.
Here I'm struck up in code, can anyone suggest how to where I was missing something.
Acrobat.CAcroAVDoc AcroAvDoc;
Type AcrobatCAcroType;
AcrobatCAcroType = Type.GetTypeFromCLSID(new Guid("{CA8A9780-280D-11CF-A24D-444553540000}")); This CLSID is of adobe reader's.
///////Here I think I'm missing something
Object obj = Activator.CreateInstance(AcrobatCAcroType);
AcroAvDoc = (Acrobat.CAcroAVDoc)obj;
I think I can get the full PDF document with AcroAvDoc.GetPDDoc();
Thank you...Post your question in the forum for Acrobat SDK.
Maybe you are looking for
-
Copy text in pdf gives me gibberish. Is there a way to OCR to correct?
I have a few documents that are complete gibberish when I select text and copy. If I open them in Acrobat Pro, select text, Copy, and "Show Clipboard" in Finder, I see a bunch of "skull characters", and if I open them in Preview and do the same, I se
-
Hi I'm a Sparc newbie, I was given a SPARC10 a while ago, which currently has SunOS 5.6 on it although it doesn't boot as various network connections are unavailable etc. so I downloaded the Solaris 8 install cd's from the Sun Site and burned the Ins
-
Transfer of Variance from Manufacturing plant to Sales plant in COPA
Hi, In the current project there is requirment of COPA report where sales are done at Distribution centers/Depots (selling Plants) whereas manufacturing is done at Manufacturing Plants. When the Variance is settled in Production order to COPA it is
-
Reg:Radio button in ABAP Query
Hi ABAPers , I created radiobuttons in SQ02 there i have to write the coding for it ... what type of coding we have to write ALV coding wll work out or what type of coding we have to write can you guys plz suggest me Help me out from this problem i a
-
Hi all. I'm new to Final Cut, and was looking for some quality training on DVDs. I've had positive results with Total Training's Adobe stuff...anybody try their Apple products? Also, any other recommendations? Lynda.com? Thanks! Naveen