Quantcast
Channel: Oracle Maniacs' Notes » Abhijit Ray
Viewing all articles
Browse latest Browse all 128

Instance health check queries

$
0
0

I regularly use the following queries to check the health of the Oracle instance. I use the output of the queries to create my own graphs that I present to management/client. You can modify the queries by changing the KFF names, custom object naming standard (for me the custom objects have been named by starting the names with XXEY), etc.

Program runs (runs in seconds)

SELECT *
  FROM (SELECT   TRUNC (fcr.request_date) request_date,
                 fct.user_concurrent_program_name program_name,
                 COUNT (1) num_runs,
                 MAX (  (fcr.actual_completion_date - fcr.actual_start_date)
                      * 24
                      * 60
                      * 60
                     ) worst_time,
                 MIN (  (fcr.actual_completion_date - fcr.actual_start_date)
                      * 24
                      * 60
                      * 60
                     ) best_time,
                 ROUND (AVG (  (  fcr.actual_completion_date
                                - fcr.actual_start_date
                               )
                             * 24
                             * 60
                             * 60
                            ),
                        2
                       ) avg_time
            FROM fnd_concurrent_requests fcr,
                 fnd_concurrent_programs fcp,
                 fnd_concurrent_programs_tl fct
           WHERE fcr.concurrent_program_id = fcp.concurrent_program_id
             AND fcr.concurrent_program_id = fct.concurrent_program_id
             AND fct.LANGUAGE = 'US'
             AND fcr.status_code != 'R'
             AND TRUNC (fcr.request_date) BETWEEN (SYSDATE - 7) AND SYSDATE
        GROUP BY TRUNC (fcr.request_date), fct.user_concurrent_program_name
        ORDER BY 1, 2)
 WHERE avg_time > 1800

Sample output

REQUEST_DATE PROGRAM_NAME NUM_RUNS WORST_TIME BEST_TIME AVG_TIME
7/9/2012 Autoinvoice Import Program 12 3394 3147 3247.83
7/9/2012 Autoinvoice Master Program 4 4282 3940 4095.5
7/9/2012 EY Common Data Loader 1 2894 2894 2894
7/9/2012 Report Set 1 4390 4390 4390
7/10/2012 Autoinvoice Import Program 12 2561 2439 2495.75
7/10/2012 Autoinvoice Master Program 4 2949 2859 2891.5
7/10/2012 EY Common Data Loader 1 2639 2639 2639
7/11/2012 Autoinvoice Import Program 9 3040 2961 3007.78
7/11/2012 Autoinvoice Master Program 1 3377 3377 3377
7/11/2012 Report Set 3 5277 3 3453.33

   
Code to monitor growth in custom objects

SELECT   object_type, mon, dt, num,
         SUM (num) OVER (PARTITION BY object_type ORDER BY object_type,
          dt) run_tot
    FROM (SELECT   object_type, TO_CHAR (created, 'MON-YY') mon,
                   TO_CHAR (created, 'YYYYMM') dt, COUNT (1) num
              FROM all_objects
             WHERE (object_name LIKE 'EY%' OR object_name LIKE 'XX%')
          GROUP BY object_type,
                   TO_CHAR (created, 'MON-YY'),
                   TO_CHAR (created, 'YYYYMM')) obj_data
ORDER BY 3, 1

Sample output

OBJECT_TYPE MON DT NUM RUN_TOT
PACKAGE SEP-05

200509

1

1

PACKAGE BODY SEP-05

200509

1

1

PROCEDURE SEP-05

200509

6

6

SEQUENCE SEP-05

200509

1

1

SYNONYM SEP-05

200509

5

5

TABLE SEP-05

200509

12

12

VIEW SEP-05

200509

1

1

FUNCTION OCT-05

200510

1

1

TABLE ‘OCT-05

200510

30

42

VIEW ‘NOV-05

200511

1

2

PROCEDURE MAY-06

200605

1

7

TABLE MAY-06

200605

1

43

PACKAGE JUN-06

200606

1

2

PACKAGE BODY JUN-06

200606

1

2

TABLE JUN-06

200606

1

44

VIEW JUN-06

200606

1

3

FUNCTION JUL-06

200607

1

2

INDEX JUL-06

200607

2

2

PACKAGE JUL-06

200607

1

3

PACKAGE BODY JUL-06

200607

1

3

PROCEDURE JUL-06

200607

6

13

SEQUENCE JUL-06

200607

13

14

SYNONYM JUL-06

200607

25

30

TABLE JUL-06

200607

18

62

VIEW JUL-06

200607

3

6

SEQUENCE AUG-06

200608

1

15

