IF OBJECT_ID('tempdb..#state')IS NOT NULL BEGIN;
    DROP TABLE #state;
END;

SELECT 
      database_name = DB_NAME(database_id)
    , log_size_mb = CAST(SUM(CASE WHEN f.type_desc = 'LOG' THEN size END) * 8. / 1024 AS DECIMAL(18,2))
    , row_size_mb = CAST(SUM(CASE WHEN type_desc = 'ROWS' THEN size END) * 8. / 1024 AS DECIMAL(18,2))
    , total_size_mb = CAST(SUM(size) * 8. / 1024 AS DECIMAL(18,2))
    , CAST(NULL AS DECIMAL(18,2)) AS compression_backup_percent
    , CAST(NULL AS DECIMAL(18,2)) AS compressed_backup_size_MB
INTO #state
FROM sys.master_files F WITH(NOWAIT)
WHERE LOWER(DB_NAME(database_id)) = 'arizona'
GROUP BY F.database_id

--#region start dummy backup
BACKUP DATABASE [Arizona] TO  DISK = N'nul' WITH  COPY_ONLY, NOFORMAT, INIT,  NAME = N'Arizona-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, COMPRESSION,  STATS = 10
--#endregion start dummy backup

--#region compute last backup compressed size
UPDATE s SET [s].[compression_backup_percent] = x.[compressPct]
     , s.[compressed_backup_size_MB] = x.[compressed_bkp_MB]
FROM [#state] s
    CROSS APPLY (
        SELECT TOP (1)
            [a].[backup_start_date]
            ,[a].[backup_finish_date]
            ,[a].[type]
            ,[a].[backup_size]
            ,[a].[backup_size] / 1024 / 1024 / 1024 AS bkp_size_GB
            ,[a].[backup_size] / 1024 / 1024 AS bkp_size_MB
            ,[a].[compressed_backup_size]
            ,[a].[compressed_backup_size] / 1024 / 1024 / 1024 AS compressed_bkp_GB
            ,[a].[compressed_backup_size] / 1024 / 1024 AS compressed_bkp_MB
            ,[a].[is_copy_only]
            ,compressPct = CAST(100.0 * [a].[compressed_backup_size] / [a].[backup_size] AS DECIMAL(5, 1))
        FROM msdb.dbo.backupset a
        WHERE LOWER([a].[database_name]) = 'arizona' --LOWER(s.[database_name])
        AND [a].[type]='D' --full bkp only
        AND [a].[is_copy_only] = 1
        AND [a].[backup_start_date] > DATEADD(HOUR, -1, CURRENT_TIMESTAMP)
        ORDER BY [a].[backup_start_date] DESC 
    ) x
--#endregion compute last backup compressed size


SELECT * 
FROM [#state]