# | SNAP_ID | BEGIN_TIME | END_TIME | LINE1 | LINE2 | LINE3 |
---|---|---|---|---|---|---|
1 | 1 | 2020-06-01 00:00:00 | 2020-07-01 00:00:00 | 33 | 21 | 12 |
2 | 2 | 2020-07-01 00:00:00 | 2020-08-01 00:00:00 | 33 | 21 | 12 |
3 | 3 | 2020-08-01 00:00:00 | 2020-09-01 00:00:00 | 33 | 21 | 12 |
4 | 4 | 2020-09-01 00:00:00 | 2020-10-01 00:00:00 | 33 | 21 | 12 |
5 | 5 | 2020-10-01 00:00:00 | 2020-11-01 00:00:00 | 33 | 21 | 12 |
6 | 6 | 2020-11-01 00:00:00 | 2020-12-01 00:00:00 | 33 | 21 | 12 |
7 | 7 | 2020-12-01 00:00:00 | 2021-01-01 00:00:00 | 33 | 21 | 12 |
8 | 8 | 2021-01-01 00:00:00 | 2021-02-01 00:00:00 | 33 | 21 | 12 |
9 | 9 | 2021-02-01 00:00:00 | 2021-03-01 00:00:00 | 33 | 21 | 12 |
10 | 10 | 2021-03-01 00:00:00 | 2021-04-01 00:00:00 | 33 | 21 | 12 |
11 | 11 | 2021-04-01 00:00:00 | 2021-05-01 00:00:00 | 33 | 21 | 12 |
12 | 12 | 2021-05-01 00:00:00 | 2021-06-01 00:00:00 | 33 | 21 | 12 |
13 | 13 | 2021-06-01 00:00:00 | 2021-07-01 00:00:00 | 33 | 21 | 12 |
14 | 14 | 2021-07-01 00:00:00 | 2021-08-01 00:00:00 | 33 | 21 | 12 |
15 | 15 | 2021-08-01 00:00:00 | 2021-09-01 00:00:00 | 33 | 21 | 12 |
16 | 16 | 2021-09-01 00:00:00 | 2021-10-01 00:00:00 | 33 | 21 | 12 |
17 | 17 | 2021-10-01 00:00:00 | 2021-11-01 00:00:00 | 33 | 21 | 12 |
18 | 18 | 2021-11-01 00:00:00 | 2021-12-01 00:00:00 | 33 | 21 | 12 |
19 | 19 | 2021-12-01 00:00:00 | 2022-01-01 00:00:00 | 33 | 21 | 12 |
20 | 20 | 2022-01-01 00:00:00 | 2022-02-01 00:00:00 | 33 | 21 | 12 |
21 | 21 | 2022-02-01 00:00:00 | 2022-03-01 00:00:00 | 33 | 21 | 12 |
22 | 22 | 2022-03-01 00:00:00 | 2022-04-01 00:00:00 | 33 | 21 | 12 |
23 | 23 | 2022-04-01 00:00:00 | 2022-05-01 00:00:00 | 33 | 21 | 12 |
24 | 24 | 2022-05-01 00:00:00 | 2022-06-01 00:00:00 | 33 | 21 | 12 |
25 | 25 | 2022-06-01 00:00:00 | 2022-07-01 00:00:00 | 33 | 21 | 12 |
26 | 26 | 2022-07-01 00:00:00 | 2022-08-01 00:00:00 | 33 | 21 | 12 |
27 | 27 | 2022-08-01 00:00:00 | 2022-09-01 00:00:00 | 33 | 21 | 12 |
28 | 28 | 2022-09-01 00:00:00 | 2022-10-01 00:00:00 | 33 | 21 | 12 |
29 | 29 | 2022-10-01 00:00:00 | 2022-11-01 00:00:00 | 33 | 21 | 12 |
30 | 30 | 2022-11-01 00:00:00 | 2022-12-01 00:00:00 | 33 | 21 | 12 |
31 | 31 | 2022-12-01 00:00:00 | 2023-01-01 00:00:00 | 33 | 21 | 12 |
32 | 32 | 2023-01-01 00:00:00 | 2023-02-01 00:00:00 | 33 | 21 | 12 |
33 | 33 | 2023-02-01 00:00:00 | 2023-03-01 00:00:00 | 33 | 21 | 12 |
34 | 34 | 2023-03-01 00:00:00 | 2023-04-01 00:00:00 | 33 | 21 | 12 |
35 | 35 | 2023-04-01 00:00:00 | 2023-05-01 00:00:00 | 33 | 21 | 12 |
36 | 36 | 2023-05-01 00:00:00 | 2023-06-01 00:00:00 | 33 | 21 | 12 |
37 | 37 | 2023-06-01 00:00:00 | 2023-07-01 00:00:00 | 33 | 21 | 12 |
38 | 38 | 2023-07-01 00:00:00 | 2023-08-01 00:00:00 | 33 | 21 | 12 |
39 | 39 | 2023-08-01 00:00:00 | 2023-09-01 00:00:00 | 33 | 21 | 12 |
40 | 40 | 2023-09-01 00:00:00 | 2023-10-01 00:00:00 | 33 | 21 | 12 |
41 | 41 | 2023-10-01 00:00:00 | 2023-11-01 00:00:00 | 33 | 21 | 12 |
42 | 42 | 2023-11-01 00:00:00 | 2023-12-01 00:00:00 | 33 | 21 | 12 |
43 | 43 | 2023-12-01 00:00:00 | 2024-01-01 00:00:00 | 33 | 21 | 12 |
44 | 44 | 2024-01-01 00:00:00 | 2024-02-01 00:00:00 | 33 | 21 | 12 |
45 | 45 | 2024-02-01 00:00:00 | 2024-03-01 00:00:00 | 33 | 21 | 12 |
46 | 46 | 2024-03-01 00:00:00 | 2024-04-01 00:00:00 | 33 | 21 | 12 |
47 | 47 | 2024-04-01 00:00:00 | 2024-05-01 00:00:00 | 33 | 21 | 12 |
48 | 48 | 2024-05-01 00:00:00 | 2024-06-01 00:00:00 | 33 | 21 | 12 |
49 | 49 | 2024-06-01 00:00:00 | 2024-07-01 00:00:00 | 33 | 21 | 12 |
50 | 50 | 2024-07-01 00:00:00 | 2024-08-01 00:00:00 | 33 | 21 | 12 |
51 | 51 | 2024-08-01 00:00:00 | 2024-09-01 00:00:00 | 33 | 21 | 12 |
52 | 52 | 2024-09-01 00:00:00 | 2024-10-01 00:00:00 | 33 | 21 | 12 |
53 | 53 | 2024-10-01 00:00:00 | 2024-11-01 00:00:00 | 33 | 21 | 12 |
54 | 54 | 2024-11-01 00:00:00 | 2024-12-01 00:00:00 | 33 | 21 | 12 |
55 | 55 | 2024-12-01 00:00:00 | 2025-01-01 00:00:00 | 33 | 21 | 12 |
56 | 56 | 2025-01-01 00:00:00 | 2025-02-01 00:00:00 | 33 | 21 | 12 |
57 | 57 | 2025-02-01 00:00:00 | 2025-03-01 00:00:00 | 33 | 21 | 12 |
58 | 58 | 2025-03-01 00:00:00 | 2025-04-01 00:00:00 | 33 | 21 | 12 |
59 | 59 | 2025-04-01 00:00:00 | 2025-05-01 00:00:00 | 33 | 21 | 12 |
60 | 60 | 2025-05-01 00:00:00 | 2025-06-01 00:00:00 | 33 | 21 | 12 |
61 | 61 | 2025-06-01 00:00:00 | 2025-07-01 00:00:00 | 33 | 21 | 12 |
62 | 62 | 2025-07-01 00:00:00 | 2025-08-01 00:00:00 | 33 | 21 | 12 |
63 | 63 | 2025-08-01 00:00:00 | 2025-09-01 00:00:00 | 33 | 21 | 12 |
64 | 64 | 2025-09-01 00:00:00 | 2025-10-01 00:00:00 | 33 | 21 | 12 |
65 | 65 | 2025-10-01 00:00:00 | 2025-11-01 00:00:00 | 33 | 21 | 12 |
66 | 66 | 2025-11-01 00:00:00 | 2025-12-01 00:00:00 | 33 | 21 | 12 |
67 | 67 | 2025-12-01 00:00:00 | 2026-01-01 00:00:00 | 33 | 21 | 12 |
68 | 68 | 2026-01-01 00:00:00 | 2026-02-01 00:00:00 | 33 | 21 | 12 |
69 | 69 | 2026-02-01 00:00:00 | 2026-03-01 00:00:00 | 33 | 21 | 12 |
70 | 70 | 2026-03-01 00:00:00 | 2026-04-01 00:00:00 | 33 | 21 | 12 |
71 | 71 | 2026-04-01 00:00:00 | 2026-05-01 00:00:00 | 33 | 21 | 12 |
72 | 72 | 2026-05-01 00:00:00 | 2026-06-01 00:00:00 | 33 | 21 | 12 |
73 | 73 | 2026-06-01 00:00:00 | 2026-07-01 00:00:00 | 33 | 21 | 12 |
#: click on a column heading to sort on it
Future sizes are avarage of previous backups size.
Name Null? Type
----------------------------------------------------------------------------------- -------- --------------------------------------------------------
ID VARCHAR2(128)
TYPE VARCHAR2(16)
VOLUME_ID VARCHAR2(128)
KMS_KEY_ID VARCHAR2(4)
SIZE_IN_GBS NUMBER
SIZE_IN_MBS NUMBER
SOURCE_TYPE VARCHAR2(8)
SYSTEM_TAGS$ORCL_CLOUD$FREE_TIER_RETAINED VARCHAR2(4)
DEFINED_TAGS$ORACLE_TAGS$CREATEDBY VARCHAR2(64)
DEFINED_TAGS$ORACLE_TAGS$CREATEDON VARCHAR2(32)
DISPLAY_NAME VARCHAR2(16)
TIME_CREATED VARCHAR2(32)
FREEFORM_TAGS$BACKUP VARCHAR2(16)
COMPARTMENT_ID VARCHAR2(128)
EXPIRATION_TIME VARCHAR2(4)
LIFECYCLE_STATE VARCHAR2(16)
UNIQUE_SIZE_IN_GBS NUMBER
UNIQUE_SIZE_IN_MBS NUMBER
TIME_REQUEST_RECEIVED VARCHAR2(32)
SOURCE_VOLUME_BACKUP_ID VARCHAR2(4)
WITH
days_in_future as (
SELECT vdate,
decode(to_number(to_char (vdate, 'd', 'nls_date_language=english')),1,1,0) is_sunday,
decode(vdate,trunc(vdate,'MM'),1,0) is_month_first_day,
decode(vdate,trunc(vdate,'YYYY'),1,0) is_year_first_day
FROM (SELECT trunc(sysdate) + rownum vdate
FROM dual
CONNECT BY LEVEL <= 366*6 /* 6 Years */
)
),
days_in_future_period as (
SELECT vdate,
case
when is_sunday+is_month_first_day+is_year_first_day = 0
then 'ONE_DAY'
when is_sunday=1 and is_month_first_day+is_year_first_day = 0
then 'ONE_WEEK'
when is_month_first_day=1 and is_year_first_day = 0
then 'ONE_MONTH'
else 'ONE_YEAR'
end period
FROM days_in_future
),
bkp_policies as (
SELECT distinct
id policy_id,
display_name policy_name,
schedules$period period,
schedules$backup_type type,
schedules$retention_seconds retention_seconds
FROM OCI360_BKP_POLICY
),
bkps_in_future as (
select t2.policy_name,
t2.policy_id,
t1.period,
t2.type,
t1.vdate creation_date,
t1.vdate+ (t2.retention_seconds/(60*60*24)) expire_date
FROM days_in_future_period t1,
bkp_policies t2
WHERE t1.period=t2.period
)
,
bkp_size_estimation as (
select DECODE(type,'INCREMENTAL',avg(unique_size_in_gbs),'FULL',max(unique_size_in_gbs)) est_unique_size_in_gbs,
type,
volume_id
FROM OCI360_BACKUPS
WHERE lifecycle_state = 'AVAILABLE'
GROUP BY type,
volume_id
),
bkps as (
select tas.creation_date,
tas.expire_date,
bse.est_unique_size_in_gbs unique_size_in_gbs,
tas.type
from bkps_in_future tas,
OCI360_VOLUMES jt,
OCI360_BKP_POLICY_ASSIGN tbkppolassign,
bkp_size_estimation bse
WHERE jt.ID = tbkppolassign.ASSET_ID
AND tbkppolassign.POLICY_ID = tas.POLICY_ID
AND jt.ID = bse.volume_id (+)
AND tas.type = bse.type (+)
UNION ALL
SELECT cast(to_timestamp_tz(t1.time_created,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM') AT LOCAL AS DATE) creation_date,
nvl(cast(to_timestamp_tz(t1.expiration_time,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM') AT LOCAL AS DATE),sysdate+10000) expire_date,
unique_size_in_gbs,
t1.type
FROM OCI360_BACKUPS t1
WHERE t1.lifecycle_state = 'AVAILABLE'
),
bkps_sum_day as (
select vdate,
type,
SUM(CASE WHEN vdate BETWEEN creation_date AND expire_date THEN unique_size_in_gbs ELSE 0 END) TOTAL
from bkps,
( SELECT trunc(sysdate) + ((ROWNUM-1)*10) vdate /* (10 in 10 days) */
FROM dual
CONNECT BY LEVEL <= (366*6) /* 6 Years */
) days
where vdate <= ADD_MONTHS(sysdate,12*6) /* 6 Years */
group by vdate, type
),
bkps_sum_month as (
select trunc(vdate,'mm') vdate,
type,
max(total) total
from bkps_sum_day
group by trunc(vdate,'mm'), type
),
result as (
select rank() over (order by vdate asc) snap_id,
TO_CHAR(vdate, 'YYYY-MM-DD HH24:MI:SS') begin_time,
TO_CHAR(ADD_MONTHS(vdate,1),'YYYY-MM-DD HH24:MI:SS') end_time,
CEIL(SUM(total)) line1,
CEIL(SUM(CASE WHEN type = 'INCREMENTAL' THEN total ELSE 0 END)) line2,
CEIL(SUM(CASE WHEN type = 'FULL' THEN total ELSE 0 END)) line3
from bkps_sum_month
group by vdate
)
select snap_id,
begin_time,
end_time,
line1,
line2,
line3,
0 dummy_04,
0 dummy_05,
0 dummy_06,
0 dummy_07,
0 dummy_08,
0 dummy_09,
0 dummy_10,
0 dummy_11,
0 dummy_12,
0 dummy_13,
0 dummy_14,
0 dummy_15
from result
order by snap_id;
73 rows selected.