SYNONYM AUG-06

200608

11

41

PROCEDURE SEP-06

200609

1

14

PROCEDURE OCT-06

200610

2

16

SYNONYM OCT-06

200610

1

42

TABLE OCT-06

200610

1

63

VIEW OCT-06

200610

5

11

PACKAGE NOV-06

200611

1

4

PACKAGE BODY NOV-06

200611

1

4

PROCEDURE NOV-06

200611

2

18

SYNONYM NOV-06

200611

1

43

TABLE NOV-06

200611

3

66

VIEW NOV-06

200611

9

20

FUNCTION DEC-06

200612

2

4

INDEX DEC-06

200612

5

7

TABLE DEC-06

200612

3

69

VIEW DEC-06

200612

1

21

FUNCTION JAN-07

200701

1

5

PACKAGE JAN-07

200701

2

6

PACKAGE BODY JAN-07

200701

2

6

PROCEDURE JAN-07

200701

1

19

VIEW JAN-07

200701

7

28

MATERIALIZED VIEW FEB-07

200702

1

1

SEQUENCE FEB-07

200702

2

17

SYNONYM FEB-07

200702

3

46

TABLE FEB-07

200702

6

75

VIEW FEB-07

200702

12

40

TABLE MAR-07

200703

3

78

VIEW MAR-07

200703

9

49

INDEX APR-07

200704

4

11

PROCEDURE APR-07

200704

1

20

TABLE APR-07

200704

1

79

VIEW APR-07

200704

1

50

PROCEDURE MAY-07

200705

1

21

SYNONYM MAY-07

200705

1

47

VIEW MAY-07

200705

13

63

PACKAGE JUN-07

200706

5

11

PACKAGE BODY JUN-07

200706

5

11

PROCEDURE JUN-07

200706

1

22

VIEW JUN-07

200706

1

64

PACKAGE JUL-07

200707

5

16

PACKAGE BODY JUL-07

200707

5

16

TABLE JUL-07

200707

1

80

VIEW JUL-07

200707

2

66

   
Check the running times for all programs run in the last 7 days (Executes in 5 seconds)

SELECT   trunc(fcr.request_date) Request_date, fct.user_concurrent_program_name,
         COUNT (1) "Num of runs",
         MAX (  (fcr.actual_completion_date - fcr.actual_start_date)
              * 24
              * 60
              * 60
             ) "Worst time (in secs)",
         MIN (  (fcr.actual_completion_date - fcr.actual_start_date)
              * 24
              * 60
              * 60
             ) "Best time (in secs)",
         ROUND
            (AVG (  (fcr.actual_completion_date
                     - fcr.actual_start_date
                    )
                  * 24
                  * 60
                  * 60
                 ),
             2
            ) "Avg time (in secs)",
         ROUND
            (MEDIAN (  (  fcr.actual_completion_date
                        - fcr.actual_start_date
                       )
                     * 24
                     * 60
                     * 60
                    ),
             2
            ) "Median time (in secs)"
    FROM fnd_concurrent_requests fcr, fnd_concurrent_programs fcp, fnd_concurrent_programs_tl fct
   WHERE fcr.concurrent_program_id = fcp.concurrent_program_id
     AND fcr.concurrent_program_id = fct.concurrent_program_id
     AND fct.language = 'US'
     AND fcr.status_code != 'R'
     AND trunc(fcr.request_date) BETWEEN (SYSDATE - 7) AND SYSDATE
GROUP BY trunc(fcr.request_date), fct.user_concurrent_program_name
ORDER BY 1

Sample output

