title: Find out free space on tablespace
body: <p>Our application has failed a few times because an 'ORA-01536: space quota exceeded for tablespace', and we would like to be able to prevent this by checking regularly the free space on the tablespace and raising an alert when it drops below certain level.</p>
  
  <p>Is there any way to find out how much free space is left in a tablespace?</p>
  
  <p>After some research (I am not a DBA), I tried the following:</p>
  
  <pre><code>select max_bytes-bytes from user_ts_quotas;
  
  select sum(nvl(bytes,0)) from user_free_space;
  </code></pre>
  
  <p>but those queries return completely different results.</p>