Backup space estimate

Before you launch a backup of all your databases, you must be sure you have enough space on your server.
With the following script you can estimate for an instance, the global volume of the whole databases, with no backup compression applied.
If you decide to apply a backup compression, you can trust the following calculation:

CompressedBackupSpaceNeeded = AllDatabasesSize / 5
DECLARE @InstanceName		VARCHAR(250)
DECLARE @DatabasesSize		INT
DECLARE @AllDatabasesSize	INT

SET @AllDatabasesSize = 0

DECLARE csrDatabaseSize CURSOR FAST_FORWARD FOR 
	SELECT      
	@@SERVERNAME AS Instance,
	SUM(8192.0E * af.size / 1048576.0E) AS Taille_Totale
	FROM        master..sysdatabases AS db
	INNER JOIN master..sysaltfiles AS af ON af.[dbid] = db.[dbid]
	WHERE       db.name NOT IN('tempdb')
	GROUP BY    db.name
		
	OPEN csrDatabaseSize

		FETCH csrDatabaseSize INTO @InstanceName,@DatabasesSize
		WHILE @@Fetch_Status = 0 
			BEGIN
			
				SET @AllDatabasesSize = @AllDatabasesSize + @DatabasesSize
			
				FETCH csrDatabaseSize INTO @InstanceName,@DatabasesSize
				
			END

	CLOSE csrDatabaseSize
	DEALLOCATE csrDatabaseSize
	
SELECT @AllDatabasesSize