REQUEST_DATE USER_CONCURRENT_PROGRAM_NAME Num of runs Worst time (in secs) Best time (in secs) Avg time (in secs) Median time (in secs)
7/5/2012 AutoReconciliation 6048 28 0 2.89 2
7/5/2012 AutoReconciliation Execution Report 6048 19 1 4 3
7/5/2012 AutoSelect 1 5 5 5 5
7/5/2012 Build Payments 2 2 1 1.5 1.5
7/5/2012 Check Periodic Alert 4 48 1 15.25 6
7/5/2012 Compile value set hierarchies 4 1 0 0.5 0.5
7/5/2012 Confirm Payment Batch 1 3 3 3 3
7/5/2012 Create and Maintain Company Cost Center Organizations 1 1 1 1 1
7/5/2012 EY Account Analysis 3 9 3 5.33 4
7/5/2012 EY HR Miscellaneous Run 2 1 1 1 1
7/5/2012 EY Payment Voucher 2 22 2 12 12
7/5/2012 EY Purchase Order Print – Outstations With Tax 2 24 22 23 23
7/5/2012 EY Purchase Order Print – Outstations Without Tax 2 4 3 3.5 3.5
7/5/2012 EY SUPPLIER BANK LETTER 2 42 22 32 32
7/5/2012 Final Payment Register 2 1 1 1 1
7/6/2012 EY Purchase Order Print – Outstations Without Tax 1 4 4 4 4
7/6/2012 Gather Schema Statistics 4        
7/6/2012 Gather Table Statistics 9 886 161 514.89 533
7/6/2012 OAM Applications Dashboard Collection 1 8 8 8 8
7/6/2012 Periodic Alert Scheduler 1 74 74 74 74
7/6/2012 Print Adjustments 1 4 4 4 4
7/6/2012 Purge Concurrent Request and/or Manager Data 1 210 210 210 210
7/6/2012 Workflow Background Process 864 18 0 0.63 1
7/6/2012 Workflow Control Queue Cleanup 1 2 2 2 2
7/6/2012 XXEY TMS Trip Scheduler 24 1 0 0.33 0
7/7/2012 AutoReconciliation 6048 15 0 2.86 2
7/7/2012 AutoReconciliation Execution Report 6048 15 1 3.85 3
7/7/2012 Check Periodic Alert 4 52 1 16.5 6.5
7/7/2012 EY HR Miscellaneous Run 2 2 1 1.5 1.5
7/7/2012 Gather Table Statistics 9 717 185 431.67 478
7/7/2012 OAM Applications Dashboard Collection 1 9 9 9 9
7/7/2012 Periodic Alert Scheduler 1 77 77 77 77
7/7/2012 Print Adjustments 1 5 5 5 5
7/8/2012 AutoReconciliation 6048 22 0 2.96 2
7/8/2012 AutoReconciliation Execution Report 6048 21 1 3.92 3
7/8/2012 Bank Account Listing 2 5 2 3.5 3.5
7/8/2012 Check Periodic Alert 4 37 2 17.25 15
7/8/2012 Compile Security 15 7 0 1.87 1
7/8/2012 Delete Item Information 16 6 1 2.25 1
7/8/2012 EY Copy PDF file 1 1 1 1 1
7/8/2012 EY HR Miscellaneous Run 2 1 1 1 1
7/8/2012 EY Purchase Order Print – XML 1 18 18 18 18
7/9/2012 EY Supplier Aging Detail Report Revised 2 12 11 11.5 11.5
7/9/2012 Gather Table Statistics 9 1229 162 515.11 458
7/9/2012 General Ledger Transfer Program 4 1 0 0.5 0.5
7/9/2012 Maintain Oracle Office Messages 4 4 1 2.5 2.5
7/9/2012 OAM Applications Dashboard Collection 1 8 8 8 8
7/9/2012 Payables Open Interface Import 6 15 2 7.33 7
7/9/2012 Periodic Alert Scheduler 1 86 86 86 86
7/9/2012 Prepayments Matching Program 4 53 51 52 52
7/9/2012 Print Adjustments 1 11 11 11 11
7/9/2012 Purge Concurrent Request and/or Manager Data 1 206 206 206 206
7/9/2012 Report Set 1 4390 4390 4390 4390
7/9/2012 Request Set Stage 3 2895 2 1461.33 1487
7/9/2012 Workflow Background Process 864 49 0 0.95 1
7/9/2012 Workflow Control Queue Cleanup 1 4 4 4 4
7/10/2012 Autoinvoice Import Program 12 2561 2439 2495.75 2506
7/10/2012 Autoinvoice Master Program 4 2949 2859 2891.5 2879
7/10/2012 Check Event Alert 1 4 4 4 4
7/10/2012 Check Periodic Alert 4 54 1 20.5 13.5
7/10/2012 Create and Maintain Company Cost Center Organizations 4 1 0 0.5 0.5
7/10/2012 Deactivate Concurrent Manager 2        
7/10/2012 EY AR Credit Card BSP Import Program 1 313 313 313 313
7/10/2012 EY BSP DDS Create Data Batches Program 3 3517 5 1181 21
7/10/2012 EY Catering Requisitions and Transactions 1 1 1 1 1
7/10/2012 EY Common Data Loader 1 2639 2639 2639 2639
7/10/2012 EY Create Supplier Site 1 56 56 56 56
7/10/2012 EY HO Invoice Validation 2 109 4 56.5 56.5
7/10/2012 EY HO Invoice and OST DM Creation Program 2 197 160 178.5 178.5
7/10/2012 EY HR Miscellaneous Run 2        
7/10/2012 EY Payment Voucher 2 7 2 4.5 4.5
7/10/2012 EY Purchase Order Print – Outstations Without Tax 9 35 1 10.22 4
7/10/2012 Gather Table Statistics 9 664 115 455.33 475
7/10/2012 Inventory transaction worker 1 20 20 20 20
7/11/2012 Print Adjustments 1        
7/11/2012 Program – Automatic Posting 1 4 4 4 4
7/11/2012 Purge Concurrent Request and/or Manager Data 1        
7/11/2012 Report Set 3 5277 3 3453.33 5080
7/11/2012 Request Set Stage 11 3394 1 940.27 556
7/11/2012 Workflow Background Process 658 50 0 1.35 1
7/11/2012 Workflow Control Queue Cleanup 1        
7/11/2012 Workflow Definitions Loader 2 1 0 0.5 0.5
7/11/2012 XXEY MBS Exception Report 2 160 5 82.5 82.5
7/11/2012 XXEY TMS Trip Scheduler 17 2 0 0.38 0

   
SQL to get the running time buckets of programs (executes in 5 seconds)

