ADSM-L

GROUP by in SELECT

2001-05-22 06:44:27
Subject: GROUP by in SELECT
From: Michel Engels <Michel.Engels AT DEVOTEAM DOT BE>
Date: Tue, 22 May 2001 12:07:36 +0100
Hello dear *SMers,

I do have a little question about my select statement. I am executing SAP R/3
backups with the TDP 3.1 agent. Everything works just fine until now. To
complete the nice picture I would like to combine the backups with a daily
report of the amount of data being backed up. In fact the backup for SAP is an
archive and everything is managed by the execution of the backint program as
there are different files, filenames and the deletion of this all. To be able to
report this I created the following script


Name           Line       Command

               Number
----------     ------     
------------------------------------------------------------
Q_OBJ_AR_-     1          /************************************************/
Q_OBJ_AR_-     1          /************************************************/

 NODE


               5          /* Script that reports all the objects that are */

               10         /* archived for a node X                        */

               15         /* The X parameter that has to be given is the  */

               20         /* nodename                                     */

               25         /************************************************/

               30         set sqlmathmode round

               35         set sqldatetimeformat eur

               40         select entity as "NodeName", -

               45             date(start_time) as "Date (D/M/Y)", -

               50             time(start_time) as time, -

               55             substr(cast(end_time-start_time as
varchar(17)),3,8) as
                           elapsed, -

               60             cast(sum(affected) as varchar(10)) as "Num Obj", -

               65           case -

               70             when sum(bytes) > 1073741824 then -

               75                  cast(sum(bytes)/1073741824 as varchar(24))||'
 Gb' -
               80             when sum(bytes) > 1048576 then -

               85                  cast(sum(bytes)/1048576 as varchar(24))||'
Mb' -
               90             when sum(bytes) > 1024 then -

               95                  cast(sum(bytes)/1024 as varchar(24))||' Kb' -

               100            else cast(sum(bytes) as varchar(24)) -

               105          end as "Num Bytes" -

               110          from summary -

               115          where activity='ARCHIVE' and -

               120             entity=upper('$1') and -

               125             successful='YES' -

               130           group by entity,start_time,end_time




and this creates the following output:



NodeName               Date (D/M/Y)         TIME     ELAPSED               Num
Obj        Num Bytes
------------------     ------------     --------     -----------------     
----------
    ------------------
    ------------------
SP0107_SAP               18.04.2001     03.01.13     00:06:28              8
              66 Mb
SP0107_SAP               18.04.2001     03.08.02     00:23:36              18
             164 Mb
SP0107_SAP               18.04.2001     03.31.47     00:00:18              20
             1 Mb
SP0107_SAP               18.04.2001     15.49.59     04:31:10              106
            18 Gb
SP0107_SAP               18.04.2001     20.21.33     00:00:03              20
             1 Mb
SP0107_SAP               19.04.2001     03.01.18     03:47:41              106
            18 Gb
SP0107_SAP               19.04.2001     06.49.18     00:00:03              20
             1 Mb
SP0107_SAP               19.04.2001     06.49.32     00:01:40              18
             164 Mb
SP0107_SAP               19.04.2001     13.48.52     00:06:41              50
             477 Mb
SP0107_SAP               19.04.2001     13.55.46     00:00:07              20
             1 Mb
SP0107_SAP               20.04.2001     03.01.16     04:42:44              106
            18 Gb
SP0107_SAP               20.04.2001     07.44.19     00:00:03              20
             1 Mb
SP0107_SAP               20.04.2001     07.44.32     00:04:56              50
             477 Mb
SP0107_SAP               20.04.2001     07.49.36     00:00:30              6
              48 Mb
SP0107_SAP               20.04.2001     07.50.11     00:00:03              20
             1 Mb
SP0107_SAP               21.04.2001     03.03.00     04:44:25              62
             9 Gb
SP0107_SAP               21.04.2001     03.03.01     04:44:24              52
             9 Gb
SP0107_SAP               21.04.2001     07.47.55     00:00:04              20
             1 Mb
SP0107_SAP               21.04.2001     07.48.07     00:00:39              6
              48 Mb
SP0107_SAP               21.04.2001     07.48.53     00:00:15              2
              20 Mb
.
.
.
.


My question is how do I have to change this script to have the total amount of
objects and bytes that are backed up per day.

Greetings,

Michel Engels
TSM Consultant
Devoteam Belgium
<Prev in Thread] Current Thread [Next in Thread>
  • GROUP by in SELECT, Michel Engels <=