oci360 2a.39. Volumes without backup in last 30 days (OCI360_VOLUMES)


# DISPLAY_NAME IS_H SIZE_IN_MBS VPUS_PER_GB TIME_CREATED COMPARTMENT_NAME LIFECYCLE_STATE VOLU AVAILABILITY_DOMAIN POLICY_N LATEST_BACKUP ID
1 test_vol true 51200 0 2020-06-26T18:15:04.901000+00:00 compt_dev_db TERMINATED   CYtq:US-ASHBURN-AD-3     ocid1.volume.oc1.iad.000000000000000000000000000000000000000000000000000000000711

#: click on a column heading to sort on it

 Name                                                                                Null?    Type
 ----------------------------------------------------------------------------------- -------- --------------------------------------------------------
 ID                                                                                           VARCHAR2(128)
 KMS_KEY_ID                                                                                   VARCHAR2(4)
 IS_HYDRATED                                                                                  VARCHAR2(4)
 SIZE_IN_GBS                                                                                  NUMBER
 SIZE_IN_MBS                                                                                  NUMBER
 SYSTEM_TAGS$ORCL_CLOUD$FREE_TIER_RETAINED                                                    VARCHAR2(4)
 VPUS_PER_GB                                                                                  NUMBER
 DEFINED_TAGS$ORACLE_TAGS$CREATEDBY                                                           VARCHAR2(64)
 DEFINED_TAGS$ORACLE_TAGS$CREATEDON                                                           VARCHAR2(32)
 DISPLAY_NAME                                                                                 VARCHAR2(16)
 TIME_CREATED                                                                                 VARCHAR2(32)
 COMPARTMENT_ID                                                                               VARCHAR2(128)
 LIFECYCLE_STATE                                                                              VARCHAR2(16)
 VOLUME_GROUP_ID                                                                              VARCHAR2(4)
 AVAILABILITY_DOMAIN                                                                          VARCHAR2(32)
 SOURCE_DETAILS$ID                                                                            VARCHAR2(1)
 SOURCE_DETAILS$TYPE                                                                          VARCHAR2(1)


SELECT jt.DISPLAY_NAME,
       jt.IS_HYDRATED,
       jt.SIZE_IN_MBS,
       jt.VPUS_PER_GB,
       jt.TIME_CREATED,
       tcomp.NAME COMPARTMENT_NAME,
       jt.LIFECYCLE_STATE,
       jt.VOLUME_GROUP_ID,
       jt.AVAILABILITY_DOMAIN,
       tbkppol.POLICY_NAME,
       max(to_timestamp_tz(tbkp.time_created,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM')) LATEST_BACKUP,
       jt.ID
FROM   OCI360_VOLUMES jt,
       OCI360_COMPARTMENTS tcomp,
       OCI360_BKP_POLICY_ASSIGN tbkppolassign,
       (select distinct id, display_name policy_name from OCI360_BKP_POLICY) tbkppol,
       OCI360_BACKUPS tbkp
WHERE  jt.COMPARTMENT_ID = tcomp.ID
AND    jt.ID = tbkppolassign.ASSET_ID (+)
AND    tbkppolassign.POLICY_ID = tbkppol.ID (+)
AND    jt.ID = tbkp.volume_id (+)
AND    tbkp.LIFECYCLE_STATE (+) = 'AVAILABLE'
GROUP BY jt.DISPLAY_NAME,
         jt.IS_HYDRATED,
         jt.SIZE_IN_MBS,
         jt.VPUS_PER_GB,
         jt.TIME_CREATED,
         tcomp.NAME,
         jt.LIFECYCLE_STATE,
         jt.VOLUME_GROUP_ID,
         jt.AVAILABILITY_DOMAIN,
         tbkppol.POLICY_NAME,
         jt.ID
HAVING  max(to_timestamp_tz(tbkp.time_created,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM')) <= to_date('2020-07-01','YYYY-MM-DD') - 30
OR      max(to_timestamp_tz(tbkp.time_created,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM')) is null
ORDER  BY COMPARTMENT_NAME, LATEST_BACKUP DESC NULLS LAST;


1 rows selected.

oci360 (c) 2020, All rights reserved. oci360 v20.06 (2020-06-25) based on moat369 v2002 (2020-02-27). Timestamp: 2020-06-30T15:52:05