Calculate total size of database and if you don't need size with TEMPFILE then you can make comment / remove the last line of script. SELECT SUM (bytes) / 1024...