Name Null? Type
----------------------------------------------------------------------------------- -------- --------------------------------------------------------
ID VARCHAR2(128)
SHAPE VARCHAR2(32)
REGION VARCHAR2(4)
IMAGE_ID VARCHAR2(128)
METADATA$SSH_AUTHORIZED_KEYS VARCHAR2(512)
IPXE_SCRIPT VARCHAR2(4)
LAUNCH_MODE VARCHAR2(16)
SYSTEM_TAGS$ORCL_CLOUD$FREE_TIER_RETAINED VARCHAR2(4)
AGENT_CONFIG$IS_MANAGEMENT_DISABLED VARCHAR2(8)
AGENT_CONFIG$IS_MONITORING_DISABLED VARCHAR2(8)
DEFINED_TAGS$ORACLE_TAGS$CREATEDBY VARCHAR2(64)
DEFINED_TAGS$ORACLE_TAGS$CREATEDON VARCHAR2(32)
DISPLAY_NAME VARCHAR2(16)
FAULT_DOMAIN VARCHAR2(16)
SHAPE_CONFIG$GPUS NUMBER
SHAPE_CONFIG$OCPUS NUMBER
SHAPE_CONFIG$LOCAL_DISKS NUMBER
SHAPE_CONFIG$MEMORY_IN_GBS NUMBER
SHAPE_CONFIG$GPU_DESCRIPTION VARCHAR2(4)
SHAPE_CONFIG$MAX_VNIC_ATTACHMENTS NUMBER
SHAPE_CONFIG$PROCESSOR_DESCRIPTION VARCHAR2(64)
SHAPE_CONFIG$LOCAL_DISK_DESCRIPTION VARCHAR2(4)
SHAPE_CONFIG$NETWORKING_BANDWIDTH_IN_GBPS NUMBER
SHAPE_CONFIG$LOCAL_DISKS_TOTAL_SIZE_IN_GBS VARCHAR2(4)
TIME_CREATED VARCHAR2(32)
COMPARTMENT_ID VARCHAR2(128)
LAUNCH_OPTIONS$FIRMWARE VARCHAR2(8)
LAUNCH_OPTIONS$NETWORK_TYPE VARCHAR2(16)
LAUNCH_OPTIONS$BOOT_VOLUME_TYPE VARCHAR2(16)
LAUNCH_OPTIONS$REMOTE_DATA_VOLUME_TYPE VARCHAR2(16)
LAUNCH_OPTIONS$IS_CONSISTENT_VOLUME_NAMING_ENABLED VARCHAR2(4)
LAUNCH_OPTIONS$IS_PV_ENCRYPTION_IN_TRANSIT_ENABLED VARCHAR2(8)
SOURCE_DETAILS$IMAGE_ID VARCHAR2(128)
SOURCE_DETAILS$KMS_KEY_ID VARCHAR2(4)
SOURCE_DETAILS$SOURCE_TYPE VARCHAR2(8)
SOURCE_DETAILS$BOOT_VOLUME_SIZE_IN_GBS VARCHAR2(4)
LIFECYCLE_STATE VARCHAR2(8)
AVAILABILITY_DOMAIN VARCHAR2(32)
DEDICATED_VM_HOST_ID VARCHAR2(4)
TIME_MAINTENANCE_REBOOT_DUE VARCHAR2(4)
WITH t1 as (select /*+ materialize */ compartment_id,count(*) total_comp from OCI360_INSTANCES group by compartment_id),
t2 as (select /*+ materialize */ * from OCI360_COMPARTMENTS),
tot as (select sum(total_comp) total_global from t1)
SELECT t2.name || ' - ' || total_comp name,
total_comp total,
trim(to_char(round(total_comp/decode(total_global,0,1,total_global),4)*100,'990D99')) percent
FROM t1, t2, tot
WHERE t1.compartment_id=t2.id;
1 rows selected.