How to trace the SQL statements executed in a database

I am using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on a sun server and I am not familiar with Oracle but with MS SQL there is a tool called profiler, it allows you to monitor and see what is going on in a specific databases whether it is SQL statement executins or anything else. I have installed the oracle enterpise manager console at my windows client and I tried to look for a tool similar to the profiler in the MS SQL. I tried the TRACE DATA VIEWER and I inputed the login credentials but I don' t actually know the service name and I am getting an error ORA-12514 The TSN listener can not resolve the service name given in the connect descriptor. Therefore, am I on the right road so i have to look for the service name or are there any other ways i can trace the currently executing SQL statement in a specific database. I am really stuck there. I would appreciate if somebody help me out. Thanks
Abdel Moalim

Abdel Moalim wrote:
I am using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on a sun server and I am not familiar with Oracle but with MS SQL there is a tool called profiler, it allows you to monitor and see what is going on in a specific databases whether it is SQL statement executins or anything else. I have installed the oracle enterpise manager console at my windows client and I tried to look for a tool similar to the profiler in the MS SQL. I tried the TRACE DATA VIEWER and I inputed the login credentials but I don' t actually know the service name and I am getting an error ORA-12514 The TSN listener can not resolve the service name given in the connect descriptor. Therefore, am I on the right road so i have to look for the service name or are there any other ways i can trace the currently executing SQL statement in a specific database. I am really stuck there. I would appreciate if somebody help me out. Thanks
Abdel MoalimHi
I see others have answered the network connectivity issues, I'll try and address the tracing issue. Your best bet is to review http://www.petefinnigan.com/ramblings/how_to_set_trace.htm for the many ways in which a sessions SQL and indeed other activity can be traced. In version 7 (which I'm guessing is yours from the sid) the only profiler available was tkprof (Trace Kernel Profiler) which will do a good job of analysing your trace file. The trace files themselves are generated on the server in a protected directory so you may need to ask your dba for access to them. There are other profilers around now (I have one which runs in v9 and higher database at http://www.niall.litchfield.dial.pipex.com/SimpleProfiler/SimpleProfiler.html which will analyse your files for example) but tkprof is the start point - or else just reading the trace file in a text editor. There is also a utility written by the Oracle Apps guys trcanalyzer that will do a good job for you. In general the interface is poor compared with the ms utility but the information is deeper and more helpful
Niall Litchfield
http://www.orawin.info/

Similar Messages

  • How to put the SQL-statement returned value into the field (as a default)

    Hi,
    I am using Developer/2000 (Forms Designer) under windows 98.
    Please tell me how to put the SQL-statement value (as a default value) into the field before enter-query mode. Noted that I have tried the following ways but still some problems:-
    1) Place the SQL-statement into PRE_QUERY trigger in the form/block level.
    There is a message box which ask 'Do you want to save the changes?'.
    2) Place the SQL-statement before execute enter_query. There is still a
    message box which ask 'Do you want to save the changes?'.
    Any hints? Thanks. Urgent.

    solved it!
    1) Suppress DEFAULT save message
    if form_failure then
    raise form_trigger_failure;
    end if;
    2) Place the default value before enter-query.
    Ref: Title='Default value in query field in ENTER_QUERY mode' in designer forum by CVZ
    form level trigger
    ============
    WHEN-NEW-ITEM-INSTANCE
    =======================
    if :system.mode = 'ENTER-QUERY' then
    :block.item := 'default waarde';
    end if;
    3) Suppress the changes whenever leaving the default field.
    if :block.item is null then
    -- assign statement
    end if;

  • Log for all the sql statement executed

    Hi,
    I would like to know how to see the log for all the sql statement executed starting from connection to all the database related actions.
    Is it something that i need to set it up in the driver?
    I'm using Tomcat and JDBC driver.
    Please reply.
    Thanks,
    Anjana

    Make your own.
    Calendar cal = new GregorianCalendar();
    int year = cal.get(Calendar.YEAR);
    int month = cal.get(Calendar.MONTH) + 1;
    int day = cal.get(Calendar.DAY_OF_MONTH);
    //use calendar object to get other infos such as time of query
    //append your query string
    File f  =new File ("c:\\jakarta-tomcat-3.2.4\\webapps\\ASD\\LOGS\\log" + df.format(day) + df.format(month) + year + ".txt");
                   if (! f.exists())
                        f.createNewFile();
                   FileWriter fw = new FileWriter (f, true);
                   // append new log to end of file
                   fw.write(buf.toString());
                   fw.write("\n");
                   fw.flush();
                   fw.close();
              catch (IOException ioe)
                   System.out.println(ioe.toString());

  • How to write the sql statement of my finder function in cmp?

    hi,
    I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
    select * from INFOCOLUMN WHERE employee_id=id
    employee_id is a column of the table,and id is the finder function parameter.
    The error is : invalid column name
    So,how to write the sql statement.
    Thanks .

    Mole-
    Bind variables are of the form $1, $2, etc., so your query stmt should look like:
    select * from INFOCOLUMN WHERE employee_id=$1
    -Jon

  • How to trace every dml statement for a schema/ database

    hi,
    how to trace every dml statement for a schema/ database
    PFile Entrie
    init.ora Parameter Example event='1401 trace name errorstack, level 12';
    tkprof orcl_ora_3632.trc b.txt
    after these two steps I am not able to see the sql statements in trace ...
    Please suggest.
    Thanks & Regards,

    Hi,
    Trace Event 1401 will create a trace file and dumps the information when ORA-01401 error occurs. This error occurs when "inserted value too large for column"
    You will see the trace file getting populated only when you encounter ORA-01401 error.
    Regards

  • How to view the SQL statement generated during execution of the BW Query?

    Dear Experts,
    I am trying to retrieve data in a SAP BW Query from a Non-SAP system.
    I think if I am able to see the complete SQL statement that was generated when I executed the BW Query, I may be able to use it to retrieve the data.
    Do you know how and where I can see the SQL statement of a BW Query's SQL statement?
    I tried RSRT options to execute the Query but still could not find the SQL statement.
    Thanks in advance.
    Regards,
    Shunhui.

    hi
    goto rsrt
    give your query name
    select execute + debug option
    in the debug option under data manager check the check box "display SQL/BIA query
    selcet continue
    you can see the sql statement
    thanq

  • 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

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

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • How to monitor the sql statement running?

    Hi ,
    i need to check the status of the sql script running on the database.
    what is the way to chect that?
    if the particular query is taking very long time what might be the reason?

    Since you are [relatively] new at this ..
    the recommended technique will change based on version of Oracle database, the edition of the database, the options of the database and the operating system.
    For example, I would normally suggest a newbie with Oracle Database 10g or 11g Enterprise Edition to use the Enterprise Manager Diagnostics Pack. A demo thereof is on the Oracle BY Example site (http://otn.oracle.com) - look for Tutorials towards the top.
    As for why ... it's waiting on things. Which things may depend on the database, the operating system, the disk subsystem, the network subsystem, memory allocation, sorting, other load, and even how well or badly the SQL statement was written.

  • How to get the SQL statement

    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.2

    v$sql ?

  • How to get the SQL Statement of a report region?

    For example: The SQL of report region such as "SELECT A,B,C FROM T1 WHERE A = :P10_A".
    I hope to get the converted statement (the variable has been replaced), like this:
    :P10_A = 'TOM', SQL: "SELECT A,B,C FROM T1 WHERE A = 'TOM'".
    THX.

    I agree with John with the usual caveat about using bind variables.
    In other words, you should use
    SELECT A,B,C FROM T1 WHERE A = :P10_Ainstead of SELECT A,B,C FROM T1 WHERE A = 'foo'so that the shared pool doesn't get clutterred with copies of the same (sharable) SQL.
    Even if you use the "PL/SQL function returning a SQL query", be sure to use bind variables in your SQL and not "glue in" session state by concatenating it into the query.
    Thanks.

  • How to Run SQL Tuning Advisor on the SQL statement with SQL_ID?

    Can you give the steps to run the SQL tuning advisor on the SQL statement with SQL_ID?
    Database version: 10g Release 2

    Hi,
    You can use either the automatic SQL tuning features that are accessible from Enterprise Manager Database Console on the "Advisor Central" page or trough SQL*PLUS using the DBMS_SQLTUNE pakage:
    -- creating the tuning task
    set serveroutput on
    declare
      l_sql_tune_task_id  varchar2(100);
    begin
      l_sql_tune_task_id := dbms_sqltune.create_tuning_task (
                              sql_id      => '<your_sql_id>',
                              scope       => dbms_sqltune.scope_comprehensive,
                              time_limit  => 60,
                              task_name   => '<your_tuning_task_name>',
                              description => 'tuning task for statement your_sql_id.');
      dbms_output.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    end;
    -- executing the tuning task
    exec dbms_sqltune.execute_tuning_task(task_name => '<your_tuning_task_name>');
    -- displaying the recommendations
    set long 100000;
    set longchunksize 1000
    set pagesize 10000
    set linesize 100
    select dbms_sqltune.report_tuning_task('<your_tuning_task_name>') as recommendations from dual;For more information, take a look at link provided by Jaffy.
    Cheers
    Legatti

  • Trace the SQL by a user

    I want to trace the SQL statements sent by a user. I tried V$SQL view and it seems like it traces only the successful statement. I want to trace all the statements from that user including the ones which have sytanx errors.

    are you using dbms_system? For example, with SID and Serial# you can do the following,
    exec sys.dbms_system.set_sql_trace_in_session( 46, 13217, TRUE );
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:330817260752
    HTH - Kevin

  • Urgent : How to do the SQL trace analysis

    Hi Floks,
    How to do the SQL  Trace analysis and any another tools is there to test abap programming then this tools runtime analysis,extended Programming Checking,Code inspector .How to utilize that tools .please forward me
    thanks
    suresh

    HI,
    <b>SQL Trace Use:</b>
    The SQL Trace function is an on-demand log of selected SQL statements that are issued against the database through the Open SQL Engine. The SQL Trace can be switched on or off dynamically. The log format is database independent. Besides the SQL statement text, each log record contains information about the point in time when the statement was executed, its duration, its input parameters and results (where applicable) as well as context information.
    <b>
    Features</b>
    The SQL Trace is especially useful for:
    Development
    SQL Trace can help JDO, enterprise beans, servlet and JSP developers to learn which kind of database accesses their code produces.
    1.      Performance analysis
    Typically, performance issues are caused by inefficient database accesses. In this case SQL Trace can be used to show the issued SQL statements and their duration, thus helping to identify inefficient SQL statements.
    <b>Activities</b>
    Typically, you should use the SQL Trace when you need to check the behavior of a particular application. This is the following scenario:
    Look at the below links, you will get the idea
    http://help.sap.com/saphelp_erp2005/helpdata/en/d1/801f89454211d189710000e8322d00/content.htm
    Re: Runtime Analysis vs SQL Trace
    http://www.sapbrain.com/TOOLS/SQLTRACE/SQL_TRACE.html

Maybe you are looking for

  • Problems running Flash Builder 4.6 profiler

    Hello, I have a problem running Flash Builder profiler. When I click "Profile" it starts my web application, but nothing else happens inside Flash Builder itself - no new data appears in Profiler perspective, Flash Builder itself doesn't show any sig

  • Shaking icons

    I had a weird thing happen today. At work i had it on at the main screen and i slipped it into my pocket without turning it off or anything. When i got it out, the icons were shaking like they were floating in water. Some of them had x's in the upper

  • Getting Error in Fulfillment

    Hi Jim, I am getting following error in download an ebook from our ebookstore: Error getting license Server communication problem: E_ADEPT_INTERNAL Please suggest me why this error occures? Regards, Mangal Varshney

  • Update GOITEM-ERFMG in MIGO using user exit in SAP ECC 6.0

    Dear Gurus, Kindly help me to solve the issue. We have requrement to update GOITEM-ERFMG field at the time of MIGO based on text input in GOHEAD-BKTXT as selection criteria in selection query in Z table. We try to acheive this using different enhance

  • Counter in the condition procedure

    Hello Gurus,        why to use counter in the condition procedure ?  I think step is enough . Many thanks, Frank