Query to find adhoc queries taking high cpu on server

Hi,
I want to find all the adhoc and other queries consuming high cpu on sql server. sys.dm_exec_cahched_plan will only have cached queries and not the currently running ones.

Hi Preetha7,
According to your description, if you want to identify the most expensive SQL Server queries based on the cumulative CPU cost, you can use the DMVs of the sys.dm_exec_sql_text , the sys.dm_exec_query_plan and sys.dm_exec_query_stats. For example, you can
refer to the following T-SQL statement.
SELECT TOP 20
qs.sql_handle,
qs.execution_count,
qs.total_worker_time AS Total_CPU,
total_CPU_inSeconds = --Converted from microseconds
qs.total_worker_time/1000000,
average_CPU_inSeconds = --Converted from microseconds
(qs.total_worker_time/1000000) / qs.execution_count,
qs.total_elapsed_time,
total_elapsed_time_inSeconds = --Converted from microseconds
qs.total_elapsed_time/1000000,
st.text,
qp.query_plan
FROM
sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
CROSS apply sys.dm_exec_query_plan (qs.plan_handle) AS qp
ORDER BY qs.total_worker_time DESC
Or you can run the "Performance - Top Queries By Total CPU Time" report in SSMS. In addition, you can use SQL Server Extended Events session for troubleshooting the high consumed of CPU time. For more information about finding currently session that is costing
high CPU.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/cb3e29ca-f1ef-4440-8f1a-db4924a43c5c/find-currently-session-that-is-costing-high-cpu?forum=sqldatabaseengine
http://blogs.msdn.com/b/batala/archive/2011/07/23/troubleshoot-high-cpu-issue-without-using-profile-traces.aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support

