Detemine ALL sql queries being executed by a session

Hi All,
I want to find out ALL SQL queries being executed by a session on the DB. I have thought of enabling the SQL Trace for that session, then create my trace file for the session in the udump area and then check that trace file to view all the SQL's being executed in that session till the time i set my trace to FALSE.
Would enabling the trace for that session suffice for capturing each and every SQL fired in that session? Or do i need to check anything else?
Thanks in advance.

hi,
select sql_text
  from   v$session, v$sqltext
  where v$session.sql_address = v$sqltext.address
  and   V$session.sql_hash_value = v$sqltext.hash_value
  and  sid = &sid
order by piece
/thanks,
baskar.l

Similar Messages

  • Allowing user to terminate the PL/SQL process being executed

    Hi All,
    There's a procedure where some processing is done and which does take a long time to execute.
    So i want to add some feature in my form so that the user can cancel the the procedure being executed any time when he wants.
    Hopefully my problem is clear.
    Forms [32 Bit] Version 6.0.8.23.2
    Oracle9i Enterprise Edition Release 9.2.0.1.0
    Thanks in advance.
    Arif

    hi Arif,
    Regarding to your issue am afraid that there is no much ways to let the user cancel the procedure which retrive or fetching records or even at post_query level except cancelling the post_query fetching [ F4 ] or you can write a stored procedure , which will take the user_id as an argument and search for it in the $v_sessions table in order to kill his session , which makes no sence.
    i hope this whould be helpfull for your problem
    Regards
    Omar

  • I want the list sql queries performed someone in one session based

    V$SESSION V$SQLTEXT and audsid (taken from sys_context('USERENV','SESSIONID') ) are great .. session_id be generated by a trigger when the application logs on) but then uploading the list of sql queries made by that user (application) until they log off seems impossible.
    I've tried creating triggers that check if V$SESSION changes with respect to an audsid number and sql_hash_value but it didn't work. I'm trying to work out why.
    In the meantime I thought I'd post this to see if anyone else foudn another way.
    I don't want to use sql trace that just gives load of info, I just want simple sql queries.
    Auditting seemed a bit complicated, can that list ALL DML and DDL commands made by a user? if so how?
    thanks
    Bobby

    quite right.
    Oracle enterprise dedicated server 9.2.0.8 on solaris 10.
    I just want to log all command DML and DDL, without stats or anything like that, simply a list, in a chronological order would be nice.
    I found something called dbms_fga package but not sure if thats what I want. Seems I have to implement it on specific tables. which is not good if the application hasn't created the tables yet.
    Thanks in advance.

  • View source of all sql which oracle executed

    Dear Experts,
    I want to see which action (Select, insert, update, delete) user requested oracle for executing. For example
    When a user execute "Select * from dual". As a DBA, I want to see this source SQL. can you tell me the way to get this informatioin?
    Thank you and best regards
    - Tu

    First get the session id of the user from[b] v$session.
    Then u can use v$sql,v$sqltext or v$sqlarea for to see all the sql executed in that instance.
    Regards,
    Sanju

  • ?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!
    Scott

    Hi 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

  • Error while running the sql queries in unix as cron job..

    Hi,
    I've configured some sql queries to run as cronjob from unix,i'm able to excute all the sql queries with out any error,after all the queries are executed,I'm getting the following error message.
    ORA-00600: internal error code, arguments: [4080], [1], [131], [], [], [], [],
    Could any one advise me why this error is being thrown?
    How to avoid this error?
    Thanks,
    Anil

    Are you running these queries through TopLink?
    If so, the error seems to be occurring on the database, when the query is being executed.
    I have never seen that error before. Performing some websearches it seems to be a general database error, potentially something to do with synchronization. Sorry I can't be of more help, perhaps the database forum can provide more insight...

  • Maintaining SQL Queries in a separate text file

    Hi,
    I am working on web based project using Spring MVC framework and I am maintaining all SQL queries in a separate text file so that I can change them any time when needed. I just want to know am I doing right, it this a optmistict way of coding??

    >
    I am working on web based project using Spring MVC framework and I am maintaining all SQL queries in a separate text file so that I can change them any time when needed. I just want to know am I doing right, it this a optmistict way of coding??
    >
    The best place to store the queries, and HOW to store them depends on your architecture and on how your application is being used.
    Is this a single-user application on a user's pc? Or is your application located on an application server in the middle-tier?
    The queries should be stored where they will be used. Your queries should be stored in the tier where your application code will reside. On the client PC for a single-user app, on the application server for a 3-tier app and incorporated into stored procedures/functions/packages if part of a database app.
    If your application is totally external to the database (e.g. a reporting app) then it doesn't make sense for you to become part of the database architecture. An org isn't going to let you create objects in the database to store your queries when your queries are not part of the database application. That puts the burden on them to backup your objects, restore them for your and provide support to you and your application.
    What format to store the queries in is a different issue. A major criteria is the type of queries you are using and how they are used. Many apps that query the database cannot just use hard-coded queries that are never modified. Users need to be able to provide parameters (e.g. name, ID, state, etc) to select just the data that they want.
    That means the base query itself may not even be valid syntax but needs to have a WHERE clause added. Prepared statements and queries that use bind variables ('WHERE ID = ?') are typically used for these.
    One method of storage is to use Java property files that use name=value pairs. Using property files makes it easy to use Java to find a query by name and load it for you. Then your code would have functionality to modify the query to provide the parameter 'bind' values and execute it.
    There are also frameworks available for handling database related functionality. There is no need for you to write your own libraries for this. I suggest you locate a suitable framework to use.

  • The actual query being executed

    hi all,
    is there a way to log the actual sql query being executed
    i saw that there is trace option for sql query
    but it is not logging anything
    can anybody help me please
    regards,
    ramakrishna

    The easiest way to do this that I've found is to determine which session is running the report. This is difficult if it is interactive as the reports runtime engine starts a session when you run it. Then just issue a sql trace with binds from another session (dbms_support package or dbms_ev)
    I'll sometimes put an entry using dbms_application_info (suggested on asktom) in a beforepform trigger so I know which session is the one with the report - in caseI have multiple logons under one account.

  • Logging sql queries without any changes in existing apps

    Hi!
    Is it possible to log all SQL queries send from application to database via JDBC without any (or really small) changes in code of existing applications?
    I'm new to JDBC so any suggestions/ideas/best practices are welcome ;)
    Best regards.
    Edited by: matthew_ on Mar 16, 2008 5:35 PM

    Is it possible to log all SQL queries send from application to database via JDBCFirst is an assumption that the driver does in fact sends SQL. It might send some other form.
    But excluding that and excluding that the driver explicitly sends it then you can create a proxy driver. You implement the driver to pass everything to the real driver. Along the way it collects the information.
    You will find that that is quite bit of work. However it impacts the actual code very little and requires nothing more than loading the driver and changing the connection string in the code where it is used.

  • SQL queries on LDAP

    Sure this is a dumb question, but can SQL queries be executed off an LDAP server?
    Is there an SQL interface for the SUN One Directory server?

    There are ODBC and JDBC drivers for LDAP servers. I think Novell has one. There is a lot of configuration involved, and you have to know SQL and LDAP pretty well to be able to map the namespaces/databases/tables to suffixes, rows to entries, and columns to attributes, and vice versa.

  • How to get all parameter names along with their values in stored procedure which is being executed

    Im using sql server 2012, is there any possible way to get all the parameters of a stored procedure along with the values passed to it.
    I need these things to build a xml. I mean this should happen in the procedure which being executed and it should be common for all the procedures.
    For example, let us suppose we have to procedures,
    uspSave, @name='test' @age=20
    uspDelete @id=2
    now in uspSave procedure, i need to get @name, @age and the values 'test', 20 and in uspDelete, i should get @id with value 2.
    For getting the column names, i tried this,
    select parameter_name from information_schema.PARAMETERS where specific_name=OBJECT_NAME(@@procid)
    now is it possible to loop through the result of above query and can we get the values.

    I think  you need running SQL Server Profiler to capture this info even in SQL Server 2012.
    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
    Blog : MS SQL Development and Optimization
    Blog : Large
    scale of database and cleansing

  • How to find out all SQLs executed by a procedure

    I need to find out all SQLs executed by a procedure. I can trace and check but in my case the issue happened 4 hours back and i know what procedure was causing it. There are multiple dynamic queries fired from this procedure. I need to track down all SQLs fired by this procedure constructed dynamically during the time issue was happening.
    I have the sql_id of the statement which was executing the procedure. How do I track down all "child" SQLs using this sql_id?
    Will appreciate any pointers.
    -ravi

    Thanks for your suggestion and looking into this.
    We already have that functionality built in. Version is 10.2.0.3...But the issue is the proc is called thousands of time in a day and we can not keep the tracking of sqls and parameters passed on all the time. When the issue happened we were not tracking. The bind variables are not captured as the SQL is constructed within the proc by looking up the values dynamically from secondary tables dynamically based on the parameters passed to the procedure. Now the SQLs which are generated from the proc will have the bind variables captured as they will come as predicates and will have no clob types (condition for the binds to be captured).
    I need a query to track down all "child" SQLs by using the sql_id of the parent process which is the procedure's sql_id.

  • 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

  • Execute multiple sql queries in plsql

    Hello All,
    I have two queries, How to execute multiple sql queries in plsql. Once the query completed in sql+ that report/output has to come in html.
    Please guide to how to do that.
    Thanks and Regards,
    Muthu
    [email protected]

    There are several ways to do what you are wanting, but you should consider posting your question in the correct forum (PL/SQL). This forum is for question about Oracle Forms! :)
    As to your question, take a look at this: How to output query results as HTML.
    Craig...

  • How can i track the all sql/query executed from application

    How we can track all sql/query that has executed or being executing on oracle database server 10g r2.
    regards
    Prabhaker

    select s.sid,
           s.status,
           s.process,
           s.osuser,
           a.sql_text,
           p.program
    from v$session s,
         v$sqlarea a,
         v$process p
    where s.sql_hash_value = a.hash_value
      and s.sql_address    = a.address
      and s.paddr          = p.addr
      and s.schemaname     = '&1'
      and s.status         = 'ACTIVE'

