REPORT YSYSCHK2 NO STANDARD PAGE HEADING. * * This ABAP can display the most important parameters of many SAP * systems parallel. These parameters: tablespace free space history, * table and index extent history, space critical objects. The list * contains in a very compact and ordered format the recent, 1 day old, * 2 days old, 1 week old, 2 weeks old, 1 month old, 2 months old * values. * To make the program work, the /oracle/SID/sapcheck directories * have to be linked to the shared /usr/sap/trans/sapcheck/SID from * all the db. servers. * The sapdba -check has to be scheduled to run daily on all those * servers too. * * List of the systems to monitor: *@ DEV *@ QAS *@ PRD DATA: DAY TYPE D, FLAG, COUNTER TYPE I, TFIELD(3), OFFSET TYPE I, SID(28), FILE(40), LINE(80), STOP LIKE SY-INDEX, START LIKE SY-INDEX, NOS TYPE I, BEGIN OF A OCCURS 10, A(100), END OF A, BEGIN OF B OCCURS 100, B(300), END OF B, BEGIN OF C OCCURS 50, C(20), 1(3), 2(3), 3(3), 4(3), 5(3), 6(3), 7(3), END OF C. *Find out which systems to monitor DATA: PROGRAM LIKE SY-REPID, BEGIN OF T OCCURS 500, LINE(72), END OF T. PROGRAM = SY-REPID. READ REPORT PROGRAM INTO T. LOOP AT T. IF T(2) <> '*@'. DELETE T. ENDIF. ENDLOOP. DESCRIBE TABLE T LINES NOS. *Loop on the sytems LOOP AT T. SKIP 3. WRITE: / 'SYSTEM ' COLOR 6, T+3(3) COLOR 6. SKIP. CLEAR A. REFRESH A. CLEAR B. REFRESH B. CLEAR C. REFRESH C. COUNTER = 0. FLAG = ' '. CLEAR START. CLEAR STOP. SID = '/usr/sap/trans/sapcheck/'. SID+24(3) = T+3(3). SID+27(1) = '/'. WRITE: / 'Free % in tablespaces' COLOR 3. SKIP. DAY = SY-DATUM.DAY = DAY. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. DAY = DAY - 1. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. DAY = DAY - 1. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. DAY = DAY - 5. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. DAY = DAY - 7. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. DAY = DAY - 15. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. DAY = DAY - 30. A = DAY.A+8(20) = '0730.chk'.SHIFT A LEFT BY 2 PLACES.APPEND A. LOOP AT A. SHIFT A RIGHT BY 28 PLACES. A(28) = SID. MODIFY A. ENDLOOP. LOOP AT A. OPEN DATASET A FOR INPUT IN TEXT MODE. IF SY-SUBRC = 0. DO. READ DATASET A INTO B. IF SY-SUBRC <> 0.EXIT.ENDIF. IF B CS 'fragment'. IF B CS 'End'. STOP = SY-INDEX.STOP = STOP - 4. ELSE. START = SY-INDEX.START = START + 5. ENDIF. ENDIF. ENDDO. CLOSE DATASET A. OPEN DATASET A FOR INPUT IN TEXT MODE. STOP = STOP - START. DO START TIMES. READ DATASET A INTO B. ENDDO. DO STOP TIMES. READ DATASET A INTO B. APPEND B. ENDDO. CLOSE DATASET A. ENDIF. CLOSE DATASET A. B = '#####'. APPEND B. ENDLOOP. LOOP AT B. IF FLAG = ' '. "elso sorozat IF B(1) = '#'. "vege egy sorozatnak FLAG = 1. ELSE. C-C = B(20).C-1 = B+45(2). APPEND C. ENDIF. ELSE. IF B(1) = '#'. COUNTER = COUNTER + 1. ELSE. READ TABLE C WITH KEY B(20). IF SY-SUBRC = 0. OFFSET = ( COUNTER + 1 ) * 3 + 20. C+OFFSET(3) = B+45(2). MODIFY C INDEX SY-TABIX. ELSE. CLEAR C. OFFSET = ( COUNTER + 1 ) * 3 + 20. C-C = B(20). C+OFFSET(3) = B+45(2). APPEND C. ENDIF. ENDIF. ENDIF. ENDLOOP. WRITE: / 'TABLESPACE today'. WRITE: / ' : -1 day'. WRITE: / ' : : -2 days'. WRITE: / ' : : : -1 week'. WRITE: / ' : : : : -2 weeks'. WRITE: / ' : : : : : -1 month'. WRITE: / ' : : : : : : -2 months'. WRITE: / ' : : : : : : :'. SORT C BY 1 DESCENDING 2 DESCENDING 3 DESCENDING 4 DESCENDING 5 DESCENDING 6 DESCENDING 7 DESCENDING. LOOP AT C. WRITE: / C. ENDLOOP. CLEAR B.REFRESH B. LOOP AT A. CLEAR START. CLEAR STOP. FLAG = '0'. OPEN DATASET A FOR INPUT IN TEXT MODE. IF SY-SUBRC = 0. DO. READ DATASET A INTO B. IF SY-SUBRC <> 0.EXIT.ENDIF. * if b cs 'more' and b cs 'extents'. IF B CS 'List of all tables and indexes'. START = SY-INDEX.START = START + 4. FLAG = '1'. ENDIF. IF FLAG = '1' AND B CS '***************************'. FLAG = '0'. STOP = SY-INDEX.STOP = STOP - 2. ENDIF. ENDDO. CLOSE DATASET A. OPEN DATASET A FOR INPUT IN TEXT MODE. IF NOT STOP = START. STOP = STOP - START. ENDIF. DO START TIMES. READ DATASET A INTO B. ENDDO. DO STOP TIMES. READ DATASET A INTO B. APPEND B. ENDDO. CLOSE DATASET A. ENDIF. CLOSE DATASET A. B = '#####'. APPEND B. ENDLOOP. CLEAR C.REFRESH C.FLAG = ' '. COUNTER = 0. LOOP AT B. IF FLAG = ' '. "elso sorozat IF B(1) = '#'. "vege egy sorozatnak FLAG = 1. ELSE. C-C = B+41(20).C-1 = B+73(3). APPEND C. ENDIF. ELSE. IF B(1) = '#'. COUNTER = COUNTER + 1. ELSE. READ TABLE C WITH KEY B+41(20). IF SY-SUBRC = 0. OFFSET = ( COUNTER + 1 ) * 3 + 20. C+OFFSET(3) = B+73(3). MODIFY C INDEX SY-TABIX. ELSE. CLEAR C. OFFSET = ( COUNTER + 1 ) * 3 + 20. C-C = B(20). C+OFFSET(3) = B+73(3). APPEND C. ENDIF. ENDIF. ENDIF. ENDLOOP. SKIP 3. WRITE: / 'Extent # over 90' COLOR 3. SKIP. WRITE: / 'SEGMENT today'. WRITE: / ' : -1 day'. WRITE: / ' : : -2 days'. WRITE: / ' : : : -1 week'. WRITE: / ' : : : : -2 weeks'. WRITE: / ' : : : : : -1 month'. WRITE: / ' : : : : : : -2 months'. WRITE: / ' : : : : : : :'. SORT C BY 1 DESCENDING 2 DESCENDING 3 DESCENDING 4 DESCENDING 5 DESCENDING 6 DESCENDING 7 DESCENDING. LOOP AT C. WRITE: / C-C, C-1, C-2, C-3, C-4, C-5, C-6, C-7. ENDLOOP. CLEAR B.REFRESH B. READ TABLE A INDEX 1. CLEAR START. CLEAR STOP. FLAG = '0'. OPEN DATASET A FOR INPUT IN TEXT MODE. IF SY-SUBRC = 0. DO. READ DATASET A INTO B. IF SY-SUBRC <> 0.EXIT.ENDIF. IF B CS 'Critical'. START = SY-INDEX. FLAG = '1'. ENDIF. IF FLAG = '1' AND B CS '*****************'. FLAG = '0'. STOP = SY-INDEX - 1. ENDIF. ENDDO. CLOSE DATASET A. OPEN DATASET A FOR INPUT IN TEXT MODE. STOP = STOP - START. DO START TIMES. READ DATASET A INTO B. ENDDO. DO STOP TIMES. READ DATASET A INTO B. APPEND B. ENDDO. CLOSE DATASET A. ENDIF. CLOSE DATASET A. SKIP 3. WRITE: / 'Critical objects' COLOR 3. SKIP. LOOP AT B. WRITE: / B. ENDLOOP. ENDLOOP.