SELECT COUNT (DECODE (SIGN ((actual_completion_date - actual_start_date) * 24 * 60 * 60 - 60),
                      -1, 1
                     )) "Num_less_1_min",
         COUNT (DECODE (SIGN ((actual_completion_date - actual_start_date) * 24 * 60 * 60 - 300),
                        -1, 1,
                        0, 1
                       ))
       - COUNT (DECODE (SIGN ((actual_completion_date - actual_start_date) * 24 * 60 * 60 - 60),
                        -1, 1
                       )) "Num_1_5_min",
         COUNT (DECODE (SIGN ((actual_completion_date - actual_start_date) * 24 * 60 * 60 - 900),
                        -1, 1,
                        0, 1
                       ))
       - COUNT (DECODE (SIGN ((actual_completion_date - actual_start_date) * 24 * 60 * 60 - 300),
                        -1, 1
                       )) "Num_5_15_min",
       COUNT (DECODE (SIGN ((actual_completion_date - actual_start_date) * 24 * 60 * 60 - 900),
                      1, 1,
                      0, 1
                     )) "Num_15_min"
  FROM fnd_concurrent_requests fcr
 WHERE fcr.status_code != 'R' AND TRUNC (fcr.request_date) BETWEEN (SYSDATE - 7) AND SYSDATE

Sample output

Num_less_1_min Num_1_5_min Num_5_15_min Num_15_min
88168 163 143 88

   
SQL to get space of the schemas

select 'All' Schema, ROUND(sum(BYTES) / 1024 / 1024, 3) Size_MB, sysdate from dba_data_files
UNION ALL
-- Add the modules being used
select owner Schema, ROUND(sum(BYTES) / 1024 / 1024, 3) Size_MB, sysdate from dba_segments where owner in ('GL', 'AR', 'AP', 'FA', 'CE', 'PO', 'INV', 'XXCUST') group by owner
UNION ALL
select 'Rest' Schema, ROUND(sum(BYTES) / 1024 / 1024, 3), sysdate from dba_segments where owner not in ('GL', 'AR', 'AP', 'FA', 'CE', 'PO', 'INV', 'XXCUST', 'SYS', 'SYSTEM')
UNION ALL
select 'Free' Schema, ROUND(sum(BYTES) / 1024 / 1024, 3) Size_MB, sysdate from dba_free_space

Sample output

SCHEMA SIZE_MB SYSDATE
All 1062106.58 7/11/2012 16:51
AR 27258.5 7/11/2012 16:51
GL 163434.875 7/11/2012 16:51
FA 665.375 7/11/2012 16:51
PO 4749.125 7/11/2012 16:51
XXCUST 191872.07 7/11/2012 16:51
CE 132.125 7/11/2012 16:51
AP 10818.75 7/11/2012 16:51
INV 3206.625 7/11/2012 16:51
Rest 411927.945 7/11/2012 16:51
Free 197018.992 7/11/2012 16:51

  
SQL to get the KFF Segment growth

select ffv.flex_value_set_id, ffs.FLEX_VALUE_SET_NAME SEGMENT_NAME, glp.period_name, count(1)
from fnd_flex_values ffv, fnd_flex_value_sets ffs, gl_periods glp
where ffv.flex_value_set_id = ffs.flex_value_set_id
and ffs.flex_value_set_name in (
select ffvs.flex_value_set_name
from FND_ID_FLEX_STRUCTURES_VL ffv, FND_ID_FLEX_SEGMENTS_VL fft, fnd_flex_value_sets ffvs
where 1 = 1
and fft.id_flex_num = ffv.id_flex_num
and ffvs.flex_value_set_id = fft.flex_value_set_id
and ffv.id_flex_code = 'GL#'
and ffv.id_flex_structure_name = 'EY_ACC_FLEX' -- To be changed as per KFF name
)
and glp.period_type = '21'
and glp.period_set_name = 'EY Monthly'
and ffv.last_update_date between glp.start_date and glp.end_date
group by  ffv.flex_value_set_id, ffs.FLEX_VALUE_SET_NAME, glp.period_name