Maybe you are looking for

  • Error while running info package

    Hi, I am getting a error while loading the data till PSA. Transfer structure field not contained in the data source. Please suggest if any one know the solution to resolve this. Regards, Haritha

  • Mac mini server - will not take 4GB so-dimm in bank 0

    Mac mini server - will not take 4GB so-dimm in bank 0 Hello, Memory works ok as long as the old 2gb 1066 so-dimm is in bank 0. Switching the dimms around is no go. It seems to need that bank 0 populated with an old 2gb. I can use only one 2gb and one

  • Can data be sorted by multiple columns in numbers version 3

    Since upgrading Numbers to version 3 (now 3.0.1) I have been unable to sort data in spreadsheets using multiple columns.  Anyone found a solution? Regards kurrajong60

  • How to save XDP/Form with XML as a standalone PDF - Running out of time

    Help...I'm in a time crunch.  I have a perfectly working form that takes XML and merges into a wonderful PDF on my machine (1000+ pages).  The problem is I need to distribute the finished PDF with the XML...not to two independent files. I have tried

  • Bex Browser and roles

    Hello All, We currently use the BEx browser to deploy the queries and workbooks to all the users. We have set the auth object S_USER_AGR with the value '03 - Display' only. However, what we are observing that the users are having the capability to mo