Sql statement appear twice in trace file

Hi all,
Just a little confused on why my sql statement appear twice in the sql trace file.
the following is the sequence of steps to reproduce this.
1. Enable sql trace in another session, say session B
exec dbms_monitor.session_trace_enable(38,13330,TRUE,TRUE);2. Execute the following sql in session B
select * from hosts where hostname = 'host19'3. Disable sql trace
exec dbms_monitor.session_trace_disable(38,13330);I used TKPROF to parse the trace file
tkprof DEV_ora_20621.trc DEV_ora_20621.out sys=noThe output is
SQL ID: bcpw6ttb0xbqs
Plan Hash: 0
select *
from
  hosts where hostname = 'host19'
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.00          0          5          0           0
Execute      0      0.00       0.00          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
total        1      0.00       0.00          0          5          0           0
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 88
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       1        0.00          0.00
  SQL*Net message from client                     1        0.00          0.00
SQL ID: bcpw6ttb0xbqs
Plan Hash: 3617124623
select *
from
  hosts where hostname = 'host19'
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.00       0.00          0          3          0           1
total        3      0.00       0.00          0          3          0           1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 88
Rows     Row Source Operation
      1  TABLE ACCESS BY INDEX ROWID HOSTS (cr=3 pr=0 pw=0 time=0 us cost=2 size=135 card=1)
      1   INDEX RANGE SCAN IDX_HOST01 (cr=2 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 78193)Why the sql is showing twice?
I think the correct one would be the second since it's reporting the fetching of 1 row.
Does anyone understand this?
Cheers,
-Joel
Edited by: user12057365 on Jul 21, 2010 1:59 AM

Could not reproduce this in my 10.2.0.4.0 environment. Whats your Oracle version?