Sample output

FLEX_VALUE_SET_ID SEGMENT_NAME PERIOD_NAME COUNT(1)
1009608 EY_LOCATION 8-Apr 8
1009608 EY_LOCATION 8-Nov 8
1009608 EY_LOCATION 11-Apr 1
1009609 EY_COST_CENTRE 5-Sep 14
1009609 EY_COST_CENTRE 8-Nov 3
1009609 EY_COST_CENTRE 8-Sep 19
1009610 EY_ACCOUNT 9-Nov 19
1009610 EY_ACCOUNT 7-Dec 15
1009610 EY_ACCOUNT 11-Nov 11
1009610 EY_ACCOUNT 10-Jun 4
1009610 EY_ACCOUNT 7-Sep 6
1009610 EY_ACCOUNT 9-Sep 13
1009611 EY_COST_OBJECT 6-Aug 18
1009611 EY_COST_OBJECT 8-Jul 38
1009611 EY_COST_OBJECT 10-Nov 53
1009611 EY_COST_OBJECT 7-Sep 28
1009611 EY_COST_OBJECT 7-Aug 22
1009611 EY_COST_OBJECT 7-Jun 18
1009612 EY_AIRCRAFT_CODE 5-Dec 5
1009612 EY_AIRCRAFT_CODE 7-Oct 14
1009612 EY_AIRCRAFT_CODE 9-Mar 106
. . . . . . . . . . .
. . . . . . . . . . .
1009610 EY_ACCOUNT 7-Aug 5
1009612 EY_AIRCRAFT_CODE 10-May 2
1009608 EY_LOCATION 10-Jun 7
1009608 EY_LOCATION 6-Nov 3
1009608 EY_LOCATION 10-Sep 3
1009610 EY_ACCOUNT 10-Sep 2
1009609 EY_COST_CENTRE 9-Sep 1
1009609 EY_COST_CENTRE 6-Oct 2
1009609 EY_COST_CENTRE 6-Jun 2
1009610 EY_ACCOUNT 9-Dec 2
1009612 EY_AIRCRAFT_CODE 8-May 1

   
SQL to get the KFF details

select ffv.id_flex_code, ffv.id_flex_structure_name, ffv.id_flex_structure_code, fft.segment_name, fft.application_column_name, fft.form_left_prompt, fft.form_above_prompt, fft.flex_value_set_id, ffvs.flex_value_set_name
from FND_ID_FLEX_STRUCTURES_VL ffv, FND_ID_FLEX_SEGMENTS_VL fft, fnd_flex_value_sets ffvs
where 1 = 1
and fft.id_flex_num = ffv.id_flex_num
and ffvs.flex_value_set_id = fft.flex_value_set_id
and ffv.id_flex_code = 'GL#'
and ffv.id_flex_structure_name = 'EY_ACC_FLEX'

Sample output

ID_FLEX_CODE ID_FLEX_STRUCTURE_NAME ID_FLEX_STRUCTURE_CODE SEGMENT_NAME APPLICATION_COLUMN_NAME FORM_LEFT_PROMPT FORM_ABOVE_PROMPT FLEX_VALUE_SET_ID FLEX_VALUE_SET_NAME
GL# EY_ACC_FLEX EY_ACC_FLEX Company SEGMENT1 Company Company 1009607 EY_COMPANY
GL# EY_ACC_FLEX EY_ACC_FLEX Location SEGMENT2 Location Location 1009608 EY_LOCATION
GL# EY_ACC_FLEX EY_ACC_FLEX Cost Centre SEGMENT3 Cost Centre Cost Centre 1009609 EY_COST_CENTRE
GL# EY_ACC_FLEX EY_ACC_FLEX Account SEGMENT4 Account Account 1009610 EY_ACCOUNT
GL# EY_ACC_FLEX EY_ACC_FLEX Cost Object SEGMENT5 Cost Object Cost Object 1009611 EY_COST_OBJECT
GL# EY_ACC_FLEX EY_ACC_FLEX Aircraft Code SEGMENT6 Aircraft Code Aircraft Code 1009612 EY_AIRCRAFT_CODE

Cheers!



Viewing all articles
Browse latest Browse all 128

Trending Articles