Similar Messages

  • Oracle internal queries taking more CPU time

    Hi,
    Following are queries taking more CPU time. I got this from awr report. Can anyone tell me why these queries are running? Is it a oracle enterprise manager query? should I use
    emctl stop dbconsole to stop this?
    DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN := FALSE; BEGIN EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); :mydate := next_date; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;
    SELECT COUNT(*) FROM MGMT_METRIC_DEPENDENCY_DETAILS DEP, MGMT_SEVERITY SEV WHERE DEP.TARGET_GUID = :B5 AND DEP.METRIC_GUID = :B4 AND DEP.KEY_VALUE = :B3 AND DEP.EDEP_TARGET_GUID = SEV.TARGET_GUID AND DEP.EDEP_METRIC_GUID = SEV.METRIC_GUID AND DEP.DEP_KEY_VALUE = SEV.KEY_VALUE AND SEV.COLLECTION_TIMESTAMP BETWEEN :B2 AND :B1
    SELECT CURRENT_STATUS FROM MGMT_CURRENT_AVAILABILITY WHERE TARGET_GUID = :B1
    Thanks in advance
    With Regards
    boobathi.P

    Hi,
    maybe this document will help if you are using 10g:
    SQL run by SYSMAN consuming a lot of resources on OMS with 800+ targets [ID 330383.1]
    https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=PROBLEM&id=330383.1
    there you'll find Cause and Solution too:
    SYSMAN Job and Queries are Taking Up High CPU (DB Console) [ID 1288301.1]
    https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=PROBLEM&id=1288301.1
    For databases above version 11.1 there are paches available.
    Best,
    Michael T. Z.

  • Which process taking high CPU

    Hi
    Our environment is having SCOM 2007 R2.
    I want to get the details of processes taking high CPU,memory in windows server 2003 , 2008. These details are stored in Opsmgr DatawareHouse ? , can I get in the form of reports? OR any script available.Please help.
    Regards
    Madhavi

    Hi Madhavi,
    Run this script on a server and you will get the individual process utilization. I am not sure how you exactly need this.
    strComputer = "localhost"
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\cimv2")
    Set colProcesses = objWMIService.ExecQuery _
       ("Select * from Win32_Process")
    For Each objProcess in colProcesses
        Wscript.Echo "Process: " & objProcess.Name
        sngProcessTime = (CSng(objProcess.KernelModeTime) + _
            CSng(objProcess.UserModeTime)) / 10000000
        Wscript.Echo "Processor Time: " & sngProcessTime
        Wscript.Echo "Process ID: " & objProcess.ProcessID
        Wscript.Echo "Working Set Size: " _
        & objProcess.WorkingSetSize
        Wscript.Echo "Page File Size: " _
        & objProcess.PageFileUsage
        Wscript.Echo "Page Faults: " & objProcess.PageFaults
    Next
    Let me know if this helps
    Regards, Dhanraj

  • Process SERVER0 its taking High CPU Time in XI

    Hi,
    We installed XI 3.0 develpoment server ,Process <b>SERVER0</b> its taking more CPU time.
    We are using AS/400 OS & DB2 datbase.Can any one tell me the reason & Solution for this.
    Thanks & Regards,
    Gopinath.

    hi,
    Actually the user XIRWBUSER its an RFC user but its running on many dialog process.I think high CPU time due to this user only.
    using 5 work processes and 3/4 of the available CPU for an extended amount of time.
    Total Total DB
    Job or CPU Sync Async CPU
    Task User Number Thread Pty Util I/O I/O Util
    WP11 D6464 485368 00000010 20 54.0 25 37 27.8
    WP05 X4242 498642 00000098 20 49.6 5 0 36.7
    WP04 X4242 498641 00000014 20 48.8 1 0 39.1
    WP02 X4242 498639 0000025A 20 47.1 2 0 37.8
    WP06 X4242 498643 000001E6 20 43.7 0 0 38.3
    WP00 X4242 498637 00000014 20 11.1 502 194 2.9
    pls can any one help me
    Regards,
    Gopinath.

  • Query taking high  CPU usage

    Hi,
    I have a Oracle 9.2 DB with 2 cpu's,when i took a statspack report i found that CPU Time is very hight i,e more that 81%....
    one of the query is taking near about 51% CPU Usage...
    i.e
    SELECT /*+ INDEX (OM_COURSE_FEE OCF_CFC_CODE)  */DISTINCT CF_COURSE_CODE   FROM OM_COURSE_FEE,OT_STUDENT_FEE_COL_HEAD,OT_STUDENT_FEE_COL_DETL  WHERE SFCH_SYS_ID = SFCD_SFCH_SYS_ID  AND
    SFCD_FEE_TYPE_CODE = CF_TYPE_CODE  AND CF_COURSE_CODE IN ( 'PE1','PE2','CCT','CPT'  ) AND SFCH_TXN_CODE = :b1  AND SFCD_SUBSCRBE_JOURNAL_YN IN ( 'T','R','1','C'  ) AND SFCH_APPR_UID IS NOT NULL  
    AND SFCH_APPR_DT IS NOT NULL   AND SFCH_NO = :b2  AND NOT EXISTS  (SELECT 'X'   FROM OM_STUDENT_HEAD  WHERE STUD_SRN = SFCH_STUD_SRN_TEMP_NO  AND NVL(STUD_CLO_STATUS,0) != 1  AND
    NVL(STUD_REG_STATUS,0) != 23  AND STUD_COURSE_CODE != 'CCT'  AND CF_COURSE_CODE= STUD_COURSE_CODE )  ORDER BY 1 DESCExplain Plan for......
    SQL> select * from table(dbms_xplan.display());
    PLAN_TABLE_OUTPUT
    | Id  | Operation                                  |  Name
       | Rows  | Bytes | Cost  | Pstart| Pstop |
    |   0 | SELECT STATEMENT                           |
    PLAN_TABLE_OUTPUT
       |     1 |    69 |    45 |       |       |
    |   1 |  SORT UNIQUE                               |
       |     1 |    69 |    27 |       |       |
    |   2 |   TABLE ACCESS BY GLOBAL INDEX ROWID       | OT_STUDENT_FEE_COL_DETL
       |     1 |    12 |     2 | ROWID | ROW L |
    |   3 |    NESTED LOOPS                            |
       |     1 |    69 |     9 |       |       |
    PLAN_TABLE_OUTPUT
    |   4 |     NESTED LOOPS                           |
       |     1 |    57 |     7 |       |       |
    |   5 |      TABLE ACCESS BY GLOBAL INDEX ROWID    | OT_STUDENT_FEE_COL_HEAD
       |     1 |    48 |     5 | ROWID | ROW L |
    |   6 |       INDEX SKIP SCAN                      | OT_STUDENT_FEE_COL_HEAD_UK0
    1  |     1 |       |     4 |       |       |
    |   7 |      INLIST ITERATOR                       |
       |       |       |       |       |       |
    PLAN_TABLE_OUTPUT
    |   8 |       TABLE ACCESS BY INDEX ROWID          | OM_COURSE_FEE
       |     1 |     9 |     2 |       |       |
    |   9 |        INDEX RANGE SCAN                    | OCF_CFC_CODE
       |     1 |       |     1 |       |       |
    |  10 |         FILTER                             |
       |       |       |       |       |       |
    |  11 |          TABLE ACCESS BY GLOBAL INDEX ROWID| OM_STUDENT_HEAD
    PLAN_TABLE_OUTPUT
       |     1 |    21 |     4 | ROWID | ROW L |
    |  12 |           INDEX RANGE SCAN                 | IDM_STUD_SRN_COURSE
       |     1 |       |     3 |       |       |
    |  13 |     INDEX RANGE SCAN                       | IDM_SFCD_FEE_TYPE_CODE
       | 34600 |       |     1 |       |       |
    PLAN_TABLE_OUTPUT
    Note: cpu costing is off, PLAN_TABLE' is old version
    21 rows selected.
    SQL>Statspack report
    DB Name         DB Id    Instance     Inst Num Release     Cluster Host
    ai          1372079993 ai11              1 9.2.0.6.0   YES     ai1
                  Snap Id     Snap Time      Sessions Curs/Sess Comment
    Begin Snap:       175 12-Dec-08 13:21:33  #######        .0
      End Snap:       176 12-Dec-08 13:56:09  #######        .0
       Elapsed:               34.60 (mins)
    Cache Sizes (end)
    ~~~~~~~~~~~~~~~~~
                   Buffer Cache:     3,264M      Std Block Size:          8K
               Shared Pool Size:       608M          Log Buffer:        977K
    Load Profile
    ~~~~~~~~~~~~                            Per Second       Per Transaction
                      Redo size:              5,727.62             21,658.54
                  Logical reads:             16,484.89             62,336.32
                  Block changes:                 32.49                122.88
                 Physical reads:                200.46                758.03
                Physical writes:                  5.08                 19.23
                     User calls:                 97.43                368.44
                         Parses:                 11.66                 44.11
                    Hard parses:                  0.39                  1.48
                          Sorts:                  3.22                 12.19
                         Logons:                  0.02                  0.06
                       Executes:                 36.70                138.77
                   Transactions:                  0.26
      % Blocks changed per Read:    0.20    Recursive Call %:     28.65
    Rollback per transaction %:   20.95       Rows per Sort:    131.16
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Buffer Nowait %:  100.00       Redo NoWait %:    100.00
                Buffer  Hit   %:   98.79    In-memory Sort %:     99.99
                Library Hit   %:   98.92        Soft Parse %:     96.65
             Execute to Parse %:   68.21         Latch Hit %:     99.98
    Parse CPU to Parse Elapsd %:   60.50     % Non-Parse CPU:     99.48
    Shared Pool Statistics        Begin   End
                 Memory Usage %:   90.06   89.79
        % SQL with executions>1:   72.46   72.46
      % Memory for SQL w/exec>1:   69.42   69.51
    Top 5 Timed Events
    ~~~~~~~~~~~~~~~~~~                                                     % Total
    Event                                               Waits    Time (s) Ela Time
    CPU time                                                        3,337    81.43
    db file sequential read                            60,550         300     7.32
    global cache cr request                           130,852         177     4.33
    db file scattered read                             72,915         101     2.46
    db file parallel read                               3,384          75     1.84
    Cluster Statistics for DB: ai  Instance: ai11  Snaps: 175 -176
    Global Cache Service - Workload Characteristics
    Ave global cache get time (ms):                            1.3
    Ave global cache convert time (ms):                        2.1
    Ave build time for CR block (ms):                          0.1
    Ave flush time for CR block (ms):                          0.3
    Ave send time for CR block (ms):                           0.3
    Ave time to process CR block request (ms):                 0.7
    Ave receive time for CR block (ms):                        4.9
    Ave pin time for current block (ms):                       0.0
    Ave flush time for current block (ms):                     0.0
    Ave send time for current block (ms):                      0.3
    Ave time to process current block request (ms):            0.3
    Ave receive time for current block (ms):                   2.8
    Global cache hit ratio:                                    1.5
    Ratio of current block defers:                             0.0
    % of messages sent for buffer gets:                        1.4
    % of remote buffer gets:                                   0.1
    Ratio of I/O for coherence:                                1.1
    Ratio of local vs remote work:                             9.7
    Ratio of fusion vs physical writes:                        0.1
    Global Enqueue Service Statistics
    Ave global lock get time (ms):                             0.8
    Ave global lock convert time (ms):                         0.0
    Ratio of global lock gets vs global lock releases:         1.1
    GCS and GES Messaging statistics
    Ave message sent queue time (ms):                          0.4
    Ave message sent queue time on ksxp (ms):                  2.7
    Ave message received queue time (ms):                      0.2
    Ave GCS message process time (ms):                         0.1
    Ave GES message process time (ms):                         0.1
    % of direct sent messages:                                19.4
    % of indirect sent messages:                              43.5
    % of flow controlled messages:                            37.1
    GES Statistics for DB: ai  Instance: ai11  Snaps: 175 -176
    Statistic                                    Total   per Second    per Trans
    dynamically allocated gcs resourc                0          0.0          0.0
    dynamically allocated gcs shadows                0          0.0          0.0
    flow control messages received                   0          0.0          0.0
    flow control messages sent                       0          0.0          0.0
    gcs ast xid                                      0          0.0          0.0
    gcs blocked converts                         1,231          0.6          2.2
    gcs blocked cr converts                      2,432          1.2          4.4
    gcs compatible basts                             0          0.0          0.0
    gcs compatible cr basts (global)               658          0.3          1.2
    gcs compatible cr basts (local)             57,822         27.9        105.3
    gcs cr basts to PIs                              0          0.0          0.0
    gcs cr serve without current lock                0          0.0          0.0
    gcs error msgs                                   0          0.0          0.0
    gcs flush pi msgs                              821          0.4          1.5
    gcs forward cr to pinged instance                0          0.0          0.0
    gcs immediate (compatible) conver              448          0.2          0.8
    gcs immediate (null) converts                1,114          0.5          2.0
    gcs immediate cr (compatible) con           42,094         20.3         76.7
    gcs immediate cr (null) converts           396,284        190.9        721.8
    gcs msgs process time(ms)                   42,220         20.3         76.9
    gcs msgs received                          545,133        262.6        993.0
    gcs out-of-order msgs                            5          0.0          0.0
    gcs pings refused                                1          0.0          0.0
    gcs queued converts                              0          0.0          0.0
    gcs recovery claim msgs                          0          0.0          0.0
    gcs refuse xid                                   0          0.0          0.0
    gcs retry convert request                        0          0.0          0.0
    gcs side channel msgs actual                 2,397          1.2          4.4
    gcs side channel msgs logical              232,024        111.8        422.6
    gcs write notification msgs                     15          0.0          0.0
    gcs write request msgs                         278          0.1          0.5
    gcs writes refused                               1          0.0          0.0
    ges msgs process time(ms)                    4,873          2.3          8.9
    ges msgs received                           39,769         19.2         72.4
    global posts dropped                             0          0.0          0.0
    global posts queue time                          0          0.0          0.0
    global posts queued                              0          0.0          0.0
    global posts requested                           0          0.0          0.0
    global posts sent                                0          0.0          0.0
    implicit batch messages received            39,098         18.8         71.2
    implicit batch messages sent                33,386         16.1         60.8
    lmd msg send time(ms)                          635          0.3          1.2
    lms(s) msg send time(ms)                         2          0.0          0.0
    messages flow controlled                   196,546         94.7        358.0
    messages received actual                   182,783         88.0        332.9
    messages received logical                  584,848        281.7      1,065.3
    messages sent directly                     102,657         49.4        187.0
    messages sent indirectly                   230,329        110.9        419.5
    msgs causing lmd to send msgs                9,169          4.4         16.7
    msgs causing lms(s) to send msgs             3,347          1.6          6.1
    msgs received queue time (ms)              142,759         68.8        260.0
    msgs received queued                       584,818        281.7      1,065.2
    msgs sent queue time (ms)                   99,300         47.8        180.9
    msgs sent queue time on ksxp (ms)          608,239        293.0      1,107.9
    msgs sent queued                           230,391        111.0        419.7
    msgs sent queued on ksxp                   229,013        110.3        417.1
    GES Statistics for DB: ai  Instance: ai11  Snaps: 175 -176
    Statistic                                    Total   per Second    per Trans
    process batch messages received             65,059         31.3        118.5
    process batch messages sent                 50,959         24.5         92.8
    Wait Events for DB: ai  Instance: ai11  Snaps: 175 -176
    -> s  - second
    -> cs - centisecond -     100th of a second
    -> ms - millisecond -    1000th of a second
    -> us - microsecond - 1000000th of a second
    -> ordered by wait time desc, waits desc (idle events last)
                                                                       Avg
                                                         Total Wait   wait    Waits
    Event                               Waits   Timeouts   Time (s)   (ms)     /txn
    db file sequential read            60,550          0        300      5    110.3
    global cache cr request           130,852        106        177      1    238.3
    db file scattered read             72,915          0        101      1    132.8
    db file parallel read               3,384          0         75     22      6.2
    latch free                          7,253      1,587         52      7     13.2
    enqueue                            44,947          0         16      0     81.9
    log file parallel write             2,140          0          6      3      3.9
    db file parallel write                341          0          5     14      0.6
    global cache open x                 1,134          3          4      4      2.1
    CGS wait for IPC msg              166,993    164,390          4      0    304.2
    library cache lock                  3,169          0          3      1      5.8
    log file sync                         494          0          3      5      0.9
    row cache lock                        702          0          3      4      1.3
    DFS lock handle                     6,900          0          2      0     12.6
    control file parallel write           689          0          2      3      1.3
    control file sequential read        2,785          0          2      1      5.1
    wait for master scn                   687          0          2      2      1.3
    global cache null to x                699          0          2      2      1.3
    global cache s to x                   778          5          1      2      1.4
    direct path write                     148          0          0      3      0.3
    SQL*Net more data to client         3,621          0          0      0      6.6
    global cache open s                   149          0          0      2      0.3
    library cache pin                      78          0          0      2      0.1
    ksxr poll remote instances          3,536      2,422          0      0      6.4
    LGWR wait for redo copy                12          6          0      9      0.0
    buffer busy waits                      23          0          0      5      0.0
    direct path read                        9          0          0     10      0.0
    buffer busy global CR                   5          0          0     17      0.0
    SQL*Net break/reset to clien          172          0          0      0      0.3
    global cache quiesce wait               4          1          0      7      0.0
    KJC: Wait for msg sends to c           86          0          0      0      0.2
    BFILE get length                       67          0          0      0      0.1
    global cache null to s                  9          0          0      1      0.0
    BFILE open                              6          0          0      0      0.0
    BFILE read                             60          0          0      0      0.1
    BFILE internal seek                    60          0          0      0      0.1
    BFILE closure                           6          0          0      0      0.0
    cr request retry                        4          4          0      0      0.0
    SQL*Net message from client       201,907          0    180,583    894    367.8
    gcs remote message                171,236     43,749      3,975     23    311.9
    ges remote message                 79,324     40,722      2,017     25    144.5
    SQL*Net more data from clien          447          0          9     21      0.8
    SQL*Net message to client         201,901          0          0      0    367.8
    Background Wait Events for DB: ai  Instance: ai11  Snaps: 175 -176
    -> ordered by wait time desc, waits desc (idle events last)
                                                                       Avg
                                                         Total Wait   wait    Waits
    Event                               Waits   Timeouts   Time (s)   (ms)     /txn
    enqueue                            44,666          0         16      0     81.4
    latch free                          4,895        108          6      1      8.9
    log file parallel write             2,140          0          6      3      3.9
    db file parallel write                341          0          5     14      0.6
    CGS wait for IPC msg              166,969    164,366          4      0    304.1
    DFS lock handle                     6,900          0          2      0     12.6
    control file parallel write           689          0          2      3      1.3
    control file sequential read        2,733          0          2      1      5.0
    wait for master scn                   687          0          2      2      1.3
    ksxr poll remote instances          3,528      2,419          0      0      6.4
    LGWR wait for redo copy                12          6          0      9      0.0
    db file sequential read                 7          0          0      9      0.0
    global cache null to x                 26          0          0      2      0.0
    global cache open x                    16          0          0      1      0.0
    global cache cr request                 1          0          0      0      0.0
    rdbms ipc message                  28,636     20,600     16,937    591     52.2
    gcs remote message                171,254     43,746      3,974     23    311.9
    pmon timer                            708        686      2,022   2856      1.3
    ges remote message                 79,305     40,719      2,017     25    144.5
    smon timer                            125          0      1,972  15776      0.2
    SQL ordered by Gets for DB: ai  Instance: ai11  Snaps: 175 -176
    -> End Buffer Gets Threshold:     10000
    -> Note that resources reported for PL/SQL includes the resources used by
       all SQL statements called within the PL/SQL code.  As individual SQL
       statements are also reported, it is possible and valid for the summed
       total % to exceed 100
                                                         CPU      Elapsd
      Buffer Gets    Executions  Gets per Exec  %Total Time (s)  Time (s) Hash Value
         17,503,305           84      208,372.7   51.1   676.25   1218.80   17574787
    SELECT /*+ INDEX (OM_COURSE_FEE OCF_CFC_CODE)  */DISTINCT CF_COU
    RSE_CODE   FROM OM_COURSE_FEE,OT_STUDENT_FEE_COL_HEAD,OT_STUDENT
    FEECOL_DETL  WHERE SFCH_SYS_ID = SFCD_SFCH_SYS_ID  AND SFCD_FE
    E_TYPE_CODE = CF_TYPE_CODE  AND CF_COURSE_CODE IN ( 'PE1','PE2',
    'CCT','CPT'  ) AND SFCH_TXN_CODE = :b1  AND SFCD_SUBSCRBE_JOURNA

    user00726 wrote:
    somw of the changes that have been done....
    cai11_lmd0_15771.trc.
    Thu Oct 2 13:35:48 2008
    CKPT: Begin resize of buffer pool 3 (DEFAULT for block size 8192)
    CKPT: Current size = 2512 MB, Target size = 3072 MB
    CKPT: Resize completed for buffer pool DEFAULT for blocksize 8192
    Thu Oct 2 13:35:50 2008
    ALTER SYSTEM SET db_cache_size='3072M' SCOPE=BOTH SID='icai11';
    Thu Oct 2 14:04:34 2008
    ALTER SYSTEM SET sga_max_size='5244772679680' SCOPE=SPFILE SID='*';
    ALTER SYSTEM SET sga_max_size='5244772679680' SCOPE=SPFILE SID='*';
    Thu Oct 2 15:24:14 2008
    CKPT: Begin resize of buffer pool 3 (DEFAULT for block size 8192)
    CKPT: Current size = 3072 MB, Target size = 2512 MB
    CKPT: Resize completed for buffer pool DEFAULT for blocksize 8192
    Thu Oct 2 15:24:20 2008
    ALTER SYSTEM SET db_cache_size='2512M' SCOPE=BOTH SID='icai11';
    Thu Oct 2 15:32:33 2008
    CKPT: Begin resize of buffer pool 3 (DEFAULT for block size 8192)
    CKPT: Current size = 2512 MB, Target size = 3072 MB
    CKPT: Resize completed for buffer pool DEFAULT for blocksize 8192
    Thu Oct 2 15:32:34 2008
    ALTER SYSTEM SET db_cache_size='3072M' SCOPE=BOTH SID='icai11';
    Thu Oct 2 15:36:46 2008
    ALTER SYSTEM SET shared_pool_size='640M' SCOPE=BOTH SID='icai11';
    Thu Oct 2 16:33:52 2008
    CKPT: Begin resize of buffer pool 3 (DEFAULT for block size 8192)
    CKPT: Current size = 3072 MB, Target size = 2512 MB
    CKPT: Resize completed for buffer pool DEFAULT for blocksize 8192
    Thu Oct 2 16:33:56 2008
    ALTER SYSTEM SET db_cache_size='2512M' SCOPE=BOTH SID='icai11';
    Thu Oct 2 16:39:30 2008
    ALTER SYSTEM SET pga_aggregate_target='750M' SCOPE=BOTH SID='icai11';Just to make certain that I am not missing anything, if the above you set (all scaled to GB just for the sake of comparison):
    sga_max_size=4885GB
    db_cache_size=3GB
    shared_pool_size=0.625GB
    pga_aggregate_target=0.733GB
    The SQL statement is forcing the use of a specific index, is this the best index?:
    SELECT /*+ INDEX (OM_COURSE_FEE OCF_CFC_CODE) */DISTINCT CF_COURSE_CODE FROM OM_COURSE_FEE,OT_STUDENT_FEE_COL_HEAD,OT_STUDENT_FEE_COL_DETL WHERE SFCH_SYS_ID = SFCD_SFCH_SYS_ID AND
    SFCD_FEE_TYPE_CODE = CF_TYPE_CODE AND CF_COURSE_CODE IN ( 'PE1','PE2','CCT','CPT' ) AND SFCH_TXN_CODE = :b1 AND SFCD_SUBSCRBE_JOURNAL_YN IN ( 'T','R','1','C' ) AND SFCH_APPR_UID IS NOT NULL
    AND SFCH_APPR_DT IS NOT NULL AND SFCH_NO = :b2 AND NOT EXISTS (SELECT 'X' FROM OM_STUDENT_HEAD WHERE STUD_SRN = SFCH_STUD_SRN_TEMP_NO AND NVL(STUD_CLO_STATUS,0) != 1 AND
    NVL(STUD_REG_STATUS,0) != 23 AND STUD_COURSE_CODE != 'CCT' AND CF_COURSE_CODE= STUD_COURSE_CODE ) ORDER BY 1 DESC
    Unfortunately, explain plans, even with dbms_xplan.display, may not show the actual execution plan - this is more of a problem when the SQL statement includes bind variables (capturing a 10046 trace at level 8 or 12 will help). With the information provided, it looks like the problem is with the number of logical reads performed: 17,503,305 in 84 executions = 208,373 logical reads per execution. Something is causing the SQL statement to execute inefficiently, possibly a join problem between tables, possibly the forced use of an index.
    From one of my previous posts related to this same SQL statement:
    SELECT /*+ INDEX (OM_COURSE_FEE OCF_CFC_CODE)  */ DISTINCT
      CF_COURSE_CODE
    FROM
      OM_COURSE_FEE,
      OT_STUDENT_FEE_COL_HEAD,
      OT_STUDENT_FEE_COL_DETL
    WHERE
      SFCH_SYS_ID = SFCD_SFCH_SYS_ID
      AND SFCD_FEE_TYPE_CODE = CF_TYPE_CODE
      AND CF_COURSE_CODE IN ( 'PE1','PE2','CCT','CPT'  )
      AND SFCH_TXN_CODE = :b1
      AND SFCD_SUBSCRBE_JOURNAL_YN IN ( 'T','R','1','C'  )
      AND SFCH_APPR_UID IS NOT NULL
      AND SFCH_APPR_DT IS NOT NULL
      AND SFCH_NO = :b2
      AND NOT EXISTS (
        SELECT
          'X'
        FROM
          OM_STUDENT_HEAD
        WHERE
          STUD_SRN = SFCH_STUD_SRN_TEMP_NO
          AND NVL(STUD_CLO_STATUS,0) != 1
          AND NVL(STUD_REG_STATUS,0) != 23
          AND STUD_COURSE_CODE != 'CCT'
          AND CF_COURSE_CODE = STUD_COURSE_CODE)
    ORDER BY
      1 DESC
    | Id  | Operation                                  |  Name                     | Rows  | Bytes | Cost  | Pstart| Pstop |
    |   0 | SELECT STATEMENT                                                             1      69      34
    |   1 |  SORT UNIQUE                                                                 1      69      22
    |   2 |   TABLE ACCESS BY GLOBAL INDEX ROWID       | OT_STUDENT_FEE_COL_DETL   |     1 |    12 |     2 | ROWID | ROW L |
    |   3 |    NESTED LOOPS                                                              1      69       9
    |   4 |     NESTED LOOPS                                                             1      57       7
    |   5 |      TABLE ACCESS BY GLOBAL INDEX ROWID    | OT_STUDENT_FEE_COL_HEAD   |     1 |    48 |     5 | ROWID | ROW L |
    |   6 |       INDEX SKIP SCAN                       OT_STUDENT_FEE_COL_HEAD_UK0|     1 |     1 |     4 |
    |   7 |      INLIST ITERATOR                       |
    |   8 |       TABLE ACCESS BY INDEX ROWID          | OM_COURSE_FEE             |     1 |     9 |     2 |       |       |
    |   9 |        INDEX RANGE SCAN                    | OCF_CFC_CODE              |     1 |       |     1 |       |       |
    |  10 |         FILTER                            
    |  11 |          TABLE ACCESS BY GLOBAL INDEX ROWID| OM_STUDENT_HEAD           |     1 |    21 |     4 | ROWID | ROW L |
    |  12 |           INDEX RANGE SCAN                 | IDM_STUD_SRN_COURSE       |     1 |       |     3 |       |       |
    |  13 |     INDEX RANGE SCAN                       | IDM_SFCD_FEE_TYPE_CODE    | 34600 |       |     1 |       |       |It appears, based just on the SQL statement, that there is no direct relationship between OM_COURSE_FEE and OT_STUDENT_FEE_COL_HEAD, yet the plan above indicates that the two tables are being joined together, likely as a result of the index hint. There is the possibility of additional predicates being generated by Oracle which will make this possible without introducing a Cartesian join, but those predicates are not displayed with an explain plan (they will appear with a DBMS_XPLAN). I may not be remembering correctly, but if the optimizer goal is set to first rows, a Cartesian join might appear in a plan as a nested loops join - Jonathan will know for certain if that is the case.
    Have you investigated the above as a possible cause? If you know that there is a problem with this one SQL statement, a 10046 trace at level 8 or 12 is much more helpful than a Statspack report.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Queries taking high execution time for zero count

    Hi,
    i have procedures executing as jobs.
    the procedures take a lot of time to execute when the cursor count is zero.
    what might be the reason for this?

    GreenHorn wrote:
    cursor 1 - select a.col1, b.col1,decode(c.col1,1,c.col1,2,c.col2,null) col3 from a,b,c
    where joing conditions
    and nvl(c.col3,c.col4) = b.col3
    and c.col5 is null
    cursor 2 - cursor 1 - select a.col1, b.col1,decode(c.col1,1,c.col1,2,c.col2,null) col3 from a,b,c
    where joing conditions
    and a.timestamp > sysdate-1
    and nvl(c.col3,c.col4) = b.col3
    and c.col5 is not nulll
    cursor 2 first updates the values of col5 to null
    cursor 1 recalculates the value of col5 and updates it.
    c is a partitioned table and partition code is also present in the where condition.One question: Since you say that the cursor is "updating", but the cursor is a query, does this mean that you're performing row-by-row processing in a loop?
    If yes, you might be better off with doing this in one or two plain SQL statements, which is probably much faster.
    Another question: You say that after taking the described measures the performance was significantly better but became again worse after a couple of days again, is this right?
    Can you provide more details, what "good" and "bad" performance means, e.g. in terms of execution time?
    You might want to check if the execution plans change between the "good" performance and the "bad" performance.
    If your table continuously gets data deleted and for some reason the deleted rows are not re-used, e.g. by using direct-path inserts to add new data, then your segment might become larger and larger and you would need to re-organize the table if you use regularly full table scans against it.
    The execution plan posted is not really helpful. Try to use DBMS_XPLAN.DISPLAY to get a proper output including the "Predicate Information" section below the plan and specify to which of the two statements the plan corresponds.
    Use the {noformat}{noformat} tags to format the plan output properly here in mono-space fonts.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/
    Edited by: Randolf Geist on Dec 12, 2008 9:57 AM
    Note regarding execution plan added                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • High CPU usage for SERVER0 process in XI

    Hi,
    SERVER0 process is taking high CPU usage, previously it happen once its due to communication channel error, So we deativated some unwanted communication channels in Alert config and the CPU usage is reduced.
    After some weeks its again CPU usage is increasing for SERVER0 process in some time.
    Can anyone help in this case.
    Thank you,
    gopi.

    Hi Gopi,
    Check out Tim's reply and check for ur Java stack settings,
    Extended Memory parameters
    <i>The bottom line for J stacks is to keep everything in memory and out of swap. </i>
    Other tips:
    - u may try clearing folder usr\sap\<SID>\DVEBMGS00\j2ee\cluster\server0\apps
    - try increasing virtual memory
    - increase heap size
    <i>[Reward if helpful]</i>
    Regards,
    Prateek

  • Regarding high CPU usage

    Hello All,
    There was CPU spike on one of my databases between 4-5 on a particular day. I have taken the AWR for that time.
    Could someone please tell me what is it that i should look for, to see the cause ?
    TIA,
    JJ

    There was CPU spike on one of my databases between 4-5 on a particular day. I have taken the AWR for that time.
    Could someone please tell me what is it that i should look for, to see the cause ?Queries with high CPU times?

  • High CPU Utilization by J2EE engine

    Dear team,
    I want to find the tread causing high CPU utilization within the "jlaunch" process. As stated in SAP note: 743204. I ran the command "tps -a <pid> -a" in the development box and it it running fine. But the same command in the production portal is giving us the following error:
    jueppci:/#/usr/sap/tps -a                                                                               
    Initialize measurement (10 sec) ...Memory fault(coredump)    
    I did a strings command om the core and  I got
    jueppci:/#strings core                                       
    libdl.so                                                    
    Why is tps not running properly ?

    Hello,
    Thanks Russell. It is HP-UX 11.31 (11i v3). We have opened a Very High Message with SAP. SAP AG and HP are working with us to solve this issue. We will be applying some patches and doing a lot of Java parameter changes !
    I'll update the solution once the system is stable and the case with SAP is closed.

  • BEQ connections utilizing high CPU.

    Hi,
    Oracle version :11.2.02
    At a higher load ,i found the following process consuming high CPU.Oracle Server and client are in same unix box
    During this time other processes were in waiting state.
    oracleTESTDB (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))).
    Kindly suggest me why is it consuming high CPU.
    Thanks.

    user10698496 wrote:
    Hi,
    Oracle version :11.2.02
    At a higher load ,i found the following process consuming high CPU.Oracle Server and client are in same unix box
    During this time other processes were in waiting state.
    oracleTESTDB (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))).
    Kindly suggest me why is it consuming high CPU.
    Thanks.you need to know which OS process ID is consuming most CPU(might you have already identified), now you want want to tune the SQL which is excuting in this session:
    select s.sid,s.sql_id from v$session s,v$process p,v$sql sl where s.sql_id=sl.sql_id and s.PADDR=p.ADDR and p.SPID=(os process);
    Once the SQL is identified, check its explain plan and if possible trace it down to know where cpu is consumed.. Also ensure that statistics on table(which are reffered in sql) are upto date.

  • How to find which query taking more cpu

    Hi,
    How to find which query taking more CPU
    at a particular point of time .
    Chhers,

    Take a look at Server Standard Reports. It has a few CPU usage oriented reports.
    You can also track CPU usage by server-side tracing:
    http://www.sqlusa.com/bestpractices/createtrace/
    Glenn Berry's CPU usage query:
    SELECT TOP(25) p.name AS [SP Name], qs.total_worker_time AS [TotalWorkerTime],
    qs.total_worker_time/qs.execution_count AS [AvgWorkerTime], qs.execution_count,
    ISNULL(qs.execution_count/DATEDIFF(Second, qs.cached_time, GETDATE()), 0) AS [Calls/Second],
    qs.total_elapsed_time, qs.total_elapsed_time/qs.execution_count
    AS [avg_elapsed_time], qs.cached_time
    FROM sys.procedures AS p WITH (NOLOCK)
    INNER JOIN sys.dm_exec_procedure_stats AS qs WITH (NOLOCK)
    ON p.[object_id] = qs.[object_id]
    WHERE qs.database_id = DB_ID()
    ORDER BY qs.total_worker_time DESC OPTION (RECOMPILE);
    LINK:
    http://dba.stackexchange.com/questions/52216/sql-server-2008-high-cpu-historical-queries
    Query optimization:
    http://www.sqlusa.com/articles/query-optimization/
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • XML select query causing very high CPU usage.

    Hi All,
    In our Oracle 10.2.0.4 Two node RAC we are facing very high CPU usage....and all of the top CPU consuming processes are executing this below sql...also these statements are waiting for some gc wiat events as shown below.
    SELECT B.PACKET_ID FROM CM_PACKET_ALT_KEY B, CM_ALT_KEY_TYPE C, TABLE(XMLSEQUENCE ( EXTRACT (:B1 , '/AlternateKeys/AlternateKey') )) T
    WHERE B.ALT_KEY_TYPE_ID = C.ALT_KEY_TYPE_ID AND C.ALT_KEY_TYPE_NAME = EXTRACTVALUE (VALUE (T), '/AlternateKey/@keyType')
    AND B.ALT_KEY_VALUE = EXTRACTVALUE (VALUE (T), '/AlternateKey')
    AND NVL (B.CHILD_BROKER_CODE, '6209870F57C254D6E04400306E4A78B0') =
    NVL (EXTRACTVALUE (VALUE (T), '/AlternateKey/@broker'), '6209870F57C254D6E04400306E4A78B0')
    SQL> select sid,event,state from gv$session where state='WAITING' and event not like '%SQL*Net%';
           SID EVENT                                                            STATE
            66 jobq slave wait                                                  WAITING
           124 gc buffer busy                                                   WAITING
           143 gc buffer busy                                                   WAITING
           147 db file sequential read                                          WAITING
           222 Streams AQ: qmn slave idle wait                                  WAITING
           266 gc buffer busy                                                   WAITING
           280 gc buffer busy                                                   WAITING
           314 gc cr request                                                    WAITING
           317 gc buffer busy                                                   WAITING
           392 gc buffer busy                                                   WAITING
           428 gc buffer busy                                                   WAITING
           471 gc buffer busy                                                   WAITING
           518 Streams AQ: waiting for time management or cleanup tasks         WAITING
           524 Streams AQ: qmn coordinator idle wait                            WAITING
           527 rdbms ipc message                                                WAITING
           528 rdbms ipc message                                                WAITING
           532 rdbms ipc message                                                WAITING
           537 rdbms ipc message                                                WAITING
           538 rdbms ipc message                                                WAITING
           539 rdbms ipc message                                                WAITING
           540 rdbms ipc message                                                WAITING
           541 smon timer                                                       WAITING
           542 rdbms ipc message                                                WAITING
           543 rdbms ipc message                                                WAITING
           544 rdbms ipc message                                                WAITING
           545 rdbms ipc message                                                WAITING
           546 rdbms ipc message                                                WAITING
           547 gcs remote message                                               WAITING
           548 gcs remote message                                               WAITING
           549 gcs remote message                                               WAITING
           550 gcs remote message                                               WAITING
           551 ges remote message                                               WAITING
           552 rdbms ipc message                                                WAITING
           553 rdbms ipc message                                                WAITING
           554 DIAG idle wait                                                   WAITING
           555 pmon timer                                                       WAITING
            79 jobq slave wait                                                  WAITING
           117 gc buffer busy                                                   WAITING
           163 PX Deq: Execute Reply                                            WAITING
           205 db file parallel read                                            WAITING
           247 gc current request                                               WAITING
           279 jobq slave wait                                                  WAITING
           319 LNS ASYNC end of log                                             WAITING
           343 jobq slave wait                                                  WAITING
           348 direct path read                                                 WAITING
           372 db file scattered read                                           WAITING
           475 jobq slave wait                                                  WAITING
           494 gc cr request                                                    WAITING
           516 Streams AQ: qmn slave idle wait                                  WAITING
           518 Streams AQ: waiting for time management or cleanup tasks         WAITING
           523 Streams AQ: qmn coordinator idle wait                            WAITING
           528 rdbms ipc message                                                WAITING
           529 rdbms ipc message                                                WAITING
           530 Streams AQ: waiting for messages in the queue                    WAITING
           532 rdbms ipc message                                                WAITING
           537 rdbms ipc message                                                WAITING
           538 rdbms ipc message                                                WAITING
           539 rdbms ipc message                                                WAITING
           540 rdbms ipc message                                                WAITING
           541 smon timer                                                       WAITING
           542 rdbms ipc message                                                WAITING
           543 rdbms ipc message                                                WAITING
           544 rdbms ipc message                                                WAITING
           545 rdbms ipc message                                                WAITING
           546 rdbms ipc message                                                WAITING
           547 gcs remote message                                               WAITING
           548 gcs remote message                                               WAITING
           549 gcs remote message                                               WAITING
           550 gcs remote message                                               WAITING
           551 ges remote message                                               WAITING
           552 rdbms ipc message                                                WAITING
           553 rdbms ipc message                                                WAITING
           554 DIAG idle wait                                                   WAITING
           555 pmon timer                                                       WAITINGI am not at all able to understand what this SQL is...i think its related to some XML datatype.
    Also not able to generate execution plan for this sql using explain plan- getting error(ORA-00932: inconsistent datatypes: expected - got -)
    Please help me in this issue...
    How can i generate execution plan?
    Does this type of XML based query will cause high GC wiat events and buffer busy wait events?
    How can i tune this query?
    How can i find that this is the only query causing High CPU usage?
    Our servers are having 64 GB RAM and 16 CPU's..
    OS is Solaris 5.10 with UDP as protocol for interconnect..
    -Yasser

    I found some more xml queries as shown below.
    SELECT XMLELEMENT("Resource", XMLATTRIBUTES(RAWTOHEX(RMR.RESOURCE_ID) AS "resourceID", RMO.OWNER_CODE AS "ownerCode", RMR.MIME_TYPE AS "mimeType",RMR.FILE_SIZE AS "fileSize", RMR.RESOURCE_STATUS AS "status"), (SELECT XMLAGG(XMLELEMENT("ResourceLocation", XMLATTRIBUTES(RAWTOHEX(RMRP.REPOSITORY_ID) AS "repositoryID", RAWTOHEX(DIRECTORY_ID) AS "directoryID", RESOURCE_STATE AS "state", RMRO.RETRIEVAL_SEQ AS "sequence"), XMLFOREST(FULL_PATH AS "RemotePath"))ORDER BY RMRO.RETRIEVAL_SEQ) FROM RM_RESOURCE_PATH RMRP, RM_RETRIEVAL_ORDER RMRO, RM_LOCATION RML WHERE RMRP.RESOURCE_ID = RMR.RESOURCE_ID AND RMRP.REPOSITORY_ID = RMRO.REPOSITORY_ID AND RMRO.LOCATION_ID = RML.LOCATION_ID AND RML.LOCATION_CODE = :B2 ) AS "Locations") FROM RM_RESOURCE RMR, RM_OWNER RMO WHERE RMR.OWNER_ID = RMO.OWNER_ID AND RMR.RESOURCE_ID = HEXTORAW(:B1 )
    SELECT XMLELEMENT ( "Resources", XMLAGG(XMLELEMENT ( "Resource", XMLATTRIBUTES (B.RESOURCE_ID AS "id"), XMLELEMENT ("ContentType", C.CONTENT_TYPE_CODE), XMLELEMENT ("TextExtractStatus", B.TEXT_EXTRACTED_STATUS), XMLELEMENT ("MimeType", B.MIME_TYPE), XMLELEMENT ("NumberPages", TO_CHAR (B.NUM_PAGES)), XMLELEMENT ("FileSize", TO_CHAR (B.FILE_SIZE)), XMLELEMENT ("Status", B.STATUS), XMLELEMENT ("ContentFormat", D.CONTENT_FORMAT_CODE), G.ALTKEY )) ) FROM CM_PACKET A, CM_RESOURCE B, CM_REF_CONTENT_TYPE C, CM_REF_CONTENT_FORMAT D, ( SELECT XMLELEMENT ( "AlternateKeys", XMLAGG(XMLELEMENT ( "AlternateKey", XMLATTRIBUTES ( H.ALT_KEY_TYPE_NAME AS "keyType", E.CHILD_BROKER_CODE AS "broker", E.VERSION AS "version" ), E.ALT_KEY_VALUE )) ) ALTKEY, E.RESOURCE_ID RES_ID FROM CM_RESOURCE_ALT_KEY E, CM_RESOURCE F, CM_ALT_KEY_TYPE H WHERE E.RESOURCE_ID = F.RESOURCE_ID(+) AND F.PACKET_ID = HEXTORAW (:B1 ) AN
    D E.ALT_KEY_TYPE_ID = H.ALT_KEY_TYPE_ID GROUP BY E.RESOURCE_ID) G WHERE A.PACKET_ID = HEXTORAW (:B1
    SELECT XMLELEMENT ("Tagging", XMLAGG (GROUPEDCAT)) FROM ( SELECT XMLELEMENT ( "TaggingCategory", XMLATTRIBUTES (CATEGORY1 AS "categoryType"), XMLAGG (LISTVALUES) ) GROUPEDCAT FROM (SELECT EXTRACTVALUE ( VALUE (T), '/TaggingCategory/@categoryType' ) CATEGORY1, XMLCONCAT(EXTRACT ( VALUE (T), '/TaggingCategory/TaggingValue' )) LISTVALUES FROM TABLE(XMLSEQUENCE(EXTRACT ( :B1 , '/Tagging/TaggingCategory' ))) T) GROUP BY CATEGORY1)
    SELECT XMLCONCAT ( :B2 , DI_CONTENT_PKG.GET_ENUM_TAGGING_FN (:B1 ) ) FROM DUAL
    SELECT XMLCONCAT (:B2 , :B1 ) FROM DUAL
    SELECT * FROM EQ_RAW_TAG_ERROR A WHERE TAG_LIST_ID = :B2 AND EXTRACTVALUE (A.RAW_TAG_XML, '/TaggingValues/TaggingValue/Value' ) = :B1 AND A.STATUS = '
    NR'
    SELECT RAWTOHEX (S.PACKET_ID) AS PACKET_ID, PS.PACKET_STATUS_DESC, S.LAST_UPDATE AS LAST_UPDATE, S.USER_ID, S.USER_COMMENT, MAX (T.ALT_KEY_VALUE) AS ALTKEY, 'Y' AS IS_PACKET FROM EQ_PACKET S, CM_PACKET_ALT_KEY T, CM_REF_PACKET_STATUS PS WHERE S.STATUS_ID = PS.PACKET_STATUS_ID AND S.PACKET_ID = T.PACKET_ID AND NOT EXISTS (SELECT 1 FROM CM_RESOURCE RES WHERE RES.PACKET_ID = S.PACKET_ID AND EXISTS (SELECT 1 FROM CM_REF_CONTENT_FORMAT CF WHERE CF.CONTENT_FORMAT_ID = RES.CONTENT_FORMAT AND CF.CONTENT_FORMAT_CODE = 'I_FILE')) GROUP BY RAWTOHEX (S.PACKET_ID), PS.PACKET_STATUS_DESC, S.LAST_UPDATE, S.USER_ID, S.USER_COMMENT UNION SELECT RAWTOHEX (A.FATAL_ERROR_ID) AS PACKET_ID, C.PACKET_STATUS_DESC, A.OCCURRENCE_DATE AS LAST_UPDATE, '' AS USER_ID, '' AS USER_COMMENT, RAWTOHEX (A.FATAL_ERROR_ID) AS ALTKEY, 'N' AS IS_PACKET FROM EQ_FATAL_ERROR A, EQ_ERROR_MSG B, CM_REF_PACKET_STATUS C, EQ_SEVERITYD WHERE A.PACKET_ID IS NULL AND A.STATUS = 'NR' AND A.ERROR_MSG_ID = B.ERROR_MSG_ID AND B.SEVERITY_I
    SELECT /*+ INDEX(e) INDEX(a) INDEX(c)*/ XMLAGG(XMLELEMENT ( "TaggingCategory", XMLATTRIBUTES ( G.TAG_CATEGORY_CODE AS "categoryType" ), XMLELEMENT ("TaggingValue", XMLATTRIBUTES (C.IS_PRIMARY AS "primary", H.ORIGIN_CODE AS "origin"), XMLAGG(XMLELEMENT ( "Value", XMLATTRIBUTES ( F.TAG_LIST_CODE AS "listType" ), E.TAG_VALUE )) ) )) FROM TABLE (CAST (:B1 AS T_TAG_MAP_HIERARCHY_TAB)) A, TABLE (CAST (:B2 AS T_ENUM_TAG_TAB)) C, REM_TAG_VALUE E, REM_TAG_LIST F, REM_TAG_CATEGORY G, CM_ORIGIN H WHERE E.TAG_VALUE_ID = C.TAG_VALUE_ID AND F.TAG_LIST_ID = E.TAG_LIST_ID AND G.TAGGING_CATEGORY_ID = F.TAGGING_CATEGORY_ID AND H.ORIGIN_ID = C.ORIGIN_ID AND C.ENUM_TAG_ID = A.MAPPED_ENUM_TAG_ID GROUP BY C.IS_PRIMARY, H.ORIGIN_CODE, G.TAG_CATEGORY_CODE START WITH A.MAPPED_ENUM_TAG_ID = HEXTORAW (:B3 ) CONNECT BY PRIOR A.MAPPED_ENUM_TAG_ID = A.ENUM_TAG_ID
    SELECT /*+  INDEX(e) */ XMLAGG(XMLELEMENT ( "TaggingCategory", XMLATTRIBUTES ( G.TAG_CATEGORY_CODE AS "categoryType" ), XMLELEMENT ( "TaggingValue", XMLATTRIBUTES (C.IS_PRIMARY AS "primary", H.ORIGIN_CODE AS "origin"), XMLAGG(XMLCONCAT ( XMLELEMENT ( "Value", XMLATTRIBUTES ( F.TAG_LIST_CODE AS "listType" ), E.TAG_VALUE ), CASE WHEN LEVEL = 1 THEN :B4 ELSE NULL END )) ) )) FROM TABLE (CAST (:B1 AS T_TAG_MAP_HIERARCHY_TAB)) A, TABLE (CAST (:B2 AS T_ENUM_TAG_TAB)) C, REM_TAG_VALUE E, REM_TAG_LIST F, REM_TAG_CATEGORY G, CM_ORIGIN H WHERE E.TAG_VALUE_ID = C.TAG_VALUE_ID AND F.TAG_LIST_ID = E.TAG_LIST_ID AND G.TAGGING_CATEGORY_ID = F.TAGGING_CATEGORY_ID AND H.ORIGIN_ID = C.ORIGIN_ID AND C.ENUM_TAG_ID = A.MAPPED_ENUM_TAG_ID GROUP BY G.TAG_CATEGORY_CODE, C.IS_PRIMARY, H.ORIGIN_CODE START WITH A.MAPPED_ENUM_TAG_ID = HEXTORAW (:B3 ) CONNECT BY PRIOR A.MAPPED_ENUM_TAG_ID = A.ENUM_TAG_IDBy observing above sql queries i found some hints forcing for index usage..
    I think xml schema is created already...and its progressing as you stated above. Please correct if i am wrong.
    I found all these sql from AWR report and all of these are very high resource consuming queries.
    And i am really sorry if i am irritating you by asking all stupid questions related to xml.
    -Yasser
    Edited by: YasserRACDBA on Nov 17, 2009 3:39 PM
    Did syntax allignment.

  • Sqlquery to find out high CPU usage

    Hi,
    I want to find out the queries which using high CPU in a RAC database. What is the best way to find it out.
    Regards,
    Koushik

    I have executed the following query block enabling set event level 12.
    begin
    for i_rec in 1..4000
    loop
    TRD_TABLE_POPULATION;
    end loop;
    end;
    The procedure contains deque and merge statement. Please find the output below of the trace output.
    TKPROF: Release 10.1.0.2.0 - Production on Thu Oct 11 18:09:02 2007
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Trace file: orbit02_ora_5933.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
    The following statement encountered a error during parse:
    SELECT 1 FROM DUAL WHERE ORD.ORDL = TRD.ORDER_LINE_I
    Error encountered: ORA-00904
    ALTER SESSION SET EVENTS '10046 trace name context forever, level 12'
    call count cpu elapsed disk query current rows
    Parse 0 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 1 0.00 0.00 0 0 0 0
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: 280
    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 74.65 74.65
    begin
    for i_rec in 1..4000
    loop
    TRD_TABLE_POPULATION;
    end loop;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 1.13 1.22 11 2257403 970 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 1.13 1.23 11 2257403 970 0
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 280
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#,
    sample_size, minimum, maximum, distcnt, lowval, hival, density, col#,
    spare1, spare2, avgcln
    from
    hist_head$ where obj#=:1 and intcol#=:2
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 26 0.00 0.00 0 0 0 0
    Fetch 26 0.00 0.00 0 103 0 25
    total 53 0.00 0.00 0 103 0 25
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: RULE
    Parsing user id: SYS (recursive depth: 3)
    select metadata
    from
    kopm$ where name='DB_FDO'
    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 2 0 1
    total 3 0.00 0.00 0 2 0 1
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID KOPM$ (cr=2 pr=0 pw=0 time=19 us)
    1 INDEX UNIQUE SCAN I_KOPM1 (cr=1 pr=0 pw=0 time=11 us)(object id 350)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    row cache lock 3 0.00 0.00
    select o.owner#,o.name,o.namespace,o.remoteowner,o.linkname,o.subname,
    o.dataobj#,o.flags
    from
    obj$ o where o.obj#=:1
    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 0.00 0.00 0 8 0 2
    total 6 0.00 0.00 0 8 0 2
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OBJ#(18) (cr=4 pr=0 pw=0 time=34 us)
    1 INDEX UNIQUE SCAN OBJ#(36) (cr=3 pr=0 pw=0 time=21 us)(object id 36)
    select /*+ INDEX(TAB) */ tab.rowid, tab.msgid, tab.corrid, tab.priority,
    tab.delay, tab.expiration, tab.retry_count, tab.exception_qschema,
    tab.exception_queue, tab.chain_no, tab.local_order_no, tab.enq_time,
    tab.time_manager_info, tab.state, tab.enq_tid, tab.step_no,
    tab.sender_name, tab.sender_address, tab.sender_protocol,
    tab.dequeue_msgid, tab.user_prop, tab.cscn, tab.dscn, tab.user_data
    from
    "GENESYS_POC_AQ"."FM_ORDERLINE_QUEUE_TBL" tab where q_name = :1 and state =
    :2 order by q_name, state, enq_time, step_no, chain_no, local_order_no
    for update skip locked
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 968 0.36 0.34 0 165 0 0
    Fetch 968 0.10 0.05 0 4840 0 0
    total 1937 0.46 0.39 0 5005 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    MERGE INTO FM_ORDERLINES_TRD TRD USING (SELECT :B41 ORDL, :B40 SYSINS, :B39
    CUST_ORD_ID, :B38 SERV_ID, :B37 INS_TEL, :B36 CUST_REQ_DATE, :B35
    CUST_AGG_DATE, :B34 RCV_DATE, :B33 APP_DATE, :B32 APP_TIME, :B31 COMM_DATE,
    :B30 EU_POST_CODE, :B29 PROD, :B28 SER_PRV, :B27 EXCH_ID, :B26 SRV_CARE_LVL,
    :B25 ORD_TYPE, :B24 CAN_RES, :B23 AU_DELAY_RES, :B22 BILL_ACC_NO, :B21
    CUST_ID, :B20 ACC_LINE_ID, :B19 COMP_DATE, :B18 COOR_ID, :B17 LOP_ID, :B16
    EXCH_NAME, :B15 MDF_SITE, :B14 DES_DP, :B13 MPF_TIE_CABLE, :B12
    MPF_TIE_PAIR, :B11 MPF_TIE_PAIR_ST, :B10 PSTN_ORD_NUM, :B9
    PSTN_TIE_CABLE_ID, :B8 PSTN_TIE_PAIR_ST, :B7 CP_CONTACT_NUM, :B6
    LINK_ORD_REF, :B5 BT_POST, :B4 CSS_SMPF_ORD, :B3 MNG_BES_ID, :B2 CSS_PROD,
    :B1 CSS_DRV FROM DUAL) ORD ON(ORD.ORDL = TRD.ORDER_LINE_ID) WHEN MATCHED
    THEN UPDATE SET TRD.SYSTEM_INSTANCE = ORD.SYSINS , TRD.CUST_ORDER_ID =
    ORD.CUST_ORD_ID, TRD.SERVICE_ID =ORD.SERV_ID, TRD.INSTALLATION_TELEPHONE =
    ORD.INS_TEL, TRD.CUSTOMER_REQ_DATE =ORD.CUST_REQ_DATE,
    TRD.CUSTOMER_AGREED_DATE =ORD.CUST_AGG_DATE, TRD.RECEIVED_DATE =
    ORD.RCV_DATE, TRD.APPOINTMENT_DATE =ORD.APP_DATE, TRD.APPOINTMENT_TIME =
    ORD.APP_TIME, TRD.COMMIT_DATE =ORD.COMM_DATE, TRD.EU_POSTCODE =
    ORD.EU_POST_CODE, TRD.PRODUCT =ORD.PROD, TRD.SERVICE_PROVIDER =ORD.SER_PRV,
    TRD.EXCHANGE_ID =ORD.EXCH_ID, TRD.SERVICE_CARE_LEVEL =ORD.SRV_CARE_LVL,
    TRD.ORDER_TYPE =ORD.ORD_TYPE, TRD.CANCELLED_REASON =ORD.CAN_RES,
    TRD.AUTO_DELAY_REASON =ORD.AU_DELAY_RES, TRD.BILLING_ACCOUNT_NO =
    ORD.BILL_ACC_NO, TRD.CUSTOMER_ID =ORD.CUST_ID, TRD.ACCESS_LINE_ID =
    ORD.ACC_LINE_ID, TRD.COMPLETION_DATE =ORD.COMP_DATE, TRD.COORDINATOR_ID =
    ORD.COOR_ID, TRD.LOP_ID =ORD.LOP_ID, TRD.EXCHANGE_NAME =ORD.EXCH_NAME,
    TRD.MDF_SITE_ID =ORD.MDF_SITE, TRD.DESIGN_DP =ORD.DES_DP,
    TRD.MPF_TIE_CABLE_ID =ORD.MPF_TIE_CABLE, TRD.MPF_TIE_PAIR_ID =
    ORD.MPF_TIE_PAIR, TRD.MPF_TIE_PAIR_STATUS =ORD.MPF_TIE_PAIR_ST,
    TRD.PSTN_ORDER_NO =ORD.PSTN_ORD_NUM, TRD.PSTN_TIE_CABLE_ID =
    ORD.PSTN_TIE_CABLE_ID, TRD.PSTN_TIE_PAIR_STATUS =ORD.PSTN_TIE_PAIR_ST,
    TRD.CP_CONTACT_NUMBER =ORD.CP_CONTACT_NUM, TRD.LINKED_ORDER_REF =
    ORD.LINK_ORD_REF, TRD.BT_POSTCODE =ORD.BT_POST, TRD.CSS_SMPF_ORDER =
    ORD.CSS_SMPF_ORD, TRD.MANAGE_BES_ID =ORD.MNG_BES_ID, TRD.CSS_PRODUCT_CODE =
    ORD.CSS_PROD, TRD.CSS_DRIVER_CODE =ORD.CSS_DRV WHEN NOT MATCHED THEN
    INSERT(TRD.ORDER_LINE_ID, TRD.SYSTEM_INSTANCE, TRD.CUST_ORDER_ID,
    TRD.SERVICE_ID, TRD.INSTALLATION_TELEPHONE, TRD.CUSTOMER_REQ_DATE,
    TRD.CUSTOMER_AGREED_DATE, TRD.RECEIVED_DATE, TRD.APPOINTMENT_DATE,
    TRD.APPOINTMENT_TIME, TRD.COMMIT_DATE, TRD.EU_POSTCODE, TRD.PRODUCT,
    TRD.SERVICE_PROVIDER, TRD.EXCHANGE_ID, TRD.SERVICE_CARE_LEVEL,
    TRD.ORDER_TYPE, TRD.CANCELLED_REASON, TRD.AUTO_DELAY_REASON,
    TRD.BILLING_ACCOUNT_NO, TRD.CUSTOMER_ID, TRD.ACCESS_LINE_ID,
    TRD.COMPLETION_DATE, TRD.COORDINATOR_ID, TRD.LOP_ID, TRD.EXCHANGE_NAME,
    TRD.MDF_SITE_ID, TRD.DESIGN_DP, TRD.MPF_TIE_CABLE_ID, TRD.MPF_TIE_PAIR_ID,
    TRD.MPF_TIE_PAIR_STATUS, TRD.CP_CONTACT_NUMBER, TRD.LINKED_ORDER_REF,
    TRD.BT_POSTCODE, TRD.CSS_SMPF_ORDER, TRD.MANAGE_BES_ID,
    TRD.CSS_PRODUCT_CODE, TRD.CSS_DRIVER_CODE ) VALUES(ORD.ORDL, ORD.SYSINS,
    ORD.CUST_ORD_ID, ORD.SERV_ID, ORD.INS_TEL, ORD.CUST_REQ_DATE,
    ORD.CUST_AGG_DATE, ORD.RCV_DATE, ORD.APP_DATE, ORD.APP_TIME, ORD.COMM_DATE,
    ORD.EU_POST_CODE, ORD.PROD, ORD.SER_PRV, ORD.EXCH_ID, ORD.SRV_CARE_LVL,
    ORD.ORD_TYPE, ORD.CAN_RES, ORD.AU_DELAY_RES, ORD.BILL_ACC_NO, ORD.CUST_ID,
    ORD.ACC_LINE_ID, ORD.COMP_DATE, ORD.COOR_ID, ORD.LOP_ID, ORD.EXCH_NAME,
    ORD.MDF_SITE, ORD.DES_DP, ORD.MPF_TIE_CABLE, ORD.MPF_TIE_PAIR,
    ORD.MPF_TIE_PAIR_ST, ORD.CP_CONTACT_NUM, ORD.LINK_ORD_REF, ORD.BT_POST,
    ORD.CSS_SMPF_ORD, ORD.MNG_BES_ID, ORD.CSS_PROD, ORD.CSS_DRV )
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 968 1743.31 1791.19 0 2252195 1970 966
    Fetch 0 0.00 0.00 0 0 0 0
    total 969 1743.31 1791.19 0 2252195 1970 966
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: 280 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    gc current grant 2-way 2 0.00 0.00
    latch: cache buffers chains 10 0.02 0.16
    INSERT INTO FM_ORDERLINES_EXP (ORDER_LINE_ID , SYSTEM_INSTANCE ,
    CUST_ORDER_ID, SERVICE_ID , INSTALLATION_TELEPHONE , CUSTOMER_REQ_DATE ,
    CUSTOMER_AGREED_DATE , RECEIVED_DATE , APPOINTMENT_DATE , APPOINTMENT_TIME ,
    COMMIT_DATE , EU_POSTCODE , PRODUCT , SERVICE_PROVIDER , EXCHANGE_ID ,
    SERVICE_CARE_LEVEL , ORDER_TYPE , CANCELLED_REASON , AUTO_DELAY_REASON ,
    BILLING_ACCOUNT_NO, CUSTOMER_ID , ACCESS_LINE_ID , COMPLETION_DATE ,
    COORDINATOR_ID , LOP_ID , EXCHANGE_NAME , MDF_SITE_ID , DESIGN_DP ,
    MPF_TIE_CABLE_ID, MPF_TIE_PAIR_ID , MPF_TIE_PAIR_STATUS , PSTN_ORDER_NO ,
    PSTN_TIE_CABLE_ID , PSTN_TIE_PAIR_STATUS , CP_CONTACT_NUMBER,
    LINKED_ORDER_REF, BT_POSTCODE , CSS_SMPF_ORDER , MANAGE_BES_ID ,
    CSS_PRODUCT_CODE , CSS_DRIVER_CODE)
    VALUES
    (:B41 , :B40 , :B39 , :B38 , :B37 , :B36 , :B35 , :B34 , :B33 , :B32 , :B31 ,
    :B30 , :B29 , :B28 , :B27 , :B26 , :B25 , :B24 , :B23 , :B22 , :B21 , :B20
    , :B19 , :B18 , :B17 , :B16 , :B15 , :B14 , :B13 , :B12 , :B11 , :B10 , :B9
    , :B8 , :B7 , :B6 , :B5 , :B4 , :B3 , :B2 , :B1 )
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.05 0.17 11 177 6 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.05 0.17 11 177 6 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: 280 (recursive depth: 1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    library cache lock 2 0.00 0.00
    library cache pin 1 0.00 0.00
    row cache lock 3 0.00 0.00
    rdbms ipc reply 1 0.00 0.00
    enq: TM - contention 2 0.00 0.00
    db file sequential read 4 0.01 0.03
    gc cr grant 2-way 1 0.00 0.00
    gc current grant 2-way 2 0.00 0.00
    select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$, spare1,
    spare2
    from
    obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null
    and linkname is null and subname is null
    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 5 0 1
    total 3 0.00 0.00 0 5 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OBJ#(18) (cr=5 pr=0 pw=0 time=149 us)
    1 INDEX RANGE SCAN OBJ#(37) (cr=4 pr=0 pw=0 time=135 us)(object id 37)
    select t.ts#,t.file#,t.block#,nvl(t.bobj#,0),nvl(t.tab#,0),t.intcols,
    nvl(t.clucols,0),t.audit$,t.flags,t.pctfree$,t.pctused$,t.initrans,
    t.maxtrans,t.rowcnt,t.blkcnt,t.empcnt,t.avgspc,t.chncnt,t.avgrln,
    t.analyzetime,t.samplesize,t.cols,t.property,nvl(t.degree,1),
    nvl(t.instances,1),t.avgspc_flb,t.flbcnt,t.kernelcols,nvl(t.trigflag, 0),
    nvl(t.spare1,0),nvl(t.spare2,0),t.spare4,t.spare6,ts.cachedblk,ts.cachehit,
    ts.logicalread
    from
    tab$ t, tab_stats$ ts where t.obj#= :1 and t.obj# = ts.obj# (+)
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 5 0 1
    total 3 0.01 0.00 0 5 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    row cache lock 9 0.00 0.00
    select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,i.property,
    i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.leafcnt,i.distkey,i.lblkkey,
    i.dblkkey,i.clufac,i.cols,i.analyzetime,i.samplesize,i.dataobj#,
    nvl(i.degree,1),nvl(i.instances,1),i.rowcnt,mod(i.pctthres$,256),
    i.indmethod#,i.trunccnt,nvl(c.unicols,0),nvl(c.deferrable#+c.valid#,0),
    nvl(i.spare1,i.intcols),i.spare4,i.spare2,i.spare6,decode(i.pctthres$,null,
    null,mod(trunc(i.pctthres$/256),256)),ist.cachedblk,ist.cachehit,
    ist.logicalread
    from
    ind$ i, ind_stats$ ist, (select enabled, min(cols) unicols,
    min(to_number(bitand(defer,1))) deferrable#,min(to_number(bitand(defer,4)))
    valid# from cdef$ where obj#=:1 and enabled > 1 group by enabled) c where
    i.obj#=c.enabled(+) and i.obj# = ist.obj#(+) and i.bo#=:1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 4 0 0
    total 3 0.01 0.00 0 4 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    row cache lock 6 0.00 0.00
    select /*+ rule */ bucket, endpoint, col#, epvalue
    from
    histgrm$ where obj#=:1 and intcol#=:2 and row#=:3 order by bucket
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 14 0.00 0.00 0 0 0 0
    Fetch 14 0.01 0.04 5 42 0 245
    total 29 0.01 0.04 5 42 0 245
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: RULE
    Parsing user id: SYS (recursive depth: 3)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    gc cr grant 2-way 3 0.00 0.00
    db file sequential read 5 0.01 0.03
    select name,intcol#,segcol#,type#,length,nvl(precision#,0),decode(type#,2,
    nvl(scale,-127/*MAXSB1MINAL*/),178,scale,179,scale,180,scale,181,scale,182,
    scale,183,scale,231,scale,0),null$,fixedstorage,nvl(deflength,0),default$,
    rowid,col#,property, nvl(charsetid,0),nvl(charsetform,0),spare1,spare2,
    nvl(spare3,0)
    from
    col$ where obj#=:1 order by intcol#
    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 42 0.00 0.00 0 4 0 41
    total 44 0.00 0.00 0 4 0 41
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    row cache lock 3 0.00 0.00
    select con#,obj#,rcon#,enabled,nvl(defer,0)
    from
    cdef$ where robj#=:1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 2 0 0
    total 3 0.01 0.00 0 2 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    select con#,type#,condlength,intcols,robj#,rcon#,match#,refact,nvl(enabled,0),
    rowid,cols,nvl(defer,0),mtime,nvl(spare1,0)
    from
    cdef$ where obj#=: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.03 2 2 0 0
    total 3 0.00 0.03 2 2 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    row cache lock 6 0.00 0.00
    db file sequential read 2 0.01 0.03
    gc cr grant 2-way 1 0.00 0.00
    select type#,blocks,extents,minexts,maxexts,extsize,extpct,user#,iniexts,
    NVL(lists,65535),NVL(groups,65535),cachehint,hwmincr, NVL(spare1,0),
    NVL(scanhint,0)
    from
    seg$ where ts#=:1 and file#=:2 and block#=:3
    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 4 0 1
    total 3 0.00 0.00 0 4 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    0 TABLE ACCESS CLUSTER SEG$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=0 pr=0 pw=0 time=0 us)(object id 9)
    select col#, grantee#, privilege#,max(mod(nvl(option$,0),2))
    from
    objauth$ where obj#=:1 and col# is not null group by privilege#, col#,
    grantee# order by col#, grantee#
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 2 0 0
    total 3 0.01 0.00 0 2 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    select grantee#,privilege#,nvl(col#,0),max(mod(nvl(option$,0),2))
    from
    objauth$ where obj#=:1 group by grantee#,privilege#,nvl(col#,0) order by
    grantee#
    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 2 0 0
    total 3 0.00 0.00 0 2 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    select u.name,o.name, t.update$, t.insert$, t.delete$, t.enabled
    from
    obj$ o,user$ u,trigger$ t where t.baseobject=:1 and t.obj#=o.obj# and
    o.owner#=u.user# and bitand(property,16)=0 and bitand(property,8)=0 order
    by o.obj#
    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 1 0 0
    total 3 0.00 0.00 0 1 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    0 SORT ORDER BY (cr=1 pr=0 pw=0 time=55 us)
    0 NESTED LOOPS (cr=1 pr=0 pw=0 time=36 us)
    0 NESTED LOOPS (cr=1 pr=0 pw=0 time=34 us)
    0 TABLE ACCESS BY INDEX ROWID TRIGGER$ (cr=1 pr=0 pw=0 time=33 us)
    0 INDEX RANGE SCAN I_TRIGGER1 (cr=1 pr=0 pw=0 time=23 us)(object id 123)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 2 1.13 1.22 11 2257403 970 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 3 1.13 1.23 11 2257403 970 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    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 74.65 74.65
    row cache lock 2 0.00 0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 18 0.00 0.01 0 0 0 0
    Execute 1990 1743.76 1791.75 11 2252537 1976 967
    Fetch 1062 0.11 0.12 7 5026 0 317
    total 3070 1743.87 1791.89 18 2257563 1976 1284
    Misses in library cache during parse: 17
    Misses in library cache during execute: 16
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    row cache lock 28 0.00 0.00
    gc current grant 2-way 4 0.00 0.00
    latch: cache buffers chains 10 0.02 0.16
    library cache lock 2 0.00 0.00
    library cache pin 1 0.00 0.00
    rdbms ipc reply 1 0.00 0.00
    gc cr grant 2-way 5 0.00 0.00
    db file sequential read 11 0.01 0.10
    enq: TM - contention 2 0.00 0.00
    4 user SQL statements in session.
    16 internal SQL statements in session.
    20 SQL statements in session.
    Trace file: orbit02_ora_5933.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    1 session in tracefile.
    4 user SQL statements in trace file.
    16 internal SQL statements in trace file.
    20 SQL statements in trace file.
    19 unique SQL statements in trace file.
    91823 lines in trace file.
    1867 elapsed seconds in trace file.
    Can you please tell me why a simple merge statement using that much of CPU.
    And how do I restrict the usage.
    Regards,
    Koushik

  • High cpu usage by query

    We have a table named "tbl_geodata" which has address and latitude and longitude values. We
    also have a "History" table which has only latitude and longitude values including other information. What we need is like following...
    We get a set of records based on a query from "History" (lat long values), say 5000 records
    Now we are using the following formula to calculate address from the "tbl_geodata" for each row
    (5000 rows).
        SELECT top 1 geo_street,geo_town,geo_country,( 3959 acos( cos( radians(History.lat) ) cos( radians(
    gps_latitude ) ) cos( radians( gps_longitude ) - radians(History.long) ) + sin( radians(History.lat) ) sin( radians( gps_latitude ) ) ) ) AS distance FROM tbl_geodata ORDER BY distance
    Currently we are seeing high cpu utilisation and performance issue. What would be the optimized way to do
    this

    We are using SQL Server Web Edition. We have a table which has around 120 million records (every second around 100 insertion). It has a AFTER INSERT trigger to update another table. There is following performance issue we are facing. 
    High CPU Usage
    Insertion failed (Connection Timeout Expired.  The timeout period elapsed during the post-login phase.  The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting
    to create multiple active connections.  The duration spent while attempting to connect to this server was - [Pre-Login] initialization=0; handshake=10046; [Login] initialization=0; authentication=0; [Post-Login] complete=3999;)
    Insertion Failed (A severe error occurred on the current command.  The results, if any, should be discarded.)
    Insertion Failed (Some time we are getting connection pool error.. There is no limit set in the connection string)
    I ran sp_who2 command and found a lot of queries are in suspended mode..
    here is the "sys.dm_os_sys_info" result...
    cpu_count   hyperthread_ratio
    physical_memory_in_bytes virtual_memory_in_bytes
    8                   8
                                12853739520
                 8796092891136
    Can anyone please suggest the improvement steps...

  • How to find out the JVM thread that is consuming high CPU

    I am using WL 10.3, JRockit JVM on Linux. I have taken thread dumps. How to find out the JVM thread that is consuming high CPU?
    I know how to map it Sun JVM on Solaris. I haven't done in on JRockit so far. Please advise.

    Check out some of Marcus Hirt's blog entries for details about how to use JRockit Mission Control. It's a very nice tool that should provide a lot of insight:
    http://blogs.oracle.com/hirt/

Maybe you are looking for

  • Error when running attached menu to form

    I have recently attached a menu to a form. It worked the first time, but not I just get the error : "form-10221: Cannot read file <menu filename>" I have recompiled "This section" as well as "compile all". According Oracle help, I should just recompi

  • "File could not be found"

    Hi!  I have been trying to figure out what's going on here.  Some files (not all files or all file types) are not opening properly.  I get the following message: "Could not complete your request because the file could not be found." This is happening

  • Xfce menu problem (can't launch applications)

    I have a very weird problem with xfce's popup menu (right click). I try to launch an application from it (Multimedia/Mplayer for example) and it doesn't want to open for some reason. The sequence i do is Right click to get menu to popup, click on app

  • "Invalid column name 'DiscountPartNo'." during Items Synch

    Hi everyone, I'm having the following error message on the items synchronization part. Invalid column name 'DiscountPartNo'. Invalid column name 'DiscountPartNo'.    at netpoint.api.data.DataFunctions.ExecuteReader(CommandType commandType, String SQL

  • How can I get the volume to work?

    I cannot get the volume to work on the Nano 7.  Does anyone have any tips?