Similar Messages

  • High SQL*Net message values in trace file.

    Hi all,
    This is my first post here. I will try to more less describe the problem i am facing.
    Any help is more than welcome!
    I am facing some performance issues with application. Slow GUI. I run some tests, i tracked the session. what i found in trace file is:
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse     1734     1.61   1.61             0            0            0              0
    Execute   1734   32.52  32.56           0           26          15             4
    Fetch     1737     14.46  14.51           2        41867        84          2847
    total     5205     48.59   48.69            2        41893        99          2851
    Misses in library cache during parse: 7
    Misses in library cache during execute: 5
    Elapsed times include waiting on following events:
      Event waited on                             Times       Max. Wait     Total Waited
      ----------------------------------------           Waited       ----------            ------------
      SQL*Net message to client            5207           0.00               0.02
      SQL*Net message from client        5206          106.18             339.72
      log file sync                                    3               0.00               0.00
      SQL*Net more data to client            51              0.00               0.00
      SQL*Net more data from client        10              0.00               0.00
      Disk file operations I/O                    1               0.00               0.00
      db file sequential read                     2               0.00               0.01
      library cache: mutex X                    1               0.05               0.05
    Look at Max. Wait and Total Waited columns. Is it possible to safely tune it by changing SDU in sql*net ? and if so, is it needed to change the SDU value on client and server sides ?

    66ff73bb-87bd-4c84-bada-0141fb25344b wrote:
    Hi all,
    This is my first post here. I will try to more less describe the problem i am facing.
    Any help is more than welcome!
    I am facing some performance issues with application. Slow GUI. I run some tests, i tracked the session. what i found in trace file is:
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse     1734     1.61   1.61             0            0            0              0
    Execute   1734   32.52  32.56           0           26          15             4
    Fetch     1737     14.46  14.51           2        41867        84          2847
    total     5205     48.59   48.69            2        41893        99          2851
    Misses in library cache during parse: 7
    Misses in library cache during execute: 5
    Elapsed times include waiting on following events:
      Event waited on                             Times       Max. Wait     Total Waited
      ----------------------------------------           Waited       ----------            ------------
      SQL*Net message to client            5207           0.00               0.02
      SQL*Net message from client        5206          106.18             339.72
      log file sync                                    3               0.00               0.00
      SQL*Net more data to client            51              0.00               0.00
      SQL*Net more data from client        10              0.00               0.00
      Disk file operations I/O                    1               0.00               0.00
      db file sequential read                     2               0.00               0.01
      library cache: mutex X                    1               0.05               0.05
    Look at Max. Wait and Total Waited columns. Is it possible to safely tune it by changing SDU in sql*net ? and if so, is it needed to change the SDU value on client and server sides ?
    When you start with the wrong question, no matter how good an answer you get, it won't matter very much.
    you do NOT have any problem; just a useless observation.

  • SQL Statement Tunning Request

    Please help to tune the below query. I have provided following information
    1. Query To be tuned
    2. Parameter Relevant to Optimizer
    3. Explain Plan and AutoTrace Ouput
    4. Query traced at Level 8 and Its Tkprof Ouput
    5. EXPLAIN PLAN output of DBMS_XPLAN.DISPLAY
    INFORMATION 1. SQL QUERY TO BE TUNED
    SELECT DISTINCT C.MAN_WIP_T_IN_TS,
    C.RCP_NO,
    C.WRK_CTR_ID,
    C.WTR_FREE_TST_FLG,
    A.COMPANY_ID,
    A.PROD_ORDER,
    A.PART_NO,
    A.CARRIER_QTY,
    B.PHY_CARID,
    C.WIP_SEQ,
    A.RCP_NO "CARRIER_RCP"
    FROM dbadmintest.PF2_PROD_ORDER_CARRIER A,
    PF2_PHYSICAL_CARRIER B,
    WORK_IN_PROCESS C
    WHERE C.UNIT_TYPE_CD = RTRIM('TL7')
    AND C.UNIT_NM = RTRIM('T41')
    AND C.WIP_TYPE_CD = 'HANDHELD'
    AND C.PHY_CARRIER_SEQ = A.PHY_CARRIER_SEQ
    AND A.PHY_CARRIER_SEQ = B.PHY_CARRIER_SEQ
    AND ((A.CARRIER_LD_TS <= C.MAN_WIP_T_IN_TS
    AND A.CARRIER_UNLD_TS >= C.MAN_WIP_T_IN_TS)
    OR ( A.CARRIER_LD_TS <= C.MAN_WIP_T_IN_TS
    AND A.CARRIER_UNLD_TS IS NULL))
    AND ((A.CARRIER_UNLD_TS >= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_UNLD_TS <= TO_DATE('2012-01-12 10:03:00', 'YYYY-MM-DD HH24:MI:SS'))
    OR (A.CARRIER_LD_TS >= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_LD_TS <= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS'))
    OR (A.CARRIER_LD_TS <= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_UNLD_TS IS NULL)
    OR (A.CARRIER_LD_TS <= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_UNLD_TS >= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')))
    ORDER BY 6,5,1
    INFORMATION 2. PARAMETER RELEVANT TO OPTIMIZER
    NAME           TYPE      VALUE
    optimizer_dynamic_sampling      integer      2
    optimizer_features_enable      string      10.2.0.4
    optimizer_index_caching      integer      0
    optimizer_index_cost_adj      integer      100
    optimizer_mode           string      ALL_ROWS
    optimizer_secure_view_merging      boolean      TRUE
    db_file_multiblock_read_count      integer      16
    cursor_sharing           string      EXACT
    SQL> column sname format a20          
    column pname format a20          
    column pval2 format a20          
    select          
    sname          
    , pname          
    , pval1          
    , pval2          
    from sys.aux_stats$;SQL>      
    SNAME      PNAME      PVAL1      PVAL2
    SYSSTATS_INFO      STATUS           COMPLETED
    SYSSTATS_INFO      DSTART           08-25-2009 07:27
    SYSSTATS_INFO      DSTOP           08-25-2009 07:27
    SYSSTATS_INFO      FLAGS      1
    SYSSTATS_MAIN      CPUSPEEDNW      1592.87183
    SYSSTATS_MAIN      IOSEEKTIM      10
    SYSSTATS_MAIN      IOTFRSPEED      4096
    SYSSTATS_MAIN      SREADTIM
    SYSSTATS_MAIN      MREADTIM
    SYSSTATS_MAIN      CPUSPEED
    SYSSTATS_MAIN      MBRC
    SYSSTATS_MAIN      MAXTHR
    SYSSTATS_MAIN      SLAVETHR
    INFORMATION 3. EXPLAIN PLAN AND AUTOTRACE OUTPUT
    Execution Plan
    Plan hash value: 850402268
    | Id | Operation                | Name                | Rows      | Bytes      | Cost (%CPU)     | Time      |
    | 0 | SELECT STATEMENT           |                | 11      | 1100      | 1568      (1)     | 00:00:19      |
    | 1 | SORT UNIQUE                |                | 11      | 1100      | 1567      (1)     | 00:00:19      |
    |* 2 | HASH JOIN                |                | 11      | 1100      | 1566      (1)     | 00:00:19      |
    |* 3 | TABLE ACCESS BY INDEX ROWID      | PF2_PROD_ORDER_CARRIER      | 5      | 270      | 763      (0)     | 00:00:10      |
    | 4 | NESTED LOOPS           |                | 11      | 1001      | 1562      (1)     | 00:00:19      |
    |* 5 | TABLE ACCESS BY INDEX ROWID     | WORK_IN_PROCESS           | 2      | 74      | 35      (0)     | 00:00:01      |
    |* 6 | INDEX RANGE SCAN           | WORK_IN_PROCESS_IX2           | 56      |      | 3      (0)     | 00:00:01      |
    |* 7 | INDEX RANGE SCAN           | PF2_PROD_ORDER_CARRIER_IX3      | 2361      |      | 6      (0)     | 00:00:01      |
    | 8 | TABLE ACCESS FULL           | PF2_PHYSICAL_CARRIER           | 1736      | 15624      | 4      (0)     | 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("A"."PHY_CARRIER_SEQ"="B"."PHY_CARRIER_SEQ")
    3 - filter(("A"."CARRIER_UNLD_TS" IS NULL AND "A"."CARRIER_LD_TS"<=TO_DATE(' 2012-01-12 08:03:00',
    'syyyy-mm-dd hh24:mi:ss') OR "A"."CARRIER_UNLD_TS">=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd
    hh24:mi:ss') AND "A"."CARRIER_LD_TS"<=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd hh24:mi:ss') OR
    "A"."CARRIER_UNLD_TS">=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd hh24:mi:ss') AND
    "A"."CARRIER_UNLD_TS"<=TO_DATE(' 2012-01-12 10:03:00', 'syyyy-mm-dd hh24:mi:ss') OR
    "A"."CARRIER_LD_TS"=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd hh24:mi:ss')) AND
    ("A"."CARRIER_LD_TS"<="C"."MAN_WIP_T_IN_TS" AND "A"."CARRIER_UNLD_TS">="C"."MAN_WIP_T_IN_TS" OR
    "A"."CARRIER_UNLD_TS" IS NULL AND "A"."CARRIER_LD_TS"<="C"."MAN_WIP_T_IN_TS"))
    5 - filter("C"."WIP_TYPE_CD"='HANDHELD' AND "C"."PHY_CARRIER_SEQ" IS NOT NULL)
    6 - access("C"."UNIT_TYPE_CD"='TL7' AND "C"."UNIT_NM"='T41')
    7 - access("C"."PHY_CARRIER_SEQ"="A"."PHY_CARRIER_SEQ")
    filter("A"."PHY_CARRIER_SEQ" IS NOT NULL)
    Statistics
    1           recursive calls
    0           db block gets
    13525998      consistent gets
    7024           physical reads
    0           redo size
    1758           bytes sent via SQL*Net to client
    492           bytes received via SQL*Net from client
    2           SQL*Net roundtrips to/from client
    1           sorts (memory)
    0           sorts (disk)
    14           rows processed
    INFORMATION 4. QUERY TRACES AT LEVEL 8 AND TKPROF OUTPUT
    TKPROF: Release 10.2.0.4.0 - Production on Wed Jan 18 01:48:53 2012
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Trace file: ././ppf2_ora_5439924.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    SELECT DISTINCT C.MAN_WIP_T_IN_TS,
    C.RCP_NO,
    C.WRK_CTR_ID,
    C.WTR_FREE_TST_FLG,
    A.COMPANY_ID,
    A.PROD_ORDER,
    A.PART_NO,
    A.CARRIER_QTY,
    B.PHY_CARID,
    C.WIP_SEQ,
    A.RCP_NO "CARRIER_RCP"
    FROM PF2_PROD_ORDER_CARRIER A,
    PF2_PHYSICAL_CARRIER B,
    WORK_IN_PROCESS C
    WHERE C.UNIT_TYPE_CD = RTRIM('TL7')
    AND C.UNIT_NM = RTRIM('T41')
    AND C.WIP_TYPE_CD = 'HANDHELD'
    AND C.PHY_CARRIER_SEQ = A.PHY_CARRIER_SEQ
    AND A.PHY_CARRIER_SEQ = B.PHY_CARRIER_SEQ
    AND ((A.CARRIER_LD_TS <= C.MAN_WIP_T_IN_TS
    AND A.CARRIER_UNLD_TS >= C.MAN_WIP_T_IN_TS)
    OR ( A.CARRIER_LD_TS <= C.MAN_WIP_T_IN_TS
    AND A.CARRIER_UNLD_TS IS NULL))
    AND ((A.CARRIER_UNLD_TS >= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_UNLD_TS <= TO_DATE('2012-01-12 10:03:00', 'YYYY-MM-DD HH24:MI:SS'))
    OR (A.CARRIER_LD_TS >= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_LD_TS <= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS'))
    OR (A.CARRIER_LD_TS <= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_UNLD_TS IS NULL)
    OR (A.CARRIER_LD_TS <= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')
    AND A.CARRIER_UNLD_TS >= TO_DATE('2012-01-12 08:03:00', 'YYYY-MM-DD HH24:MI:SS')))
    ORDER BY 6,5,1
    call      count      cpu      elapsed disk      query      current rows
    Parse      1      0.00      0.00      0      0      0      0
    Execute 1      0.00      0.00      0      0      0      0
    Fetch      2      219.55      294.41      14030      13523455 0      14
    total      4      219.55      294.41      14030      13523455 0      14
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: SYS
    Rows           Row Source Operation
    14           SORT UNIQUE (cr=13523455 pr=14030 pw=0 time=294417731 us)
    14           HASH JOIN (cr=13523455 pr=14030 pw=0 time=294416444 us)
    14           TABLE ACCESS BY INDEX ROWID PF2_PROD_ORDER_CARRIER (cr=13523440 pr=14030 pw=0 time=292675360 us)
    98184018      NESTED LOOPS (cr=270067 pr=9028 pw=0 time=294901120 us)
    12128           TABLE ACCESS BY INDEX ROWID WORK_IN_PROCESS (cr=9842 pr=8788 pw=0 time=20479883 us)
    15241      INDEX RANGE SCAN WORK_IN_PROCESS_IX2 (cr=49 pr=48 pw=0 time=54577 us)(object id 65980)
    98171889      INDEX RANGE SCAN PF2_PROD_ORDER_CARRIER_IX3 (cr=260225 pr=240 pw=0 time=808956 us)(object id 65990)
    1736           TABLE ACCESS FULL PF2_PHYSICAL_CARRIER (cr=15 pr=0 pw=0 time=83 us)
    Elapsed times include waiting on following events:
    Event waited on      Times      Max. Wait      Total Waited
    ----------------------------------------      Waited      ----------           ------------
    SQL*Net message to client          3      0.00           0.00
    SQL*Net message from client      3      0.00           0.00
    db file sequential read      14030      0.47           43.56
    call      count      cpu      elapsed     disk     query     current     rows
    Parse      1      0.00      0.00      0      0      0      0
    Execute 1      0.00      0.00      0      0      0      0
    Fetch      0      0.00      0.00      0      0      0      0
    total      2      0.00      0.00      0      0      0      0
    Misses in library cache during parse: 0
    Parsing user id: SYS
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call      count      cpu      elapsed     disk      query      current      rows
    Parse      2      0.00      0.00      0      0      0      0
    Execute 2      0.00      0.00      0      0      0      0
    Fetch      2      219.55      294.41      14030      13523455 0      14
    total      6      219.55      294.41      14030      13523455 0 14
    Misses in library cache during parse: 0
    Elapsed times include waiting on following events:
    Event waited on      Times      Max. Wait      Total Waited
    ----------------------------------------      Waited      ----------           ------------     
    SQL*Net message to client      3      0.00           0.00
    SQL*Net message from client      3      0.00           0.00
    db file sequential read      14030      0.47           43.56
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call      count cpu      elapsed      disk      query      current      rows
    Parse      0      0.00      0.00      0      0      0      0
    Execute 0      0.00      0.00      0      0      0      0
    Fetch      0      0.00      0.00      0      0      0      0
    total      0      0.00      0.00      0      0      0      0
    Misses in library cache during parse: 0
    2 user SQL statements in session.
    0 internal SQL statements in session.
    2 SQL statements in session.
    Trace file: ././ppf2_ora_5439924.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    1      session in tracefile.
    2      user SQL statements in trace file.
    0      internal SQL statements in trace file.
    2      SQL statements in trace file.
    2      unique SQL statements in trace file.
    14137      lines in trace file.
    294      elapsed seconds in trace file.
    INFORMATION 5. EXPLAIN PLAN OUTPUT OF DBMS_XPLAN.DISPLAY
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID 1z1cccq5kxt11, child number 0
    SELECT /*+ gather_plan_statistics */ DISTINCT C.MAN_WIP_T_IN_TS, C.RCP_NO, C.WRK_CTR_ID, C.WTR_FREE_TST_FLG,
    A.COMPANY_ID, A.PROD_ORDER, A.PART_NO, A.CARRIER_QTY, B.PHY_CARID, C.WIP_SEQ, A.RCP_NO "CARRIER_RCP"
    FROM PF2_PROD_ORDER_CARRIER A, PF2_PHYSICAL_CARRIER B, WORK_IN_PROCESS C
    WHERE C.UNIT_TYPE_CD = RTRIM('TL7') AND C.UNIT_NM = RTRIM('T41') AND C.WIP_TYPE_CD ='HANDHELD'
    AND C.PHY_CARRIER_SEQ = A.PHY_CARRIER_SEQ AND A.PHY_CARRIER_SEQ = B.PHY_CARRIER_SEQ
    AND ((A.CARRIER_LD_TS <=C.MAN_WIP_T_IN_TS AND A.CARRIER_UNLD_TS >= C.MAN_WIP_T_IN_TS) OR
    ( A.CARRIER_LD_TS <= C.MAN_WIP_T_IN_TS AND A.CARRIER_UNLD_TS IS NULL)) AND ((A.CARRIER_UNLD_TS >= TO_DATE('2012-01-12
    08:03:00', 'YYYY-MM-DD HH24:MI:SS') AND A.CARRIER_UNLD_TS<= TO
    Plan hash value: 850402268
    | Id | Operation                     | Name                    | Starts      |E-Rows      | A-Rows      |A-Time           | Buffers      | Reads      |OMem      |1Mem      | Used-Mem      |
    | 1 | SORT UNIQUE                     |                | 1      | 11      | 14      |00:05:41.48      | 13M     | 6571      | 2048      | 2048      | 2048 (0)          |
    |* 2 | HASH JOIN                     |                | 1      | 11      | 14      |00:05:41.48      | 13M     | 6571      | 807K     | 807K     | 614K (0)          |
    |* 3 | TABLE ACCESS BY INDEX ROWID           | PF2_PROD_ORDER_CARRIER      | 1      | 5      | 14      |00:05:39.89      | 13M     | 6571      |      |      |           |
    | 4 | NESTED LOOPS                |                | 1      | 11      | 98M     |00:04:55.08      | 270K     | 6569      |      |      |           |
    |* 5 | TABLE ACCESS BY INDEX ROWID          | WORK_IN_PROCESS           | 1      | 2      | 12130      |00:00:13.15      | 9845      | 6569      |      |      |           |
    |* 6 | INDEX RANGE SCAN                | WORK_IN_PROCESS_IX2           | 1      | 56      | 15244      |00:00:00.06      | 49      | 45      |      |      |           |
    |* 7 | INDEX RANGE SCAN                | PF2_PROD_ORDER_CARRIER_IX3      | 12130      | 2361      | 98M     |00:00:00.92      | 260K     | 0      |      |      |           |
    | 8 | TABLE ACCESS FULL                | PF2_PHYSICAL_CARRIER           | 1      | 1736      | 1736      |00:00:00.01      | 15      | 0      |      |      |           |
    Predicate Information (identified by operation id):
    2 - access("A"."PHY_CARRIER_SEQ"="B"."PHY_CARRIER_SEQ")
    3 - filter(((("A"."CARRIER_UNLD_TS" IS NULL AND "A"."CARRIER_LD_TS"<=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd hh24:mi:ss')) OR
    ("A"."CARRIER_UNLD_TS">=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd hh24:mi:ss') AND "A"."CARRIER_LD_TS"<=TO_DATE(' 2012-01-12 08:03:00',
    'syyyy-mm-dd hh24:mi:ss')) OR ("A"."CARRIER_UNLD_TS">=TO_DATE(' 2012-01-12 08:03:00', 'syyyy-mm-dd hh24:mi:ss') AND
    "A"."CARRIER_UNLD_TS"<=TO_DATE(' 2012-01-12 10:03:00', 'syyyy-mm-dd hh24:mi:ss')) OR "A"."CARRIER_LD_TS"=TO_DATE(' 2012-01-12 08:03:00',
    'syyyy-mm-dd hh24:mi:ss')) AND (("A"."CARRIER_LD_TS"<="C"."MAN_WIP_T_IN_TS" AND "A"."CARRIER_UNLD_TS">="C"."MAN_WIP_T_IN_TS") OR
    ("A"."CARRIER_UNLD_TS" IS NULL AND "A"."CARRIER_LD_TS"<="C"."MAN_WIP_T_IN_TS"))))
    5 - filter(("C"."WIP_TYPE_CD"='HANDHELD' AND "C"."PHY_CARRIER_SEQ" IS NOT NULL))
    6 - access("C"."UNIT_TYPE_CD"='TL7' AND "C"."UNIT_NM"='T41')
    7 - access("C"."PHY_CARRIER_SEQ"="A"."PHY_CARRIER_SEQ")
    filter("A"."PHY_CARRIER_SEQ" IS NOT NULL)
    41 rows selected.
    Regards
    Rahul

    Rahul, post your question on the SQL and PL/SQL forum PL/SQL. This forum is for Oracle Berkeley DB not Oracle Database.
    Thanks,
    Andrei

  • I am not able to see the trace files for SQL query

    Hello, I am using windows vista OS.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE 10.2.0.3.0 Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL>
    I enabled the trace as below
    alter system set timed_statistics=TRUE
    alter system set sql_trace=TRUE
    After this, I ran sql query from scott as below.
    select count(*) from emp;
    After this, i checked in user dump directory. The trace files are generating... But this sql code is not appearing in the trace files...
    Am i missing anything... Any help is appreciated.
    Thanks

    This may happen when the trace file is not completely closed.You may try again doing like this,
    alter session set sql_trace=true;
    select * from emp;
    alter session set sql_trace=false;After this,disconnect and exit from your session as well. This should close the file completely and you should be able to see your command in it.
    HTH
    Aman....

  • Capture all SQL statements and archive to file in real time

    Want to Capture all SQL statements and archive to file in real time?
    Oracle Session Manager is the tool just you need.
    Get it at http://www.wangz.net
    This tools monitor how connected sessions use database instance resources in real time. You can obtain an overview of session activity sorted by a statistic of your choosing. For any given session, you can then drill down for more detail. You can further customize the information you display by specifying manual or automatic data refresh, the rate of automatic refresh.
    In addition to these useful monitoring capabilities, OSM allows you to send LAN pop-up message to users of Oracle sessions.
    Features:
    --Capture all SQL statement text and archive to files in real time
    --Pinpoints problematic database sessions and displays detailed performance and resource consumption data.
    --Dynamically list sessions holding locks and other sessions who are waiting for.
    --Support to kill several selected sessions
    --Send LAN pop-up message to users of Oracle sessions
    --Gives hit/miss ratio for library cache,dictionary cache and buffer cache periodically,helps to tune memory
    --Export necessary data into file
    --Modify the dynamic system parameters on the fly
    --Syntax highlight for SQL statements
    --An overview of your current connected instance informaiton,such as Version, SGA,License,etc
    --Find out object according to File Id and Block Id
    Gudu Software
    http://www.wangz.net

    AnkitV wrote:
    Hi All
    I have 3 statements and I am writing some thing to a file using UTL_FILE.PUT_LINE after each statement is over. Each statement takes mentioned time to complete.
    I am opening file in append mode.
    statement1 (takes 2 mins)
    UTL_FILE.PUT_LINE
    statement2 (takes 5 mins)
    UTL_FILE.PUT_LINE
    statement3 (takes 10 mins)
    UTL_FILE.PUT_LINE
    I noticed that I am able to see contents written by UTL_FILE.PUT_LINE only after statement3 is over, not IMMEDIATELY after statement1 and statement2 are done ?
    Can anybody tell me if this is correct behavior or am I missing something here ?Calling procedure must terminate before data is actually written to the file.
    It is expected & correct behavior.

  • Getting timestamps for SQL session without the trace file enabled

    hi, i have a clarification. Is there a method or way by which i can get the timestamps of an SQL session without the the trace file enabled , and if so please get me the details of this.
    thanks in advance.

    Hi,
    Don't very understand what do you want.
    SQL> set timing on
    SQL> select * from dual;
    D
    X
    Elapsed: 00:00:01.07
    SQL> Is this ?
    Nicolas.

  • Run sql statement from batch file

    How can we execute SQL Statement using Batch file???
    I did a test.
    create batch file test.bat
    sqlplus "username@db /pass" @\script.sql
    script.sql file has following statement
    select sysdate from dual;
    exit
    it is working but I want to call sql statement in the same batch file instead of calling .sql script file. how can I do that any idea..

    This is very easy in unix shell scripting, but AFAIK, not available with Windows. It's a function of how the shell/command processor handles input redirection.

  • Not able to get the actual plan from trace file

    Hi all
    I have a Db package and want to get actual execution plan of all the statements in that pakcage it does provides the plan for System's statements but does not displays the plan for Sql statements
    DB version 9.2.0 using the following sequence of insructions
    set timing on
    set serveroutput on
    alter session set events '10046 trace name context forever ,level 12';
    begin
    run_service.collect_data(sysdate);
    end;
    alter session set sql_trace=false;
    exit; ---exit from Sql
    now look at the output
    select distinct obj#,containerobj#,pflags,xpflags,mflags
    from
    sum$, suminline$ where sumobj#=obj# and inline#=:1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 1 1 0 0
    total 3 0.00 0.00 1 1 0 0
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    0 SORT UNIQUE
    0 NESTED LOOPS
    0 TABLE ACCESS BY INDEX ROWID SUMINLINE$
    0 INDEX RANGE SCAN I_SUMINLINE$_2 (object id 1614116)
    0 TABLE ACCESS BY INDEX ROWID SUM$
    0 INDEX UNIQUE SCAN I_SUM$_1 (object id 319)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 1 0.00 0.00
    SELECT SEQ_NUM, S_DATE, S_TIME, CSTATUS, G_SERVICE,
    B_REFERENCE, V_REFERENCE, M_PRIORITY
    FROM GL_HIST
    ORDER BY S_DATE DESC, S_TIME DESC
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.01 0 0 0 0
    Execute 2819 0.37 0.32 0 0 0 0
    Fetch 2819 2.50 20.47 2786 20164 0 2819
    total 5639 2.88 20.81 2786 20164 0 2819
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 15550 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 2786 0.05 18.19
    latch free 4 0.04 0.06
    UPDATE G_ORIG SET G_SERVICE = :B1
    WHERE
    SEQ_NUM = :B5 AND S_DATE = :B4 AND S_TIME = :B3 AND
    C_STATUS = :B2 AND NVL(G_SERVICE, '+') <> NVL(:B1, '+')
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.03 0 0 0 0
    Execute 3731 0.74 0.99 261 18712 119 54
    Fetch 0 0.00 0.00 0 0 0 0
    total 3732 0.74 1.02 261 18712 119 54
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 15550 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 261 0.01 0.19
    latch free 9 0.01 0.04
    COMMIT

    Remove the line alter session set sql_trace=false and just exit/disconnect. The explain plain is contained in the STAT lines in the trace file and are only written when the cursor closes. If you turn off tracing before the cursor closes the STAT lines will not get written.

  • Trace File Created Upon Execution of "alter system kill session sid, serial# immediate;"

    A problem within a third-party application is causing it to create and abandon Oracle sessions. At times three hundred or more abandoned sessions accumulated in the instance. The software company is working on the problem. Oracle's background processes will get rid of those sessions after several hours, but at times there were so many they caused the server to start using paging space. We wrote a SQL*Plus script to identify the abandoned sessions and kill them with command "alter system kill session <sid, serial#> immediate;". We automated the execution of the script a week ago. Today I noticed that in my udump directory an Oracle trace file has been created each time our script kills a session. A single trace file is created regardless of how many sessions are killed. No errors appear in the trace file.
    Is the creation of these trace files an indication that problems have occurred or are they there for information only?
    Since I know how and why the sessions are being killed, is it safe to ignore the trace files?
    Thank you,
    Bill

    The OS is AIX 5.2. The database server is 10.2.0.2. We are in the processing of upgrading to AIX 7.1 and database server 11.2.0.3.6.
    The script does not enable tracing for the SQL*Plus session.
    Below is the alert log message from a session killed at 11:22, and the corresponding trace file created at that same time:
    From alert_<sid>.log: 
    Wed Jul 31 11:22:01 2013
    Immediate Kill Session#: 1119, Serial#: 59885
    Immediate Kill Session: sess: 70000014dc4a7e0 OS pid: 267254
    /u02/admin/EXPRESS/udump $ ls -l express_ora_113358.trc
    -rw-r----- 1 oracle dba 2276 Jul 31 11:22 express_ora_113358.trc
    /u02/admin/EXPRESS/udump $ pg express_ora_113358.trc
    Dump file /u02/admin/EXPRESS/udump/express_ora_113358.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/product/10.2.0
    System name: AIX
    Node name: navis
    Release: 2
    Version: 5
    Machine: 0005CD8C4C00
    Instance name: EXPRESS
    Redo thread mounted by this instance: 1
    Oracle process number: 225
    Unix process pid: 113358, image: oracleEXPRESS@navis
    *** ACTION NAME:() 2013-07-31 11:22:01.181
    *** MODULE NAME:(SQL*Plus) 2013-07-31 11:22:01.181
    *** SERVICE NAME:(EXPRESS.WORLD) 2013-07-31 11:22:01.181
    *** SESSION ID:(1723.61000) 2013-07-31 11:22:01.181
    SO: 70000014d44d278, type: 2, owner: 0, flag: INIT/-/-/0x00
    (process) Oracle pid=463, calls cur/top: 0/700000139166298, flag: (0) -
    int error: 0, call error: 0, sess error: 0, txn error 0
    (post info) last post received: 108 0 4
    last post received-location: kslpsr
    last process to post me: 70000014d36c398 1 6
    last post sent: 0 0 24
    last post sent-location: ksasnd
    last process posted by me: 70000014d36c398 1 6
    (latch info) wait_event=0 bits=0
    Process Group: DEFAULT, pseudo proc: 70000014d6aec00
    O/S info: user: oracle, term: UNKNOWN, ospid: 267254
    OSD pid info: Unix process pid: 267254, image: oracleEXPRESS@navis
    Short stack dump:
    ksdxfstk+002c<-ksdxcb+04e4<-sspuser+0074<-00004CB0<-nttrd+0120<-nsprecv+0750<-ns
    rdr+0114<-nsdo+1714<-nsbrecv+0040<-nioqrc+04a8<-opikndf2+0688<-opitsk+088c<-opii
    no+0990<-opiodr+0adc<-opidrv+0474<-sou2o+0090<-opimai_real+01bc<-main+0098<-__st
    art+0090
    Dump of memory from 0x070000014D2CC3B0 to 0x070000014D2CC5B8
    70000014D2CC3B0 00000004 00000000 07000001 39DA8D48 [............9..H]
    70000014D2CC3C0 00000010 0003139D 07000001 39166298 [............9.b.]
    70000014D2CC3D0 00000003 0003139D 07000001 4C73D508 [............Ls..]
    70000014D2CC3E0 0000000B 0003139D 07000001 4DC4A7E0 [............M...]
    70000014D2CC3F0 00000004 00031291 00000000 00000000 [................]
    70000014D2CC400 00000000 00000000 00000000 00000000 [................]
    Repeat 26 times
    70000014D2CC5B0 00000000 00000000 [........]
    Thanks,
    Bill

  • Oracle Trace File generation for a session

    Hi,
    I am using oracle 10g(10.2.0.5) in RHEL5 server. i have used the exec dbms_system.set_sql_trace_in_session(147,3,TRUE); statement to trace a particular session. i am able to trace successfully but i have created a new table in that session where i am not able to find any create table statement in the generated trace file but i can find the insert statements which i performed on the newly created table in the trace file.
    Does DDL statements not recorded in the trace events???
    Regards,
    007

    Hi;
    Please see below doc which may helps you
    DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION DOES NOT GENERATE TRACE FOR ACTIVE SESSION [ID 236178.1]
    How To Enable SQL Trace for All New Sessions [ID 178923.1]
    Tracing Sessions in Oracle Using the DBMS_SUPPORT Package [ID 62160.1]
    Regard
    Helios

  • Trace file query

    We seem to be having the problem that an application has 2 threads trying to write to the same row of a table. What I dont understand is that in the insert statement shown in the trace file the data after the VALUES word is not proper data. I dont know if this indicates an application problem or if this is due to the format of the trace file :-
    INSERT INTO GDOC_ALERTS_STATUS (ActionTime,ActionCode,ServerSerial,ServerName,Serial) VALUES (:actiontime,:actioncode,:serverserial,:servername,:serial)
    The following deadlock is not an ORACLE error. It is a
    deadlock due to user error in the design of an application
    or from issuing incorrect ad-hoc SQL. The following
    information may aid in determining the deadlock:
    Deadlock graph:
    ---------Blocker(s)-------- ---------Waiter(s)---------
    Resource Name process session holds waits process session holds waits
    TX-0004000d-0002720f 18 25 X 19 13 X
    TX-00010023-000270d1 19 13 X 18 25 S
    session 25: DID 0001-0012-00000002     session 13: DID 0001-0013-00000002
    session 13: DID 0001-0013-00000002     session 25: DID 0001-0012-00000002
    Rows waited on:
    Session 13: obj - rowid = 00006281 - AAAGMRAAJAAA6bIAAA
    Session 25: no row

    VALUES (:actiontime,:actioncode,:serverserial,:servername,:serial)These are the variables in your application code. You cannot see the actual data that is inserted.

  • [10g - XE] Why is my disk full of trace files?

    Just in case there's another silly person like me out there who encounters this problem...
    I have XE 10g installed on my local machine (Windows XP), as my own personal test environment.
    My computer was acting really weird yesterday, then today I got an error while using Excel that my disk was full.... and after some investigating, I discovered that I have 39 GB (gasp!) of trace files! These are all located in the directory C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\trace
    ...and some of them are quite large (obviously, since I have 39 GB of them...); one of them by itself is 2 GB.
    Almost all of the files are named like: sqlnet_trace.txt_3132_1.trc And, for example, I already have 5 trace files from today, totaling 15 MB.
    I vaguely recalled setting my trace level to 16 or SUPPORT a LONG time ago, and funny thing, I couldn't remember changing it back to OFF.
    So, if you've been silly like me, check your sqlnet.ora file, and set TRACE_LEVEL_CLIENT=OFF

    Thanks for the tip. I checked listener.ora, and it doesn't appear that any trace files are enabled there. I don't know what Net manager is.
    At least in this case, the server/database is just my personal PC, so the only person it impacted was me. It took 7 months for the trace files to grow to that size with just me using the database, so I can only imagine what it would do to a database in an actual environment.

  • Trace file created for the wrong session

    DB version : 10.2.0.3.0
    OS version: Solaris 5.10
    2 node RAC
    Using DBMS_MONITOR.SESSION_TRACE_ENABLE, I have been trying to trace an oracle session spawned by a C++ application.
    So, i determined which instance this session is connected by querying gv$session. I logged in as SYS in that instance's Node and then issued
    execute dbms_monitor.session_trace_enable(4371,98124, true, false);After enabling, i saw new A trace file being generated. But this trace is actually tracing SYS's session which executed dbms_monitor.session_trace_enable and not the session (4371,98124) !!! I tested few basic queries in SYS's session like
    select sysdate from dualAnd i can see all these queries appearing in the trace file. What could be the cause of this issue?
    I have noticed that
    SHARED_SERVERS = 1 on both nodes. Is this causing this weird issue? For tracing, If i disable SHARED_SERVERS using
    alter system set SHARED_SERVERS = 0
    will it cause any connection problems for the client applications because of their tnsnames.ora file setting?

    John_75 wrote:
    Thank you DBMS_DIRECT.
    trace is enabled only on the instance to which the caller is connected
    So, how do i enable tracing for sessions spawned by Java or C++ applications.
    According to the documentation, i can use DBMS_MONITOR for tracing applications
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm
    Your 2 node RAC has two instances (e.g. INST1 and INST2). My understanding of that is that with the above command, to be able to trace session 123 connected to INST1, your SYS need to be connected to INST1. To be able to trace session 456 connected to INST2, your SYS need to be connected to INST2.

  • Excuting multiple sql statements

    Hi to everybody.
    I'm quite new to Oracle even if i have quite a big experience with MySQL and SQL commands. I'm facing a problem that I suppose it is a really basic one.
    I received a dump of an Oracle database in a .sql format. I mean that both the schema and the data are build through a large number of sql statements. In particular the schema is made through a lot of "create table ..." while the data are built through "insert into..". My need is to import these database in a fresh Oracle database Oracle 10 g XE.
    I've installed it on a Debian system and i can succesfully execute a single SQL command both through the web interface http://localhost:8080/apex and logging as oracle user through the sqlplus username/passwd command.
    My problem is that the data are split on about 12000 SQL "INSERT INTO.." so executing all of them one by one could be a little annoying :-)
    <u>So I'm asking if there is a way to instruct Oracle to execute multiple SQL statements reading it from a file (like MySQL does for example).</u>
    I' m considering to write a script to do it if there's no better way. I know that there're better way to dump databases in Oracle but I can change the .sql format since it is the only one that I got.

    in SQL*Plus you can execute a SQL file with the start command or it's shorthand version @:SQL> start filename.sql
    or
    SQL> @filename.sql

  • Tkprof : 0  user  SQL statement in trace file

    Hello!
    Please explain , what is difference of tkprof-converting of user session trace file and an internal/background process ?
    Get I message "0 user SQL statement in trace file" cause this difference?
    In my target session I issued :
    begin
    sys.dbms_system.set_ev(...., .., 10046, 12, '');
    end;
    begin
    sys.dbms_system.set_ev(..., .., 10053, 1, '');
    end;
    /Thanks and regards,
    Pavel

    Did you try to tkprof a 10053 trace ?
    That is not going to show anything. 10053 traces are meant to be read as they are. tkprof is there to deal with 10046 traces.

Maybe you are looking for